Diff for libplaton/platon/misc/rdtsc.c between version 1.3 and 1.4
| version 1.3, 2002/07/19 09:29:30 |
version 1.4, 2002/07/31 00:49:36 |
|
|
| |
|
| #include <stdio.h> |
#include <stdio.h> |
| #include <time.h> |
#include <time.h> |
| #include <dirent.h> |
|
| #include "rdtsc.h" |
#include "rdtsc.h" |
| |
|
| #if defined SELF || defined SEFTEST || defined SELF_RDTSC |
#if defined SELF || defined SEFTEST || defined SELF_RDTSC |
|
|
| /* Function int main(int argc, char **argv) {{{ */ |
/* Function int main(int argc, char **argv) {{{ */ |
| int main(int argc, char **argv) |
int main(int argc, char **argv) |
| { |
{ |
| printf("time(NULL): "); |
double result_min; |
| rdtsc(time(NULL), 1000, result_max); |
double result_max; |
| |
double result_avg; |
| |
|
| |
rdtsc_min(time(NULL), 500000, result_min); |
| |
rdtsc_avg(time(NULL), 500000, result_avg); |
| |
rdtsc_max(time(NULL), 500000, result_max); |
| |
|
| |
printf( "time(NULL): min:%g\n" |
| |
"time(NULL): max:%g\n" |
| |
"time(NULL): avg:%g\n", |
| |
result_min, |
| |
result_max, |
| |
result_avg); |
| |
|
| |
/* the same test in another order */ |
| |
rdtsc_min(time(NULL), 500000, result_min); |
| |
rdtsc_max(time(NULL), 500000, result_max); |
| |
rdtsc_avg(time(NULL), 500000, result_avg); |
| |
|
| |
printf( "time(NULL): min:%g\n" |
| |
"time(NULL): max:%g\n" |
| |
"time(NULL): avg:%g\n", |
| |
result_min, |
| |
result_max, |
| |
result_avg); |
| |
|
| return 0; |
return 0; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| #endif |
#endif |
| |
|
| Line 24 int main(int argc, char **argv) |
|
| Line 48 int main(int argc, char **argv) |
|
| * vim:set ts=4: |
* vim:set ts=4: |
| * vim600:fdm=marker fdl=0 fdc=3: |
* vim600:fdm=marker fdl=0 fdc=3: |
| * }}} */ |
* }}} */ |
| |
|
Platon Group <platon@platon.org> http://platon.org/
|
|