Re: [PATCH] Add a systemtap script for watching QEMU monitor interactions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 24, 2011 at 08:27:34PM +0200, Alon Levy wrote:
> On Mon, Oct 24, 2011 at 03:37:04PM +0100, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> > 
> > This change adds some systemtap/dtrace probes to the QEMU monitor
> > client code. In particular it allows watching of all operations
> > for a VM
> > 
> > * examples/systemtap/qemu-monitor.stp: Watch all monitor commands
> > * src/Makefile.am: Passing libdir/bindir/sbindir to dtrace2systemtap.pl
> > * src/dtrace2systemtap.pl: Accept libdir/bindir/sbindir as args
> >   and look for '# binary:' comment to mark probes against libvirtd
> >   vs libvirt.so
> > * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor_json.c,
> >   src/qemu/qemu_monitor_text.c: Add probes for key functions
> > ---
> >  examples/systemtap/qemu-monitor.stp |   81 +++++++++++++++++++++++++++++++++++

> > diff --git a/src/dtrace2systemtap.pl b/src/dtrace2systemtap.pl
> > index fab066b..b577eac 100755
> > --- a/src/dtrace2systemtap.pl
> > +++ b/src/dtrace2systemtap.pl
> > @@ -31,6 +31,10 @@ my $file;
> >  my @files;
> >  my %files;
> >  
> > +my $bindir = shift @ARGV;
> > +my $sbindir = shift @ARGV;
> > +my $libdir = shift @ARGV;
> > +
> >  my $probe;
> >  my $args;
> >  
> > @@ -47,6 +51,8 @@ while (<>) {
> >  	$files{$file} = { prefix => undef, probes => [] };
> >      } elsif (m,^\s*\#\s*prefix:\s*(\S+)\s*$,) {
> >  	$files{$file}->{prefix} = $1;
> > +    } elsif (m,^\s*\#\s*binary:\s*(\S+)\s*$,) {
> > +	$files{$file}->{binary} = $1;
> >      } else {
> >  	if (m,\s*probe\s+([a-zA-Z0-9_]+)\((.*?)(\);)?$,) {
> >  	    $probe = $1;
> > @@ -66,7 +72,7 @@ while (<>) {
> >  		die "unexpected data $_ on line $.";
> >  	    }
> >  	} else {
> > -	    die "unexpected data $_ on line $.";
> > +	    #die "unexpected data $_ on line $.";
> Forgotten?

This was to skip unknown comments, but it really skips too
much. So I'm squashing in this more tailored change:

@@ -45,14 +45,18 @@ while (<>) {
     next if /^\s*provider\s+\w+\s*{\s*$/;
     next if /^\s*};\s*$/;
 
-    if (m,^\s*\#\s*file:\s*(\S+)\s*$,) {
-       $file = $1;
-       push @files, $file;
-       $files{$file} = { prefix => undef, probes => [] };
-    } elsif (m,^\s*\#\s*prefix:\s*(\S+)\s*$,) {
-       $files{$file}->{prefix} = $1;
-    } elsif (m,^\s*\#\s*binary:\s*(\S+)\s*$,) {
-       $files{$file}->{binary} = $1;
+    if (m,^\s*\#,) {
+       if (m,^\s*\#\s*file:\s*(\S+)\s*$,) {
+           $file = $1;
+           push @files, $file;
+           $files{$file} = { prefix => undef, probes => [] };
+       } elsif (m,^\s*\#\s*prefix:\s*(\S+)\s*$,) {
+           $files{$file}->{prefix} = $1;
+       } elsif (m,^\s*\#\s*binary:\s*(\S+)\s*$,) {
+           $files{$file}->{binary} = $1;
+       } else {
+           # ignore unknown comments
+       }
     } else {
        if (m,\s*probe\s+([a-zA-Z0-9_]+)\((.*?)(\);)?$,) {
            $probe = $1;
@@ -72,7 +76,7 @@ while (<>) {
                die "unexpected data $_ on line $.";
            }
        } else {
-           #die "unexpected data $_ on line $.";
+           die "unexpected data $_ on line $.";
        }
     }
 }


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]