Browse code

add new mpool debug output parsing

git-svn: trunk@5047

Török Edvin authored on 2009/04/17 22:47:49
Showing 3 changed files
... ...
@@ -1,3 +1,8 @@
1
+Fri Apr 17 16:47:44 EEST 2009 (edwin)
2
+-------------------------------------
3
+ * contrib/mpoolparse/mpoolparse.pl, contrib/mpoolparse/process.pl: 
4
+ add new mpool debug output parsing
5
+
1 6
 Fri Apr 17 16:44:50 EEST 2009 (edwin)
2 7
 -------------------------------------
3 8
  * libclamav/mpool.c: update mpool frag sizes.
4 9
deleted file mode 100644
... ...
@@ -1,17 +0,0 @@
1
-#!/usr/bin/perl
2
-
3
-use strict;
4
-use warnings;
5
-
6
-my %frags = ();
7
-
8
-while (<>) {
9
-	chomp;
10
-	next unless /^LibClamAV Warning: [mc]alloc .* size (\d+) .*$/;
11
-	$frags{$1}++;
12
-}
13
-
14
-foreach (sort {$a<=>$b} (keys(%frags))) {
15
-	print "$_, /* ($frags{$_}) */\n";
16
-}
17
-
18 1
new file mode 100644
... ...
@@ -0,0 +1,23 @@
0
+#!/usr/bin/perl
1
+use strict;
2
+use warnings;
3
+
4
+my %reallocs;
5
+my %mallocs;
6
+while (<>) {
7
+    if (/realloc @ 0x([0-9a-f]+)/) {
8
+	$reallocs{$1}="";
9
+    }
10
+    if (/malloc 0x([0-9a-f]+) size ([0-9]+)/) {
11
+	$mallocs{$1}=$2;
12
+    }
13
+}
14
+my %sizes;
15
+while (my ($address, $size) = each(%mallocs)) {
16
+    if (not defined $reallocs{$address}) {
17
+	$sizes{$size}++;
18
+    }
19
+}
20
+while (my ($size, $count) = each(%sizes)) {
21
+    print "$size, /* $count */\n";
22
+}