31 static MDB_THREAD_LOCAL
char buffer[20];
43 sprintf(buffer,
"%02d:%02d:%02.3f", h, m, s);
57# if defined(__rtems__)
65static MDB_THREAD_LOCAL
struct timespec delapsedStart;
66static MDB_THREAD_LOCAL
short delapsedStartInitialized = 0;
74 clock_gettime(CLOCK_REALTIME, &delapsedStart);
75 delapsedStartInitialized = 1;
78static MDB_THREAD_LOCAL
double delapsed_start = 0;
94 struct timespec delapsedNow;
95 if (!delapsedStartInitialized)
97 clock_gettime(CLOCK_REALTIME, &delapsedNow);
98 return (
double)(delapsedNow.tv_sec - delapsedStart.tv_sec) +
99 (delapsedNow.tv_nsec - delapsedStart.tv_nsec)/1e9;
101 static MDB_THREAD_LOCAL
long delapsed_start = -1;
102 if (delapsed_start == -1) {
103 delapsed_start = time(0);
106 return time(0) - delapsed_start;
118 return (
long)((clock() * 100.0) / CLOCKS_PER_SEC);
148# if defined(linux) && !defined(__powerpc__)
150# include <sys/types.h>
163 long size, resident, pageSize;
165 if (!(fp = fopen(
"/proc/self/statm",
"r"))) {
166 perror(
"fopen failed in memory_count()");
169 if (fscanf(fp,
"%ld %ld", &size, &resident) != 2) {
170 perror(
"fscanf failed in memory_count()");
174 pageSize = sysconf(_SC_PAGESIZE);
175 return resident*(pageSize/1024);
long page_faults()
Retrieves the number of page faults since the last initialization.
long cpu_time()
Retrieves the CPU time used since the last initialization.
double delapsed_time(void)
Calculates the elapsed clock time since the last initialization as a numerical value.