]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Make perf accept event list separated by commas
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 30 Mar 2016 15:56:02 +0000 (17:56 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 31 Mar 2016 08:22:14 +0000 (10:22 +0200)
Everywhere else we use a comma separated list. There's no good
reason to make 'perf' command an exception. Currently, it accepts
string list separated by '|'.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
tools/virsh-domain.c
tools/virsh.pod

index a09cdece224a4f8943394a5822bbb7f4038b033b..f3aa1bb592ef6a611bb22e453185732ac405e5b0 100644 (file)
@@ -8564,8 +8564,7 @@ static const vshCmdOptDef opts_perf[] = {
 };
 
 static int
-virshParseEventStr(vshControl *ctl,
-                   const char *event,
+virshParseEventStr(const char *event,
                    bool state,
                    virTypedParameterPtr *params,
                    int *nparams,
@@ -8575,14 +8574,9 @@ virshParseEventStr(vshControl *ctl,
     size_t i, ntok;
     int ret = -1;
 
-    if (!(tok = virStringSplitCount(event, "|", 0, &ntok)))
+    if (!(tok = virStringSplitCount(event, ",", 0, &ntok)))
         return -1;
 
-    if (ntok > VIR_PERF_EVENT_LAST) {
-        vshError(ctl, _("event string '%s' has too many fields"), event);
-        goto cleanup;
-    }
-
     for (i = 0; i < ntok; i++) {
         if ((*tok[i] != '\0') &&
             virTypedParamsAddBoolean(params, nparams,
@@ -8615,12 +8609,12 @@ cmdPerf(vshControl *ctl, const vshCmd *cmd)
         vshCommandOptStringReq(ctl, cmd, "disable", &disable) < 0)
         return false;
 
-    if (enable && virshParseEventStr(ctl, enable, true,
-                                     &params, &nparams, &maxparams) < 0)
+    if (enable && virshParseEventStr(enable, true, &params,
+                                     &nparams, &maxparams) < 0)
         goto cleanup;
 
-    if (disable && virshParseEventStr(ctl, disable, false,
-                                      &params, &nparams, &maxparams) < 0)
+    if (disable && virshParseEventStr(disable, false, &params,
+                                      &nparams, &maxparams) < 0)
         goto cleanup;
 
     if (nparams == 0) {
index 0c02d7f4e356da939c22fc358c2b3ce730ca32bb..a9915b09f469ceff9c677023e66ffd6b07e87a41 100644 (file)
@@ -2144,11 +2144,11 @@ The guaranteed minimum memory allocation for the guest.
 
 Specifying -1 as a value for these limits is interpreted as unlimited.
 
-=item B<perf> I<domain> [I<--enable> B<eventName>]
-[I<--disable> B<eventName>]
+=item B<perf> I<domain> [I<--enable> B<eventSpec>]
+[I<--disable> B<eventSpec>]
 
 Get the current perf events setting or enable/disable specific perf
-event for a guest domain.
+events for a guest domain.
 
 Perf is a performance analyzing tool in Linux, and it can instrument
 CPU performance counters, tracepoints, kprobes, and uprobes (dynamic
@@ -2158,11 +2158,12 @@ pure kernel counters, in this case they are called software events,
 including context-switches, minor-faults, etc.. Now dozens of events
 from different sources can be supported by perf.
 
-Currently only QEMU/KVM supports I<--enable> and I<--disable>.
-B<eventName> is a string listing one or more events, in the format
-of name|name|name. Only "cmt" event is supported presently. CMT is
-a PQos (Platform Qos) feature to monitor the usage of cache by
-applications running on the platform.
+Currently only QEMU/KVM supports this command. The I<--enable> and I<--disable>
+option combined with B<eventSpec> can be used to enabled or disable specific
+performance event. B<eventSpec> is a string list of one or more events
+separated by commas. However, just "cmt" event is supported presently. CMT is a
+PQos (Platform Qos) feature to monitor the usage of cache by applications
+running on the platform.
 
 =item B<blkiotune> I<domain> [I<--weight> B<weight>]
 [I<--device-weights> B<device-weights>]