90101709c5a1f05fbd805ef4cad3492354acd596
[public/netxms.git] / tools / analyze_threads.pl
1 #!/usr/bin/perl
2
3 @skipnames = ("Queue::getOrBlock", "ConditionWait", "poll", "select", "accept");
4
5 my %skiplist;
6 @skiplist{@skipnames} = ();
7
8 @data = ();
9 $ignore = 1;
10
11 while(<STDIN>)
12 {
13 chomp;
14 $line = $_;
15
16 if ($line =~ /^(Thread .*)/)
17 {
18 if ($ignore == 0)
19 {
20 for($i = 0; $i < $index; $i++)
21 {
22 print $data[$i] . "\n";
23 }
24 }
25 $ignore = 0;
26 @data = ();
27 $index = 0;
28 $func = "";
29 }
30 elsif ($line =~ /^#[0-9]+\s+[0-9a-fx]+\s+in\s+([^ ]+)\s.*/)
31 {
32 $func = $1;
33 }
34 elsif ($line =~ /^#[0-9]+\s+([^ ]+)\s.*/)
35 {
36 $func = $1;
37 }
38 $data[$index++] = $line;
39 if (exists $skiplist{$func})
40 {
41 $ignore = 1;
42 }
43 }