Skip to content

Commit 6fb3eab

Browse files
committed
DEBUG: DO NOT MERGE!
1 parent befc5f9 commit 6fb3eab

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/timer.c

+12
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ static sys_thread_t *callback_thread = 0;
8484
*/
8585
static qd_timestamp_t time_base = 0;
8686

87+
// DEBUG:
88+
static qd_duration_t max_handler;
89+
8790
ALLOC_DECLARE(qd_timer_t);
8891
ALLOC_DEFINE(qd_timer_t);
8992

@@ -292,6 +295,10 @@ void qd_timer_initialize(void)
292295
void qd_timer_finalize(void)
293296
{
294297
sys_mutex_free(&lock);
298+
if (max_handler) {
299+
fprintf(stdout, "MAX TIME=%lld\n", (long long) max_handler);
300+
fflush(0);
301+
}
295302
}
296303

297304

@@ -314,7 +321,12 @@ void qd_timer_visit(void)
314321
* dropped. Attempting to delete the timer now will cause the caller to
315322
* block until the callback is done.
316323
*/
324+
qd_timestamp_t start = qd_timer_now();
317325
timer->handler(timer->context);
326+
qd_timestamp_t end = qd_timer_now();
327+
if (end - start > max_handler) {
328+
max_handler = end - start;
329+
}
318330

319331
sys_mutex_lock(&lock);
320332
if (timer->state == QD_TIMER_STATE_BLOCKED) {

0 commit comments

Comments
 (0)