diff options
author | Not Zed <NotZed@Ximian.com> | 2005-04-28 17:58:49 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2005-04-28 17:58:49 +0800 |
commit | 1869ccfb2c81edc429580617ce4e59f36bf29a6a (patch) | |
tree | fc3060ec51e5af14a45dbd1363f63c69d952a6f7 /plugins/profiler | |
parent | 317bcecd09f60134dda35f25942aed85924f9ea8 (diff) | |
download | gsoc2013-evolution-1869ccfb2c81edc429580617ce4e59f36bf29a6a.tar.gz gsoc2013-evolution-1869ccfb2c81edc429580617ce4e59f36bf29a6a.tar.zst gsoc2013-evolution-1869ccfb2c81edc429580617ce4e59f36bf29a6a.zip |
A profiler plugin.
2005-04-26 Not Zed <NotZed@Ximian.com>
* A profiler plugin.
svn path=/trunk/; revision=29238
Diffstat (limited to 'plugins/profiler')
-rw-r--r-- | plugins/profiler/ChangeLog | 4 | ||||
-rw-r--r-- | plugins/profiler/Makefile.am | 15 | ||||
-rw-r--r-- | plugins/profiler/org-gnome-evolution-profiler.eplug.in | 15 | ||||
-rw-r--r-- | plugins/profiler/profiler.c | 49 |
4 files changed, 83 insertions, 0 deletions
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 <NotZed@Ximian.com> + + * 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 @@ +<e-plugin-list> + <e-plugin + id="org.gnome.evolution.profiler" + type="shlib" + name="Evolution Profiler" + location="@PLUGINDIR@/liborg-gnome-evolution-profiler.so"> + + <description>Writes a log of profiling data events.</description> + <author name="Michael Zucchi" email="notzed@novell.com"/> + + <hook class="org.gnome.evolution.profile.events:1.0"> + <event id="event" handle="org_gnome_evolution_profiler_event" target="event"/> + </hook> + </e-plugin> +</e-plugin-list> 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 <notzed@novell.com> + * + * 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 <config.h> +#endif + +#include <string.h> +#include <stdio.h> + +#include <glib.h> +#include <e-util/e-profile-event.h> + +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); +} |