Tizen 2.0 Release
[framework/graphics/cairo.git] / perf / cairo-perf-print.c
1 /*
2  * Copyright © 2006 Red Hat, Inc.
3  * Copyright © 2009 Chris Wilson
4  *
5  * Permission to use, copy, modify, distribute, and sell this software
6  * and its documentation for any purpose is hereby granted without
7  * fee, provided that the above copyright notice appear in all copies
8  * and that both that copyright notice and this permission notice
9  * appear in supporting documentation, and that the name of the
10  * copyright holders not be used in advertising or publicity
11  * pertaining to distribution of the software without specific,
12  * written prior permission. The copyright holders make no
13  * representations about the suitability of this software for any
14  * purpose.  It is provided "as is" without express or implied
15  * warranty.
16  *
17  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
18  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
19  * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
20  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
21  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
22  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
23  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
24  * SOFTWARE.
25  *
26  * Authors: Carl Worth <cworth@cworth.org>
27  *          Chris Wilson <chris@chris-wilson.co.uk>
28  */
29
30 #include "cairo-perf.h"
31
32 #include <stdio.h>
33
34 static void
35 report_print (const cairo_perf_report_t *report)
36 {
37     const test_report_t *tests;
38
39     tests = report->tests;
40     for (tests = report->tests; tests->name != NULL; tests++) {
41         if (tests->stats.iterations == 0)
42             continue;
43
44         if (tests->size) {
45             printf ("%5s-%-4s %26s-%-3d  %6.2f %4.2f%%\n",
46                     tests->backend, tests->content,
47                     tests->name, tests->size,
48                     tests->stats.median_ticks / tests->stats.ticks_per_ms,
49                     tests->stats.std_dev * 100);
50         } else {
51             printf ("%5s %26s  %6.2f %4.2f%%\n",
52                     tests->backend, tests->name,
53                     tests->stats.median_ticks / tests->stats.ticks_per_ms,
54                     tests->stats.std_dev * 100);
55         }
56     }
57 }
58
59 int
60 main (int         argc,
61       const char *argv[])
62 {
63     int i;
64
65     for (i = 1; i < argc; i++ ) {
66         cairo_perf_report_t report;
67
68         cairo_perf_report_load (&report, argv[i], i, NULL);
69         report_print (&report);
70     }
71
72     return 0;
73 }