void _clutter_profile_suspend (void) { if (G_UNLIKELY (!searched_for_gl_uprof_context)) { gl_uprof_context = uprof_find_context ("OpenGL"); searched_for_gl_uprof_context = TRUE; } if (gl_uprof_context) uprof_context_suspend (gl_uprof_context); /* NB: The Cogl context is linked to this so it will also be suspended... */ uprof_context_suspend (_clutter_uprof_context); }
int main (int argc, char **argv) { UProfReport *report; UProfContext *context; int i; uprof_init (&argc, &argv); context = uprof_context_new ("Test"); for (i = 0; i < 4; i ++) { struct timespec delay; if (i == 1) { DBG_PRINTF ("suspending context\n"); uprof_context_suspend (context); } UPROF_COUNTER_INC (context, loop_counter); UPROF_TIMER_START (context, loop_timer); DBG_PRINTF (" <delay: 1 sec>\n"); delay.tv_sec = 1; delay.tv_nsec = 0; nanosleep (&delay, NULL); UPROF_TIMER_STOP (context, loop_timer); DBG_PRINTF ("stop simple timer (rdtsc = %" G_GUINT64_FORMAT ")\n", uprof_get_system_counter ()); if (i == 2) { DBG_PRINTF ("resuming context\n"); uprof_context_resume (context); } } DBG_PRINTF ("Expected result = 2 seconds accounted for and count == 2:\n"); report = uprof_report_new ("Suspend report"); uprof_report_add_context (report, context); uprof_report_print (report); uprof_report_unref (report); uprof_context_unref (context); return 0; }