diff options
Diffstat (limited to 'src/lib/common.c')
-rw-r--r-- | src/lib/common.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/lib/common.c b/src/lib/common.c index d6dd43c4b..98fb82c11 100644 --- a/src/lib/common.c +++ b/src/lib/common.c | |||
@@ -286,42 +286,3 @@ int pid_hidepid(void) { | |||
286 | fclose(fp); | 286 | fclose(fp); |
287 | return 0; | 287 | return 0; |
288 | } | 288 | } |
289 | |||
290 | //************************** | ||
291 | // time trace based on getticks function | ||
292 | //************************** | ||
293 | static int tt_not_implemented = 0; // not implemented for the current architecture | ||
294 | static unsigned long long tt_1ms = 0; | ||
295 | static unsigned long long tt = 0; // start time | ||
296 | |||
297 | void timetrace_start(void) { | ||
298 | if (tt_not_implemented) | ||
299 | return; | ||
300 | unsigned long long t1 = getticks(); | ||
301 | if (t1 == 0) { | ||
302 | tt_not_implemented = 1; | ||
303 | return; | ||
304 | } | ||
305 | |||
306 | if (tt_1ms == 0) { | ||
307 | usleep(1000); // sleep 1 ms | ||
308 | unsigned long long t2 = getticks(); | ||
309 | tt_1ms = t2 - t1; | ||
310 | if (tt_1ms == 0) { | ||
311 | tt_not_implemented = 1; | ||
312 | return; | ||
313 | } | ||
314 | } | ||
315 | |||
316 | tt = getticks(); | ||
317 | } | ||
318 | |||
319 | float timetrace_end(void) { | ||
320 | if (tt_not_implemented) | ||
321 | return 0; | ||
322 | |||
323 | unsigned long long delta = getticks() - tt; | ||
324 | assert(tt_1ms); | ||
325 | |||
326 | return (float) delta / (float) tt_1ms; | ||
327 | } | ||