[Gnucash-changes] r14351 - gnucash/trunk - Move the valgrind reference code from a compiled file to a
David Hampton
hampton at cvs.gnucash.org
Fri Jun 9 17:33:32 EDT 2006
Author: hampton
Date: 2006-06-09 17:33:29 -0400 (Fri, 09 Jun 2006)
New Revision: 14351
Trac: http://svn.gnucash.org/trac/changeset/14351
Added:
gnucash/trunk/src/doc/valgrind.txt
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/configure.in
gnucash/trunk/src/doc/Makefile.am
gnucash/trunk/src/gnome-utils/gnc-main-window.c
gnucash/trunk/src/gnome-utils/ui/gnc-main-window-ui.xml
Log:
Move the valgrind reference code from a compiled file to a
documentation file. The start/stop valgrind command didn't work as
well as I'd hoped. Fixes #344353.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-06-09 04:38:50 UTC (rev 14350)
+++ gnucash/trunk/ChangeLog 2006-06-09 21:33:29 UTC (rev 14351)
@@ -1,3 +1,13 @@
+2006-06-09 David Hampton <hampton at employees.org>
+
+ * src/doc/valgrind.txt:
+ * src/doc/Makefile.am:
+ * src/gnome-utils/ui/gnc-main-window-ui.xml:
+ * src/gnome-utils/gnc-main-window.c:
+ * configure.in: Move the valgrind reference code from a compiled
+ file to a documentation file. The start/stop valgrind command
+ didn't work as well as I'd hoped. Fixes #344353.
+
2006-06-07 David Hampton <hampton at employees.org>
* src/business/business-gnome/business-gnome.scm: Restore the
Modified: gnucash/trunk/configure.in
===================================================================
--- gnucash/trunk/configure.in 2006-06-09 04:38:50 UTC (rev 14350)
+++ gnucash/trunk/configure.in 2006-06-09 21:33:29 UTC (rev 14351)
@@ -985,10 +985,6 @@
BB_ENABLE_DOXYGEN
-# check for callgrind
-# ----------------------------------------------------------------------------
-AC_CHECK_HEADERS(valgrind/callgrind.h)
-
### --------------------------------------------------------------------------
### Libraries
LIBS="$LIBS -lm"
Modified: gnucash/trunk/src/doc/Makefile.am
===================================================================
--- gnucash/trunk/src/doc/Makefile.am 2006-06-09 04:38:50 UTC (rev 14350)
+++ gnucash/trunk/src/doc/Makefile.am 2006-06-09 21:33:29 UTC (rev 14351)
@@ -26,6 +26,7 @@
netlogin.txt \
guid.txt \
qif.txt \
+ valgrind.txt \
generic-druid-framework.txt \
user-prefs-howto.txt
Added: gnucash/trunk/src/doc/valgrind.txt
===================================================================
--- gnucash/trunk/src/doc/valgrind.txt 2006-06-09 04:38:50 UTC (rev 14350)
+++ gnucash/trunk/src/doc/valgrind.txt 2006-06-09 21:33:29 UTC (rev 14351)
@@ -0,0 +1,41 @@
+In order to debug with callgrind, you need to add a couple of code
+fragments around the section of code you are profiling. This is
+easiest if you can find the function that invokes the routine(s) you
+want to profile, add the following code around the function call of
+interest.
+
+Add the following to the start of the file:
+
+ #include <valgrind/callgrind.h>
+
+Add the following to the start of the calling function:
+
+ static GTimeVal start, end;
+
+Add the following just before the function of interest:
+
+ g_print("Start timing.\n");
+ g_get_current_time(&start);
+ CALLGRIND_START_INSTRUMENTATION();
+ CALLGRIND_TOGGLE_COLLECT();
+
+Add the following just after the function of interest:
+
+ CALLGRIND_TOGGLE_COLLECT();
+ CALLGRIND_STOP_INSTRUMENTATION();
+ g_get_current_time(&end);
+ if (start.tv_usec > end.tv_usec) {
+ end.tv_usec += 1000000;
+ end.tv_sec -= 1;
+ }
+ g_print("Callgrind enabled for %d.%6d seconds.\n",
+ (int)(end.tv_sec - start.tv_sec),
+ (int)(end.tv_usec - start.tv_usec));
+
+You will need to recompile, and then run the 'gnucash-valgrind'
+wrapper script instead of the normal 'gnucash' script.
+
+NOTE: Version 3.2 of valgrind has changed the above macros to no
+longer take an argument. In order to compile with this version of
+valgrind you will need to remove the trailing parentheses and
+semicolon.
Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c 2006-06-09 04:38:50 UTC (rev 14350)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c 2006-06-09 21:33:29 UTC (rev 14351)
@@ -41,9 +41,6 @@
#include "gkeyfile.h"
#endif
#include "gtk-compat.h"
-#ifdef HAVE_VALGRIND_CALLGRIND_H
-#include <valgrind/callgrind.h>
-#endif
#include "gnc-plugin.h"
#include "gnc-plugin-manager.h"
@@ -127,7 +124,6 @@
static void gnc_main_window_cmd_view_toolbar (GtkAction *action, GncMainWindow *window);
static void gnc_main_window_cmd_view_summary (GtkAction *action, GncMainWindow *window);
static void gnc_main_window_cmd_view_statusbar (GtkAction *action, GncMainWindow *window);
-static void gnc_main_window_cmd_extensions_callgrind (GtkAction *action, GncMainWindow *window);
static void gnc_main_window_cmd_actions_reset_warnings (GtkAction *action, GncMainWindow *window);
static void gnc_main_window_cmd_actions_rename_page (GtkAction *action, GncMainWindow *window);
static void gnc_main_window_cmd_window_new (GtkAction *action, GncMainWindow *window);
@@ -314,9 +310,6 @@
{ "ViewStatusbarAction", NULL, N_("Stat_us Bar"), NULL,
N_("Show/hide the status bar on this window"),
G_CALLBACK (gnc_main_window_cmd_view_statusbar), TRUE },
- { "ExtensionsCallgrindAction", NULL, "Use Callgrind", NULL,
- "Enable/disable the Valgrind/Callgrind profiling tool.",
- G_CALLBACK (gnc_main_window_cmd_extensions_callgrind), FALSE },
};
/** The number of toggle actions provided by the main window. */
static guint n_toggle_actions = G_N_ELEMENTS (toggle_actions);
@@ -375,9 +368,6 @@
static const gchar *always_hidden_actions[] = {
"ViewSortByAction",
"ViewFilterByAction",
-#ifndef HAVE_VALGRIND_CALLGRIND_H
- "ExtensionsCallgrindAction",
-#endif
NULL
};
@@ -3079,32 +3069,6 @@
}
static void
-gnc_main_window_cmd_extensions_callgrind (GtkAction *action, GncMainWindow *window)
-{
-#ifdef HAVE_VALGRIND_CALLGRIND_H
- static GTimeVal start, end;
-
- if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action))) {
- g_print("Start timing.\n");
- g_get_current_time(&start);
- CALLGRIND_START_INSTRUMENTATION();
- CALLGRIND_TOGGLE_COLLECT();
- } else {
- CALLGRIND_TOGGLE_COLLECT();
- CALLGRIND_STOP_INSTRUMENTATION();
- g_get_current_time(&end);
- if (start.tv_usec > end.tv_usec) {
- end.tv_usec += 1000000;
- end.tv_sec -= 1;
- }
- g_print("Callgrind enabled for %d.%6d seconds.\n",
- (int)(end.tv_sec - start.tv_sec),
- (int)(end.tv_usec - start.tv_usec));
- }
-#endif
-}
-
-static void
gnc_main_window_cmd_window_new (GtkAction *action, GncMainWindow *window)
{
GncMainWindow *new_window;
Modified: gnucash/trunk/src/gnome-utils/ui/gnc-main-window-ui.xml
===================================================================
--- gnucash/trunk/src/gnome-utils/ui/gnc-main-window-ui.xml 2006-06-09 04:38:50 UTC (rev 14350)
+++ gnucash/trunk/src/gnome-utils/ui/gnc-main-window-ui.xml 2006-06-09 21:33:29 UTC (rev 14351)
@@ -107,7 +107,6 @@
</menu>
<menu name="Extensions" action="ExtensionsAction">
- <menuitem name="Callgrind" action="ExtensionsCallgrindAction"/>
<placeholder name="ExtensionsPlaceholder"/>
</menu>
More information about the gnucash-changes
mailing list