Googles appar
Huvudmeny

Post a Comment On: cbloom rants

"01-28-09 - Graph Memory"

17 Comments -

1 – 17 of 17
Blogger Dave Moore said...

If you're unlucky enough to have installed the Adobe SVG plugin for IE, then Firefox won't even load it from your local machine unless you delete the SVG file association. Even if you point it at Firefox. Awesome.

January 29, 2009 at 1:04 AM

Blogger Sylvain V said...

Graphviz is quite cool indeed. Mainly because the source text of the graphs can be generated.

I've a script that gets the #include from code to generate a nice graph of who includes what. Nice to see if one cpp includes a few headers or a whole forest of crap.

January 29, 2009 at 4:57 AM

Blogger won3d said...

My usual obligatory comment: tcmalloc does something similar for heap and cpu profiling, and I agree it is very useful.

http://code.google.com/p/google-perftools/wiki/GooglePerformanceTools

Your MIME type is oddly set to text/html, despite the clear extention and doctype header (although I'm not sure that servers actually look at the latter), so browsers that respect that dutifully render it as quirks html.

January 29, 2009 at 8:21 AM

Blogger cbloom said...

I tried to check out tcmalloc for comparison but it doesn't even build in VC7.1 (aka 2003). I sent them an email but I'm sure they don't care.

Also the cool performance tracking stuff only works in Linux.

January 29, 2009 at 9:21 AM

Blogger cbloom said...

Hmm yay now I'm trying to fix my Apache configuration. I think I accidentally deleted my entire "etc" directory at one point so cbloom.com is all screwy.

January 29, 2009 at 9:48 AM

Blogger cbloom said...

BTW while the graph thing is kind of neat, it becomes useless really fast for large complex programs.

To really work you would need an SVG tree view.

Like start with a graph at file granularity. Each file box is clickable and it expands just that part of the graph to function granularity. Then each function is clickable and it blows up to line granularity.

That would rock but requires a semi-realtime graphing engine, graphviz is too slow to run like a dhtml thing where you have it make new graphs each time you click. (plus it's not stable so doing that would make the graph change wildly)

I did see that SVG has some mouse interaction capability, so you could at least add some more info to the nodes and give them some kind of mouse-over popup box or something.

January 29, 2009 at 9:52 AM

Blogger cbloom said...

Sly - you should share that include grapher, that sounds pretty cool.

January 29, 2009 at 11:10 AM

Blogger Sylvain V said...

cbloom said...
> Sly - you should share that
> include grapher, that sounds
> pretty cool.

Already did actually. It's a bit hacky ; I quickly developed it only to work on some of my projects, not as a publishable tool. But I guess others could give it a try. It's a Unix/Cygwin script:
http://tfpsly.free.fr/Files/GenerateDepGraph.sh

January 29, 2009 at 1:39 PM

Blogger Thatcher Ulrich said...

The google perftools mem grapher output looks almost exactly like yours, except that boxes are sized according to total bytes. We use it on giant programs without an interactive mode and it seems to be fine. The other thing it has is a diff mode, so you can find leaks.

January 30, 2009 at 5:13 AM

Blogger won3d said...

One way to cope with large programs is to be able to "focus" on different stack traces. Perftools lets you specify a regex that filters the stacks it includes in the analysis. Really, it would be awesome if it could be done totally interactively. Stable layout would make things work pretty well.

January 30, 2009 at 8:37 AM

Blogger cbloom said...

What does Perftools use for the actual graphing?

I tried making the boxes sized by bytes but it just made graphviz do a really bad job of the layout.

January 30, 2009 at 9:49 AM

Blogger cbloom said...

Hmm.. looks like it's in the PProf perl and they use DOT.

It seems they don't actually size the nodes, rather they size the font on each node proportional to the alloc and then let DOT make the node size fit the font.

Dear god reading perl is painful.

January 30, 2009 at 10:22 AM

Blogger Sylvain V said...

To change the size of node, you can use the width and height parameters:
H_5 [height=3];
0 being the default size, 1 the double, and so on...

Ref:
http://www.graphviz.org/doc/info/attrs.html

January 30, 2009 at 10:58 AM

Blogger cbloom said...

Sly, yes, though width & height actually set the size in "inches". Also you need to use fixedsize=true.

January 30, 2009 at 12:56 PM

Blogger cbloom said...

Urg. Okay I found a major thing :

The font size output from graph_viz is broken / not supported by FF3. See :

http://groups.google.com/group/mozilla.dev.tech.svg/browse_thread/thread/1d574c2690e37c7b

http://groups.google.com/group/mozilla.dev.tech.svg/browse_thread/thread/1d574c2690e37c7b

I've hacked a fix to this and my graphs look way better now.

January 30, 2009 at 1:49 PM

Blogger cbloom said...

The other thing I found from reading the pprof perl was a cool thing the Google guys are doing :

They set the graph optimization edge weight by the size of the allocation. That way the "fat pipes" of big allocation get nice short straight edges, and the smaller allocs get thrown out to the borders and get long wavey edges.

January 30, 2009 at 1:51 PM

Blogger Sylvain V said...

> height actually set the size in "inches"

Inches? How the fuck could I guess that? ;) RTFM I guess...

January 30, 2009 at 2:16 PM

You can use some HTML tags, such as <b>, <i>, <a>

This blog does not allow anonymous comments.

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.