virsh: Make perf accept event list separated by commas

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>
This commit is contained in:
Michal Privoznik 2016-03-30 17:56:02 +02:00
parent ee34745f6a
commit 30cd5983b7
2 changed files with 15 additions and 20 deletions

View 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) {

View 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>]