????3. ?????????????????”????“????
?????????????????????????????Ч?????????????????????????μ?????
????3.1 ??????
????????????????clock??????????????????????????????????cpu?????????????????????cpu????????????
??????clock????????????????????′ε???clock??????????cpu???????????????????????cpu?????С????????????
????????????????????cpu???????????????????????????ж???д?????????
????3.2 ????????
???????????time???????????????clock????????????ò??????????CPU???+??CPU???????????????????ζ???????
??????????????????????????????Σ???????????????
????system("cd");
?????????????????????????У????????????????????????????
????????shell????
????time ./test
??????????
????Time to do 1000 empty loops is 0.010000 seconds
????real 0m3.492s
????user 0m0.512s
????sys 0m2.972s
????????????????clock????????п???CPU???????????????
????3.3 ????????
???????????????????Real time?? User time??Sys time??real time > user time + sys time ???????????????
?????????????????????м?????????λ???????????????????
????Real????????????????User??Sys?????y???????CPU???
????1. Real????????(wall clock time)?????????????????????????????????????????????????????????????????????????I/O??????
????2. User??????????????????????????????????????д??????????????CPU????????????????????????????????????
????3. Sys????????????????CPU?????????????????????????CPU???
??????????????????????????????????????????????????????????????(user time + sys time)С???
????User+Sys??????????????CPU????????????????????????????ж?????????ж????????????У????????Real time??CPU time??User + Sys time???С????????????????