gtk/perf/main.c
Federico Mena Quintero 4b4c0fe86c New directory with the start of a framework for testing performance in
2005-07-26  Federico Mena Quintero  <federico@ximian.com>

	* perf/: New directory with the start of a framework for testing
	performance in GTK+.

	* Makefile.am (SRC_SUBDIRS): Added the perf directory.

	* configure.in (AC_OUTPUT): Generate perf/Makefile.
2005-07-26 18:46:01 +00:00

55 lines
896 B
C

#include <stdio.h>
#include <gtk/gtk.h>
#include "appwindow.h"
#include "timers.h"
#define ITERS 20
static GtkWidget *
create_cb (gpointer data)
{
return appwindow_new ();
}
static void
report_cb (TimerReport report, gdouble elapsed, gpointer data)
{
const char *type;
switch (report) {
case TIMER_REPORT_WIDGET_CREATION:
type = "widget creation";
break;
case TIMER_REPORT_WIDGET_SHOW:
type = "widget show";
break;
case TIMER_REPORT_WIDGET_DESTRUCTION:
type = "widget destruction";
break;
default:
g_assert_not_reached ();
type = NULL;
}
fprintf (stderr, "%s: %g sec\n", type, elapsed);
if (report == TIMER_REPORT_WIDGET_DESTRUCTION)
fputs ("\n", stderr);
}
int
main (int argc, char **argv)
{
int i;
gtk_init (&argc, &argv);
for (i = 0; i < ITERS; i++)
timer_time_widget (create_cb, report_cb, NULL);
return 0;
}