|
View Full Version : Using sreagvle May 15th, 2007, 07:47 AM To get the system time in milliseconds in my c++ program I want to use gettimeofday() from . I have implemented this in a small test program O.K. but I cant get it to work in a larger program Im working on. The problem is I cant create a pointer to a timeval object. When I run: timeval *my_time; cout < "my_time is: " < < ...
Last updated 2010-03-05 14:16:31
./cXX/posts/time_getrusage.txt
Hello all, Ive been doing some getrusage tests using this: #include #include #include int main(void) { unsigned int i; struct rusage ru; for(i=1;i;i++) asm volatile("nop"); getrusage(RUSAGE_SELF, &ru); printf("%dsec %dusec
",ru.ru_utime.tv_sec,ru.ru_utime.tv_usec); return 0; } What is good is that results do not seem to depend on other thread activity nor disk i/o. However, each time I run this program, result varies (from 4.039 sec to 4.062 ...
Last updated 2010-03-05 14:16:31
./cXX/posts/time_function_ref.txt
Unix, C, and C++ Function Reference Time Index: CPU time usage: clock_t Explanation of type for CPU times. clock Get CPU time consumed getrusage Get CPU time consumed Time of Day and Date: time_t Explanation of type for simple times. time Get actual time, resolution 1 second. ctime Convert time (seconds) to printable string. tm Explanation of tm type for d,m,y,h,m,s. localtime ...
Last updated 2010-03-05 14:16:31
© copyright 2010
Design by: lev