From 1869ccfb2c81edc429580617ce4e59f36bf29a6a Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 28 Apr 2005 09:58:49 +0000 Subject: A profiler plugin. 2005-04-26 Not Zed * A profiler plugin. svn path=/trunk/; revision=29238 --- plugins/profiler/ChangeLog | 4 ++ plugins/profiler/Makefile.am | 15 +++++++ .../profiler/org-gnome-evolution-profiler.eplug.in | 15 +++++++ plugins/profiler/profiler.c | 49 ++++++++++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 plugins/profiler/ChangeLog create mode 100644 plugins/profiler/Makefile.am create mode 100644 plugins/profiler/org-gnome-evolution-profiler.eplug.in create mode 100644 plugins/profiler/profiler.c (limited to 'plugins/profiler') diff --git a/plugins/profiler/ChangeLog b/plugins/profiler/ChangeLog new file mode 100644 index 0000000000..8d64f0774e --- /dev/null +++ b/plugins/profiler/ChangeLog @@ -0,0 +1,4 @@ +2005-04-26 Not Zed + + * A profiler plugin. + diff --git a/plugins/profiler/Makefile.am b/plugins/profiler/Makefile.am new file mode 100644 index 0000000000..90f4e36abf --- /dev/null +++ b/plugins/profiler/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = \ + -I$(top_srcdir) \ + $(SHELL_CFLAGS) + +LIBS = $(SHELL_LIBS) + +@EVO_PLUGIN_RULE@ + +plugin_DATA = org-gnome-evolution-profiler.eplug +plugin_LTLIBRARIES = liborg-gnome-evolution-profiler.la + +liborg_gnome_evolution_profiler_la_SOURCES = profiler.c +liborg_gnome_evolution_profiler_la_LDFLAGS = -module -avoid-version + +EXTRA_DIST = org-gnome-evolution-profiler.eplug.in diff --git a/plugins/profiler/org-gnome-evolution-profiler.eplug.in b/plugins/profiler/org-gnome-evolution-profiler.eplug.in new file mode 100644 index 0000000000..2ad678188b --- /dev/null +++ b/plugins/profiler/org-gnome-evolution-profiler.eplug.in @@ -0,0 +1,15 @@ + + + + Writes a log of profiling data events. + + + + + + + diff --git a/plugins/profiler/profiler.c b/plugins/profiler/profiler.c new file mode 100644 index 0000000000..3cb2fc8bc2 --- /dev/null +++ b/plugins/profiler/profiler.c @@ -0,0 +1,49 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Author: Michael Zucchi + * + * Copyright 2005 Novell, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include +#include + +void +org_gnome_evolution_profiler_event(EPlugin *ep, EProfileEventTarget *t) +{ + static FILE *fp; + + if (!fp) { + char *name; + + name = g_strdup_printf("eprofile.%ld", (long int)getpid()); + fp = fopen(name, "w"); + if (fp) + fprintf(stderr, "Generating profiling data in `%s'\n", name); + g_free(name); + } + + if (fp) + fprintf(fp, "%d.%d: %s,%s\n", t->tv.tv_sec, t->tv.tv_usec, t->id, t->uid); +} -- cgit