Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Avoid strict-aliasing related issues when compiling with optimization
[palacios.git] / linux_usr / v3_guest_mem_track_viz.pl
1 #!/usr/bin/perl -w
2
3 use IO::Handle;
4 use Getopt::Long;
5 use Time::HiRes qw /usleep/;
6
7 $period=0;
8 $numtimes=1;
9
10 &GetOptions("period=i"=>\$period, "numtimes=i"=>\$numtimes);
11
12 $#ARGV==0 or die "v3_guest_mem_track_viz.pl [--numtimes=num(-1=forever)] [--period=milliseconds] /dev/v3-vmN\n";
13
14 $vm=shift;
15
16 open(G,"|gnuplot") or die "Cannot open gnuplot\n";
17 G->autoflush(1);
18 STDIN->autoflush(1);
19
20 while ($numtimes--) { 
21
22   $data = `v3_guest_mem_track $vm snapshot text _`;
23   
24   $data=~/Cores:\s*(\d+)/ or die "Cannot parse for cores\n";
25   $numcores=$1;
26   
27   $data=~/Pages:\s*(\d+)/ or die "Cannot parse for pages\n";
28   $numpages=$1;
29   
30   #print $numpages;
31
32   for ($core=0;$core<$numcores;$core++) {
33     $data=~/Core\s+$core\s+\(.*\)\s+\:\s+(\S+)/ or die "Cannot parse core $core\n";
34     $bits[$core]=$1;
35   }
36   
37   $side=int(sqrt($numpages));
38     
39   $x=$side;
40   $y=int($numpages/$side);
41
42   print G "set xrange [0:$x]\n";
43   print G "set yrange [0:$y]\n";  
44   
45   print G "plot ", join(",", map {"'-' using 1:2 with points title 'core $_' "} (0..$numcores-1) ),"\n";
46   for ($core=0;$core<$numcores;$core++) {
47     for ($i=0;$i<$numpages;$i++) {
48       #  print substr($bits,$i,1);
49       if (substr($bits[$core],$i,1) eq "X") { 
50         print G join("\t", int($i/$side), $i % $side), "\n";
51       }
52     }
53     print G "e\n";
54   }
55  
56   if ($period) {  
57     usleep($period*1000);
58   }
59 }
60
61 print "Hit enter to finish\n";
62 <STDIN>;