~ubuntu-branches/debian/squeeze/pixman/squeeze

« back to all changes in this revision

Viewing changes to pixman/pixman-timer.c

  • Committer: Bazaar Package Importer
  • Author(s): David Nusinow
  • Date: 2007-08-09 22:15:45 UTC
  • Revision ID: james.westby@ubuntu.com-20070809221545-b3rj83wnluotrybv
Tags: upstream-0.9.4
Import upstream version 0.9.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2007 Red Hat, Inc.
 
3
 *
 
4
 * Permission to use, copy, modify, distribute, and sell this software and its
 
5
 * documentation for any purpose is hereby granted without fee, provided that
 
6
 * the above copyright notice appear in all copies and that both that
 
7
 * copyright notice and this permission notice appear in supporting
 
8
 * documentation, and that the name of Red Hat not be used in advertising or
 
9
 * publicity pertaining to distribution of the software without specific,
 
10
 * written prior permission.  Red Hat makes no representations about the
 
11
 * suitability of this software for any purpose.  It is provided "as is"
 
12
 * without express or implied warranty.
 
13
 *
 
14
 * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
 
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT
 
16
 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 
17
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
 
18
 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 
19
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
20
 */
 
21
 
 
22
#include <config.h>
 
23
#include <stdlib.h>
 
24
#include <stdio.h>
 
25
#include "pixman-private.h"
 
26
 
 
27
static PixmanTimer *timers;
 
28
 
 
29
static void
 
30
dump_timers (void)
 
31
{
 
32
    PixmanTimer *timer;
 
33
 
 
34
    for (timer = timers; timer != NULL; timer = timer->next)
 
35
    {
 
36
        printf ("%s:   total: %llu     n: %llu      avg: %f\n",
 
37
                timer->name,
 
38
                timer->total,
 
39
                timer->n_times,
 
40
                timer->total / (double)timer->n_times);
 
41
    }
 
42
}
 
43
 
 
44
void
 
45
pixman_timer_register (PixmanTimer *timer)
 
46
{
 
47
    static int initialized;
 
48
 
 
49
    int atexit(void (*function)(void));
 
50
 
 
51
    if (!initialized)
 
52
    {
 
53
        atexit (dump_timers);
 
54
        initialized = 1;
 
55
    }
 
56
    
 
57
    timer->next = timers;
 
58
    timers = timer;
 
59
}