1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/cairo/libpixman/src/pixman-timer.c Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,66 @@ 1.4 +/* 1.5 + * Copyright © 2007 Red Hat, Inc. 1.6 + * 1.7 + * Permission to use, copy, modify, distribute, and sell this software and its 1.8 + * documentation for any purpose is hereby granted without fee, provided that 1.9 + * the above copyright notice appear in all copies and that both that 1.10 + * copyright notice and this permission notice appear in supporting 1.11 + * documentation, and that the name of Red Hat not be used in advertising or 1.12 + * publicity pertaining to distribution of the software without specific, 1.13 + * written prior permission. Red Hat makes no representations about the 1.14 + * suitability of this software for any purpose. It is provided "as is" 1.15 + * without express or implied warranty. 1.16 + * 1.17 + * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 1.18 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT 1.19 + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1.20 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 1.21 + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 1.22 + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1.23 + */ 1.24 + 1.25 +#ifdef HAVE_CONFIG_H 1.26 +#include <config.h> 1.27 +#endif 1.28 + 1.29 +#include <stdlib.h> 1.30 +#include <stdio.h> 1.31 +#include "pixman-private.h" 1.32 + 1.33 +#ifdef PIXMAN_TIMERS 1.34 + 1.35 +static pixman_timer_t *timers; 1.36 + 1.37 +static void 1.38 +dump_timers (void) 1.39 +{ 1.40 + pixman_timer_t *timer; 1.41 + 1.42 + for (timer = timers; timer != NULL; timer = timer->next) 1.43 + { 1.44 + printf ("%s: total: %llu n: %llu avg: %f\n", 1.45 + timer->name, 1.46 + timer->total, 1.47 + timer->n_times, 1.48 + timer->total / (double)timer->n_times); 1.49 + } 1.50 +} 1.51 + 1.52 +void 1.53 +pixman_timer_register (pixman_timer_t *timer) 1.54 +{ 1.55 + static int initialized; 1.56 + 1.57 + int atexit (void (*function)(void)); 1.58 + 1.59 + if (!initialized) 1.60 + { 1.61 + atexit (dump_timers); 1.62 + initialized = 1; 1.63 + } 1.64 + 1.65 + timer->next = timers; 1.66 + timers = timer; 1.67 +} 1.68 + 1.69 +#endif