24#if defined(UNIX) || defined(_WIN32) || defined(vxWorks)
25double delapsed_time(
void);
32 static char buffer[20];
37 dtime = delapsed_time();
44 sprintf(buffer,
"%02d:%02d:%02.3f", h, m, s);
58# if defined(__rtems__)
66static struct timespec delapsedStart;
67static short delapsedStartInitialized = 0;
75 clock_gettime(CLOCK_REALTIME, &delapsedStart);
76 delapsedStartInitialized = 1;
79static double delapsed_start = 0;
81 delapsed_start = delapsed_time();
93double delapsed_time() {
95 struct timespec delapsedNow;
96 if (!delapsedStartInitialized)
98 clock_gettime(CLOCK_REALTIME, &delapsedNow);
99 return (
double)(delapsedNow.tv_sec - delapsedStart.tv_sec) +
100 (delapsedNow.tv_nsec - delapsedStart.tv_nsec)/1e9;
102 static long delapsed_start = -1;
103 if (delapsed_start == -1) {
104 delapsed_start = time(0);
107 return time(0) - delapsed_start;
119 return (
long)((clock() * 100.0) / CLOCKS_PER_SEC);
149# if defined(linux) && !defined(__powerpc__)
151# include <sys/types.h>
164 static short first = 1;
165 static char proc[100];
169 sprintf(proc,
"/proc/%ld/statm", (
long)getpid());
172 if (!(fp = fopen(proc,
"r"))) {
173 perror(
"fopen failed in memory_count()");
176 if (fscanf(fp,
"%ld", &size1) != 1) {
177 perror(
"fscanf failed in memory_count()");