KCachegrind: Valgrind Unleashed

Valgrind, a GPL'd tool to debug applications' memory allocation, is one of the most exciting profiling tools in the free software world. Think Purify, but free, easier and available for Linux. Now Josef Weidendorfer makes Valgrind even more attractive with the first unofficial release of KCachegrind, a KDE front-end for Valgrind's profiling tool. (Click for screenshots of basic use and a call tree graph.) Now all x86 Linux developers can benefit from a professional grade profiling tool!


Seems very promising, but it gives compile errors:

g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/kde3/include -I/usr/lib/qt3/include -I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -O2 -fno-exceptions -fno-check-new -c -o toplevel.o `test -f toplevel.cpp || echo './'`toplevel.cpp
toplevel.cpp: In method `void TopLevel::createActions()':
toplevel.cpp:229: parse error before `('

Also, the patch to valgrind 1.0.1 fails:

patch: **** malformed patch at line 1802: @@ -729,9 +1696,7 @@ UCodeBlock* VG_(cachesim_instrument)(UCo

I haven't looked into the problems yet, but I will. This is really an application I was looking for a long time.

By Erik Hensema at Tue, 2002/09/03 - 5:00am

Valgrind has already been packaged in Debian and Gentoo. Debian has
even 1.0.1 in unstable. I don't know about other distros.

By EK at Wed, 2002/09/04 - 5:00am

Mandrake has it too.

By GF at Thu, 2002/09/05 - 5:00am

Hmm, what does this have to do with anything? That's great that those distros have Valgrind packaged, but I see an alterior motive in your post OTHER than just trying to be a friendly user :) The reason this isn't relavent is because Valgrind 1.0.1 in ANY distro needs some patches for some enhanced profiling. Oh, don't let me forget:

/me hands you a cookie for using Gentoo and Debian.

Nick Betcher

Quote of the day:
"I'd like to get a refill for my meds." - patient
"I'm sorry sir, you're out of refills, we'll have to call your doctor." - pharmacy technician
"What are refills?" - SAME patient

By Nick Betcher at Thu, 2002/09/05 - 5:00am

The class KWidgetAction(...) is needed. But this class is new in KDE 3.1CVS without KDE 3.1 (if you have 3.0) you can only compile it if you just comment the line out in which KWidgetAction appears. (does not matter that much .. "just" the filter will disappear than)

Compiling with gcc 3.x gives a few errors, too. You have to remove the "=0" in the *.cpp files which the error-message tells you

there should be probably a fix soon (as much as I was told)

By Jens Henrik at Wed, 2002/09/04 - 5:00am

cool cool cool. Damn, this is cool. Can't wait to run this app.


By Chris Parker at Wed, 2002/09/04 - 5:00am

no doubt.. i've got the tarball sitting on my HD just waiting for me to have the time to play with it, but every time i look at the screenshots and read what it can do i get goose bumps.

a Free software profiler that takes into consideration things like cache misses, doesn't include the overhead of profiling in the profiling, has a wonderfully rich UI ..... damn!

*grind is one of the most exciting sets of open source projects going on this year IMO.

By Aaron J. Seigo at Wed, 2002/09/04 - 5:00am

Great tool!
This needs to be added to so that more people will find and use it.

By Nick at Wed, 2002/09/04 - 5:00am

This would be a pretty nice thing to integrate into KDevelop at some point in time. Would make it an even more fully featured application development center.

Now, if I only could get Emacs as the editor in KDevelop. :)

By chakie at Wed, 2002/09/04 - 5:00am

>Now, if I only could get Emacs as the editor in KDevelop. :)

Yes, that would be nice!
But a KEmacs would be even better i think.

By [Bad-Knees] at Wed, 2002/09/04 - 5:00am

Yes, it would be great :)
Maybe some day, it's kind of fun (and maybe a little sad...) to read this now:

"Gaël: Will there be a KEmacs?
Matthias: XEmacs is the editor of choice for many of the KDE developers. In converse, some XEmacs-developers also mentioned interest in a tighter KDE integration. So the future regarding KEmacs looks pretty bright."

September 1998 :)


By Jorge Adriano at Wed, 2002/09/04 - 5:00am

I remember someone mentioned an XEmacs KPart for KDevelop on the kdevelop ML
a while back, dunno how well it works.


By Richard Moore at Wed, 2002/09/04 - 5:00am

Hi people,

I think I'm forced to upload a more stable/compilable
version now :-) I never thought someone would mention it

I keep you up to date,

By Josef Weidendorfer at Wed, 2002/09/04 - 5:00am

great tool , gratulations !

i hope more coders will use it and make kde
really fast.

another thing i am looking forward to , is
the caching of whole apps on invisible desktops,
as mentioned on kde-core-devel

By chris at Wed, 2002/09/04 - 5:00am

to get the patch to apply, search for the ",53" above line 1802, and then replace it with ,52.

By George Staikos at Wed, 2002/09/04 - 5:00am


I just uploaded new versions KCachegrind 0.1b and
valgrind-1.0.1 patch 0.1b.

Look at the News section of the webpage for changes.
And please give it a try.

I should have all known bugs fixed :-)

Happy profiling,

By Josef Weidendorfer at Thu, 2002/09/05 - 5:00am

Problem is that only Valgrind 1.0.2 is available now which your patch won't apply to :)

By Perra at Fri, 2002/09/06 - 5:00am

Yeah, the patch for 1.0.1 fails on 1.0.2...
But one would hope for a synch between valgrinds cachegrind
and kcachegrind so that the patch will not be necessary.

By dnm at Fri, 2002/09/06 - 5:00am

Wrong. Only the 1.0.2 =link= is available now. But the 1.0.1 archive is still

By Melchior FRANZ at Fri, 2002/09/06 - 5:00am

Uhm, I downloaded the 1.0.2, it IS (or was) there, I tried to apply the patch
for 1.0.1 in the 1.0.2 directory and it fails. The patch does apply to
the 1.0.1 directory without complaining.

cut from rpm-build -----------------------------------------------------
-rw-r--r-- 501/501 105 2002-06-05 22:28:33 valgrind-1.0.2/tests/nanoleak.c
-rw-r--r-- 501/501 491 2002-06-19 12:17:40 valgrind-1.0.2/tests/pth_pause.c
-rw-r--r-- 501/501 996 2002-06-20 10:17:07 valgrind-1.0.2/tests/pth_sigpending.c
-rw-r--r-- 501/501 2311 2002-08-25 22:02:25 valgrind-1.0.2/tests/pth_atfork1.c
+ '[' 0 -ne 0 ']'
+ cd valgrind-1.0.2
++ /usr/bin/id -u
+ '[' 505 = 0 ']'
++ /usr/bin/id -u
+ '[' 505 = 0 ']'
+ /bin/chmod -Rf a+rX,g-w,o-w .
+ echo 'Patch #0 (patch-0.1c-valgrind-1.0.1):'
Patch #0 (patch-0.1c-valgrind-1.0.1):
+ patch -p1 -s
1 out of 1 hunk FAILED -- saving rejects to file
14 out of 35 hunks FAILED -- saving rejects to file vg_cachesim.c.rej
3 out of 6 hunks FAILED -- saving rejects to file vg_include.h.rej
1 out of 5 hunks FAILED -- saving rejects to file vg_main.c.rej
2 out of 14 hunks FAILED -- saving rejects to file vg_symtab2.c.rej
2 out of 2 hunks FAILED -- saving rejects to file vg_syscall_mem.c.rej
error: Bad exit status from /var/tmp/rpm-tmp.71239 (%prep)

By dnm at Fri, 2002/09/06 - 5:00am

What are you trying to say?! That the 1.0.1-patch doesn't apply to the 1.0.2 binary? Surprise! As I mentioned above, you can still download the 1.0.1 binary, too which the 1.0.1 applies quite well (surprise again!).

By Melchior FRANZ at Sun, 2002/09/08 - 5:00am

Well, the first thing I wanted to say is that 1.0.2 actually was there,
which your post seemed to imply that it was not.

I am not surprised... I am just stating facts, it's just that
*cachegrind* 1.0.1 is not working too well (which is why
Julian Seward released 1.0.2).
Also just so you know; patches can apply to newer versions,
it just depends on how the new version was changed...
much like a cvs merge can work without manual intervention,
a patch can work on a later version depending on what was modified
in the new version. Yes, it is not as "safe" as a tested patch
against a certain version but if you are not depending on it in a
production environment, and what you got does not work, why not try it?
And after I tried it I might tell others who are like of mind
so that they would know it would not work right of the bat...
Then you can decide if you want to do the patch manually in
the new code or just wait for someone to release a new patch...
For me cachegrind 1.0.1 gets an assert almost all of the time
but not with 1.0.2 (yes, unpatched).

By dnm at Tue, 2002/09/10 - 5:00am

> Well, the first thing I wanted to say is that 1.0.2 actually
> was there, which your post seemed to imply that it was not.

Oh well. My posting was the answer to Perra, who said "Problem is that
only Valgrind 1.0.2 is available now which your patch won't apply to."
I said that the link to 1.0.1 may have been removed, but the binary was
still there and posted the link. So there would be no problem to get
a working, patched cachegrind with a matching kcachegrind, even though
it wasn't the very last version. Then you =repeated= that the 1.0.1 patch
wouldn't apply to 1.0.2, which was already stated before and not really
surprising. Yes, my answer was a bit harsh, sorry. But it was easily
topped by two replies, presumably by the same child using different names
and with really bad manners. He should wash his mouth with soap. ;-)

By Melchior FRANZ at Tue, 2002/09/10 - 5:00am

... but meanwhile there's a 1.0.2 patch anyway. Thank you, Josef! :-)

By Melchior FRANZ at Tue, 2002/09/10 - 5:00am

Ok, trying to clarify (never been that good doing that lol)
When I read your statement "Only the 1.0.2 =link= is available now"
I thought that you had tried to access the 1.0.2 version during a transition,
ie the link to the 1.0.1 file was removed but the tar file was/is still there
and a new link had been added to the 1.0.2 tar file but the tar file it pointed
to was not uploaded yet (or temporarily removed).
So when I posted again the information I thought I provided was that
you can download it now + which files the patch failed for.
Also 1.0.1 cachegrind has never really worked for me.

I will go try the new patch now though!

By dnm at Wed, 2002/09/11 - 5:00am

Aaaaand.... as an example of patching sometimes working for closely related versions:
the patches V 0.2a and 0.1e both for valgrind 1.0.2,
should be used for 1.0.3.
quote from kcachegrind site:
"Update: Both Valgrind patches work for 1.0.3, too (There is one reject because of the wrong version number, which can be safely ignored)."

(Yes, I have tested this and it works)

By dnm at Tue, 2002/09/24 - 5:00am

you're not too bright aren't you?

By bloemist at Sun, 2002/09/08 - 5:00am

Whats going on with ?

By lescrh at Sun, 2002/09/08 - 5:00am

He got flamed down by Slashdot.

By Stof at Mon, 2002/09/09 - 5:00am

and flamed b mos of he kde communi

9sorr m shif, , and keboard kes are no working.

By dc at Mon, 2002/09/09 - 5:00am