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.


HVM capability enhancement: asynchronous upcalls to ROS userspace
[palacios.git] / linux_usr / v3_info
1 #!/usr/bin/perl -w
2
3 use Getopt::Long;
4
5 $debug=0;
6 $error=0;
7 $telemetry=0;
8 $skipunnamed=0;
9 $skipgeneral=0;
10 $targetvcore=-1;
11 $format=0;
12 $any=0;
13 $stream=0;
14
15 &GetOptions("skipunnamed"=>\$skipunnamed,
16             "skipgeneral"=>\$skipgeneral,
17             "debug"=>\$debug,
18             "error"=>\$error,
19             "telemetry"=>\$telemetry,
20             "format"=>\$format,
21             "stream"=>\$stream,
22             "vcore=i"=>\$targetvcore);
23
24
25 $#ARGV==0 or die "v3_info [--skipunnamed] [--skipgeneral] [--debug] [--error]\n".
26                  "        [--telemetry] [--vcore=num] [--format] [--stream] vmname|_\n\n".
27   "Filter palacios output in dmesg\n".
28   "given a vmname, the default is to show the general output\n".
29   "for that vm, plus any general output from palacios.\n".
30   "the vm name \"_\" means VMs of any name.\n\n".
31   "  --skipunnamed : do not show non-VM specific output\n".
32   "  --skipgeneral : do not show general output (V3_Print)\n".
33   "  --debug       : show debug output (PrintDebug)\n".
34   "  --error       : show error output (PrintError)\n".
35   "  --telemetry   : show telemetry output\n".
36   "  --vcore=num   : show only output for specified vcore\n".
37   "  --stream      : attempt to stream from /proc/kmsg\n".
38   "  --format      : reformat output into a convenient form\n\n";
39
40   
41   
42
43 $vmname = shift;
44 if ($vmname eq "_") { 
45   $any=1;
46 } else {
47   $any=0;
48 }
49
50 if ($stream) {
51   open(DMESG, "cat /proc/kmsg |");
52 } else {
53   open(DMESG,"dmesg |");
54 }
55
56 while ($line = <DMESG>) {
57   $origline=$line;
58   $timestamp=-1;
59   $pcore=-1;
60   $vm="NONE";
61   $vcore=-1;
62
63   if ($line =~ /^\[(.*)\]\s+(.*)$/) { 
64     $timestamp = $1;
65     $line = $2;
66   }
67       
68   
69   if ($line =~/^palacios\s+\(pcore\s+(\d+)\)\:\s+(.*)/) { 
70     # Unnamed output
71     next if $skipunnamed;
72     next if ($targetvcore!=-1);
73     $pcore=$1;
74     $line=$2;
75   } elsif ($line =~/^palacios\s+\(pcore\s+(\d+)\s+vm\s+(\S+)\s+vcore\s+(\d+)\):\s+(.*)$/) {
76     # core-specific output
77     $pcore=$1;
78     $vm=$2;
79     $vcore=$3;
80     $line=$4;
81     next if (!$any && !($vm eq $vmname));
82     next if ($targetvcore!=-1 && $vcore!=$targetvcore);
83   } elsif ($line =~ /^palacios\s+\(pcore\s+(\d+)\s+vm\s+(\S+)\):\s+(.*)$/) { 
84     $pcore=$1;
85     $vm=$2;
86     $line=$3;
87     next if (!$any & !($vm eq $vmname));
88     next if ($targetvcore!=-1);
89   } else {
90     next;
91   }
92    
93   if ($line =~ /^DEBUG:\s+.*$/) {
94     next if !$debug;
95   } elsif ($line =~ /^ERROR:\s+.*$/) { 
96     next if !$error;
97   } elsif ($line =~ /^telem\.\d+\>.*$/) {
98     next if !$telemetry;
99   } else {
100     next if $skipgeneral;
101   }
102
103   if ($format) { 
104     if ($timestamp!=-1) { 
105       print "$timestamp\t";
106     }
107     print "$pcore\t";
108     print "$vm\t";
109     if ($vcore==-1) { 
110       print "NONE\t";
111     } else {
112       print "$vcore\t";
113     }
114     print $line,"\n";
115   } else {
116     print $origline;
117   }
118 }
119
120 close(DMESG);