c - How to extend clock() execution time -
my c program can run more 3 hours. sake of experiment, want calculate duration time (i.e., execution time) taken program until finishes. use start = clock();
@ beginning of main()
, @ end end = clock()
, subtract end - start
execution time. however, said here, clock_t clock(void)
limited 72 minutes. how can enforce count whole execution time not 72 minutes?
the time()
function specified in c89, c99, c11. has second resolution , spans more 30-bits worth of seconds. it's portable solution. in fact, i'd never heard of clock()
until today. counting ticks want if need high resolution.
if don't need portable way measure cpu/execution time, use procfs
. proc/self/stat
's stime
field , sysconf(_sc_clk_tck)
should need.
Comments
Post a Comment