Skip to content

Commit 6f128d2

Browse files
committed
Move valgrind and callgrind information to our wiki
1 parent e8e179f commit 6f128d2

File tree

1 file changed

+4
-66
lines changed

1 file changed

+4
-66
lines changed

HACKING

+4-66
Original file line numberDiff line numberDiff line change
@@ -81,72 +81,10 @@ crashes. I haven't investigated whether this is because I should first have
8181
linked gnucash with -lefence or because a real problem in GnuCash code.
8282

8383

84-
Using Valgrind with GnuCash
85-
---------------------------
86-
-- run ${prefix}/bin/gnucash-valgrind
87-
88-
However, I did not find valgrind to be useful. It reported a bunch of
89-
guile bugs, some g_hash_table bugs, and then the program exited prematurely
90-
for no apparent reason. :-(
91-
92-
For the moment, gnucash-valgrind uses the suppressions in
93-
src/debug/valgrind/valgrind-*.supp
94-
95-
For valgrind-gnucash.supp, this comment was made (but is perhaps outdated
96-
by now ?):
97-
This file needs to be cleaned up in two ways:
98-
99-
1/ There are a bunch of duplicate suppressions in the file.
100-
* The suppressions in place were auto-generated by valgrind itself
101-
[--gen-suppressions=yes], and it makes no effort to output the
102-
suppression only once.
103-
104-
2/ There are a bunch of suppressions which need to not be suppressions, but
105-
instead just not be generated by valgrind.
106-
107-
Using Callgrind with GnuCash
108-
----------------------------
109-
In order to debug with callgrind, you need to add a couple of code
110-
fragments around the section of code you are profiling. This is
111-
easiest if you can find the function that invokes the routine(s) you
112-
want to profile, add the following code around the function call of
113-
interest.
114-
115-
Add the following to the start of the file:
116-
117-
#include <valgrind/callgrind.h>
118-
119-
Add the following to the start of the calling function:
120-
121-
static GTimeVal start, end;
122-
123-
Add the following just before the function of interest:
124-
125-
g_print("Start timing.\n");
126-
g_get_current_time(&start);
127-
CALLGRIND_START_INSTRUMENTATION();
128-
CALLGRIND_TOGGLE_COLLECT();
129-
130-
Add the following just after the function of interest:
131-
132-
CALLGRIND_TOGGLE_COLLECT();
133-
CALLGRIND_STOP_INSTRUMENTATION();
134-
g_get_current_time(&end);
135-
if (start.tv_usec > end.tv_usec) {
136-
end.tv_usec += 1000000;
137-
end.tv_sec -= 1;
138-
}
139-
g_print("Callgrind enabled for %d.%6d seconds.\n",
140-
(int)(end.tv_sec - start.tv_sec),
141-
(int)(end.tv_usec - start.tv_usec));
142-
143-
You will need to recompile, and then run the 'gnucash-valgrind'
144-
wrapper script instead of the normal 'gnucash' script.
145-
146-
NOTE: Version 3.2 of valgrind has changed the above macros to no
147-
longer take an argument. In order to compile with this version of
148-
valgrind you will need to remove the trailing parentheses and
149-
semicolon.
84+
Using Valgrind/Callgrind with GnuCash
85+
-------------------------------------
86+
This section has been moved to
87+
https://wiki.gnucash.org/wiki/Coder_Tools
15088

15189

15290
Look up exported and imported symbols

0 commit comments

Comments
 (0)