summaryrefslogtreecommitdiffstats
path: root/tdecachegrind/converters/memprof2calltree
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-01-30 20:20:24 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-01-30 20:20:24 -0600
commitcfccedd9c8db3af36d7c5635ca212fa170bb6ff5 (patch)
treec80df038c9b6e40b4e28c26203de0dd9b1cd1593 /tdecachegrind/converters/memprof2calltree
parent2020f146a7175288d0aaf15cd91b95e545bbb915 (diff)
downloadtdesdk-cfccedd9c8db3af36d7c5635ca212fa170bb6ff5.tar.gz
tdesdk-cfccedd9c8db3af36d7c5635ca212fa170bb6ff5.zip
Part 2 of prior commit
Diffstat (limited to 'tdecachegrind/converters/memprof2calltree')
-rwxr-xr-xtdecachegrind/converters/memprof2calltree38
1 files changed, 38 insertions, 0 deletions
diff --git a/tdecachegrind/converters/memprof2calltree b/tdecachegrind/converters/memprof2calltree
new file mode 100755
index 00000000..e82d6e85
--- /dev/null
+++ b/tdecachegrind/converters/memprof2calltree
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+#
+# Convert the memory profiles of memprof to calltree format,
+# loadable with KCachegrind
+#
+# (C) 2004, Josef Weidendorfer
+
+print "events: Allocated\n";
+
+while(<>) {
+ if (/^(\S.*)$/) {
+ $next = 0;
+ print "\nfn=$1\n";
+ next;
+ }
+ if (/^ children:/) {
+ $next = 1; #children
+ next;
+ }
+ if (/^ inherited:/) {
+ $next = 2; #inherited
+ next;
+ }
+ if (/^ total:/) {
+ # ignore, is calculated
+ next;
+ }
+ if (/^ self:\s*(\d+)/) {
+ if ($1 ne "0") {
+ print "0 $1\n";
+ }
+ next;
+ }
+ if (/^\s+(\S.*?):\s*(\d+)$/) {
+ if ($next < 2) { next; }
+ print "cfn=$1\ncalls=0 0\n0 $2\n";
+ }
+}