Revert "[mono][debugger] First PR to implement iCorDebug on mono (#20757)"
[mono-project.git] / mono / mini / viewstat.pl
blob50bd05b67019e4455bf52e0efb2b2d4753cb9db1
1 #!/usr/bin/perl
3 use GD::Graph::bars;
4 use GD::Graph::bars3d;
5 use Getopt::Std;
7 $Usage = "usage: $0 [-e] [-o file] statfile";
9 # -e generate a 3D graph
10 # -o file write the graph to file, instead of starting the viewer
12 getopts('eo:', \%Opts)
13 or die "$Usage";
14 die "$Usage\n"
15 unless (@ARGV == 1);
17 $statfile = shift;
19 sub save_chart
21 my $chart = shift or die "Need a chart!";
22 my $name = shift or die "Need a name!";
23 local(*OUT);
25 open(OUT, ">$name") or
26 die "Cannot open $name.$ext for write: $!";
27 binmode OUT;
28 print OUT $chart->gd->png();
29 close OUT;
33 print STDERR "Processing file $statfile\n";
35 if ($Opts{'e'}) {
36 $graph = new GD::Graph::bars3d(800, 600);
37 } else {
38 $graph = new GD::Graph::bars(800, 600);
40 $graph->set(
41 y_label => 'Time',
42 y_long_ticks => 1,
44 x_long_ticks => 1,
46 y_tick_number => 8,
48 x_labels_vertical => 1,
49 bar_spacing => 5,
51 show_values => 1,
52 values_vertical => 1,
54 l_margin => 10,
55 b_margin => 10,
56 r_margin => 10,
57 t_margin => 10,
59 shadow_depth => 1,
61 transparent => 0,
64 if ($Opts{'e'}) {
65 $graph->set (overwrite => 1);
66 $graph->set (show_values => 0);
69 require $statfile;
71 if ($stattitle ne "") {
72 $graph->set (title=> $stattitle);
75 $outfile = $Opts{'o'};
77 if ($outfile eq "") {
78 $tmp = $outfile = "/tmp/viewstat" . $$ . ".png";
81 $graph->plot(\@data);
82 save_chart($graph, $outfile);
84 if ($tmp) {
85 `eog $outfile`;
86 `rm $tmp`;