mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14351 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
bf56d48411
commit
c56162d6f2
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
2006-06-09 David Hampton <hampton@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@employees.org>
|
2006-06-07 David Hampton <hampton@employees.org>
|
||||||
|
|
||||||
* src/business/business-gnome/business-gnome.scm: Restore the
|
* src/business/business-gnome/business-gnome.scm: Restore the
|
||||||
|
@ -985,10 +985,6 @@ AC_SUBST(enable_latex_docs)
|
|||||||
BB_ENABLE_DOXYGEN
|
BB_ENABLE_DOXYGEN
|
||||||
|
|
||||||
|
|
||||||
# check for callgrind
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
AC_CHECK_HEADERS(valgrind/callgrind.h)
|
|
||||||
|
|
||||||
### --------------------------------------------------------------------------
|
### --------------------------------------------------------------------------
|
||||||
### Libraries
|
### Libraries
|
||||||
LIBS="$LIBS -lm"
|
LIBS="$LIBS -lm"
|
||||||
|
@ -26,6 +26,7 @@ EXTRA_DIST = \
|
|||||||
netlogin.txt \
|
netlogin.txt \
|
||||||
guid.txt \
|
guid.txt \
|
||||||
qif.txt \
|
qif.txt \
|
||||||
|
valgrind.txt \
|
||||||
generic-druid-framework.txt \
|
generic-druid-framework.txt \
|
||||||
user-prefs-howto.txt
|
user-prefs-howto.txt
|
||||||
|
|
||||||
|
41
src/doc/valgrind.txt
Normal file
41
src/doc/valgrind.txt
Normal file
@ -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.
|
@ -41,9 +41,6 @@
|
|||||||
#include "gkeyfile.h"
|
#include "gkeyfile.h"
|
||||||
#endif
|
#endif
|
||||||
#include "gtk-compat.h"
|
#include "gtk-compat.h"
|
||||||
#ifdef HAVE_VALGRIND_CALLGRIND_H
|
|
||||||
#include <valgrind/callgrind.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "gnc-plugin.h"
|
#include "gnc-plugin.h"
|
||||||
#include "gnc-plugin-manager.h"
|
#include "gnc-plugin-manager.h"
|
||||||
@ -127,7 +124,6 @@ static void gnc_main_window_cmd_view_refresh (GtkAction *action, GncMainWindow *
|
|||||||
static void gnc_main_window_cmd_view_toolbar (GtkAction *action, GncMainWindow *window);
|
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_summary (GtkAction *action, GncMainWindow *window);
|
||||||
static void gnc_main_window_cmd_view_statusbar (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_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_actions_rename_page (GtkAction *action, GncMainWindow *window);
|
||||||
static void gnc_main_window_cmd_window_new (GtkAction *action, GncMainWindow *window);
|
static void gnc_main_window_cmd_window_new (GtkAction *action, GncMainWindow *window);
|
||||||
@ -314,9 +310,6 @@ static GtkToggleActionEntry toggle_actions [] =
|
|||||||
{ "ViewStatusbarAction", NULL, N_("Stat_us Bar"), NULL,
|
{ "ViewStatusbarAction", NULL, N_("Stat_us Bar"), NULL,
|
||||||
N_("Show/hide the status bar on this window"),
|
N_("Show/hide the status bar on this window"),
|
||||||
G_CALLBACK (gnc_main_window_cmd_view_statusbar), TRUE },
|
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. */
|
/** The number of toggle actions provided by the main window. */
|
||||||
static guint n_toggle_actions = G_N_ELEMENTS (toggle_actions);
|
static guint n_toggle_actions = G_N_ELEMENTS (toggle_actions);
|
||||||
@ -375,9 +368,6 @@ static const gchar *initially_insensitive_actions[] = {
|
|||||||
static const gchar *always_hidden_actions[] = {
|
static const gchar *always_hidden_actions[] = {
|
||||||
"ViewSortByAction",
|
"ViewSortByAction",
|
||||||
"ViewFilterByAction",
|
"ViewFilterByAction",
|
||||||
#ifndef HAVE_VALGRIND_CALLGRIND_H
|
|
||||||
"ExtensionsCallgrindAction",
|
|
||||||
#endif
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3078,32 +3068,6 @@ gnc_main_window_cmd_view_statusbar (GtkAction *action, GncMainWindow *window)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
static void
|
||||||
gnc_main_window_cmd_window_new (GtkAction *action, GncMainWindow *window)
|
gnc_main_window_cmd_window_new (GtkAction *action, GncMainWindow *window)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +107,6 @@
|
|||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
<menu name="Extensions" action="ExtensionsAction">
|
<menu name="Extensions" action="ExtensionsAction">
|
||||||
<menuitem name="Callgrind" action="ExtensionsCallgrindAction"/>
|
|
||||||
<placeholder name="ExtensionsPlaceholder"/>
|
<placeholder name="ExtensionsPlaceholder"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user