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