由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Clock() problem
相关主题
C 程序 clock() timer 问题怎样准确测量函数执行的时间?
C++ 问题紧急求救古德巴大牛,请看这个设计题
问一个C\C++中clock()函数溢出问题C++在linux下读一次系统时间要多少时间
问个时钟的问题操!本版连interlocked指令都没有懂的?
How to measure CPU time spent on a code block (with C or C++)?请教:属于google不到答案的问题
In C++, how to do matrix computation?请教c++ multithreading入门问题
请教 C/C++ 指向多维数组的指针的问题guess what is this code for?
How to synchronize two computers clock?读取数据求教
相关话题的讨论汇总
话题: clock话题: include话题: sec话题: problem话题: clocks
进入Programming版参与讨论
1 (共1页)
t***g
发帖数: 193
1
Clock() always returns zero, anyone knows the reason?
sample code:
#include
#include
#include
using namespace std;
int main(){
for(long i=0;i<10;i++)
cout << clock() < return 0;
}
Thanks a lot.
y****i
发帖数: 156
2
// from MSDN
clock():
The returned value is the product of the amount of time that has elapsed since
the start of a process and the value of the CLOCKS_PER_SEC constant.
CLOCKS_PER_SEC = 1000
the_elapse_time(sec) < 1 sec since your comuter is very fast => the_elapse_
time = 0
=> your result = 0

【在 t***g 的大作中提到】
: Clock() always returns zero, anyone knows the reason?
: sample code:
: #include
: #include
: #include
: using namespace std;
: int main(){
: for(long i=0;i<10;i++)
: cout << clock() <: return 0;

t***g
发帖数: 193
3
Yes, it's not the problem of clock(), just coz there is nothing to run. I
figured it out myself later, after put in a FFT routine. Thanks any way.

since

【在 y****i 的大作中提到】
: // from MSDN
: clock():
: The returned value is the product of the amount of time that has elapsed since
: the start of a process and the value of the CLOCKS_PER_SEC constant.
: CLOCKS_PER_SEC = 1000
: the_elapse_time(sec) < 1 sec since your comuter is very fast => the_elapse_
: time = 0
: => your result = 0

1 (共1页)
进入Programming版参与讨论
相关主题
读取数据求教How to measure CPU time spent on a code block (with C or C++)?
一个极简单的程序求教In C++, how to do matrix computation?
【请教】fscanf 和 fstream 哪一个更好? (转载)请教 C/C++ 指向多维数组的指针的问题
关于文件读取的C++ 问题?How to synchronize two computers clock?
C 程序 clock() timer 问题怎样准确测量函数执行的时间?
C++ 问题紧急求救古德巴大牛,请看这个设计题
问一个C\C++中clock()函数溢出问题C++在linux下读一次系统时间要多少时间
问个时钟的问题操!本版连interlocked指令都没有懂的?
相关话题的讨论汇总
话题: clock话题: include话题: sec话题: problem话题: clocks