由买买提看人间百态

topics

全部话题 - 话题: elapmilli
(共0页)
s***1
发帖数: 49
1
来自主题: Programming版 - C++ 问题紧急求救
我的程序里面有3条指令,现在我想知道这3条指令一共需要多少时间执行(
milliseconds). 我google到的一个程序:
Begin = clock() * CLK_TCK; //start the timer
//中间的指令
End = clock() * CLK_TCK;
elapTicks = End - Begin; //the number of ticks from Begin to End
elapMilli = elapTicks/1000;
elapMilli = 总共时间。
O*******d
发帖数: 20343
2
来自主题: Programming版 - C++ 问题紧急求救
clock_t Begin = clock() ; //start the timer
//中间的指令
clock_t End = clock() ;
clock_t elapTicks = End - Begin; //the number of ticks from Begin to End
float elapMilli = (float)elapTicks/ (float) CLOCKS_PER_SEC * 1000.0f;
elapMilli = 总共时间。
O*******d
发帖数: 20343
3
来自主题: Programming版 - C++ 问题紧急求救
clock() returns process execution time, not the real time. If you have
another program running extensively at the same time you are running this
program, the elapMilli is much smaller than the actual time.
(共0页)