Skip to content
Newer
Older
100755 71 lines (63 sloc) 2.42 KB
c635547 @ricardog -- Import the contents of the sf repository into github. I am purposely
ricardog authored
1 #!/usr/bin/perl
2
bd76909 @ricardog -- Updated copyrights in files that had copyrights. I did not go on a
ricardog authored
3 # Copyright 2007-2011, VMware, Inc. All rights reserved.
c635547 @ricardog -- Import the contents of the sf repository into github. I am purposely
ricardog authored
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are met:
7 # 1. Redistributions of source code must retain the above copyright notice,
8 # this list of conditions and the following disclaimer.
9 # 2. Redistributions in binary form must reproduce the above copyright
10 # notice, this list of conditions and the following disclaimer in the
11 # documentation and/or other materials provided with the distribution.
12 # 3. Neither the name of VMware, Inc. nor the names of its contributors may
13 # be used to endorse or promote products derived from this software with
14 # specific prior written permission.
15 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS AS IS'' AND ANY
16 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
19 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
25 # DAMAGE.
26
27 #
28 # Usage:
29 # enable (vprobe VMM10Hz (logstr (gueststack)) (logstr "\n"))
30 # resolve symbols: stacks_resolve.pl symtab.txt < vprobe.out > vprobe1.out
31 # stacks2dot.pl < vprobe1.out > vprobe.dt
32 # dot -Tps -o vprobe.ps vprobe.dt
33 #
34
35 sub get_node {
36 my ($name);
37 ($name) = @_;
38
39 if (!defined($nodes{$name})) {
40 $nodes{$name} = $numNodes;
41 $numNodes++;
42 }
43 return $nodes{$name};
44 }
45
46 print "digraph stacks { size=\"7,10\"\n";
47 $numNodes = 0;
48 while (($ln = <STDIN>)) {
49 chomp($ln);
50
51 if ($ln =~ /GUEST,.*/ || $ln =~ /VMM,.*/) {
52 @calls = split(',', $ln);
53 for ($i = 1; $i < $#calls; $i++) {
54 $first = get_node($calls[$i]);
55 $second = get_node($calls[$i+1]);
56 $edge = sprintf("n%d -> n%d", $second, $first);
57 $edges{$edge}++;
58 }
59 }
60 }
61
62 # print the nodes
63 foreach $key (keys %nodes) {
64 printf("n%d [label=\"%s\"];\n", $nodes{$key}, $key);
65 }
66 # print the edges
67 foreach $key (keys %edges) {
68 print $key . ";\n";
69 }
70 print "}\n";
Something went wrong with that request. Please try again.