[libvirt] [PATCH v2 7/8] virsh: implement new command to support perf

Daniel P. Berrange berrange at redhat.com
Tue Dec 8 11:07:13 UTC 2015


On Mon, Dec 07, 2015 at 03:53:58PM +0800, Qiaowei Ren wrote:
> This patch add new perf command to enable/disable perf event
> for a guest domain.
> 
> Signed-off-by: Qiaowei Ren <qiaowei.ren at intel.com>
> ---
>  tools/virsh-domain.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  tools/virsh.pod      |  18 ++++++++
>  2 files changed, 143 insertions(+)
> 
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index b7e7606..a47ef9f 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -8888,6 +8888,125 @@ cmdMemtune(vshControl *ctl, const vshCmd *cmd)
>  }
>  
>  /*
> + * "perf" command
> + */
> +static const vshCmdInfo info_perf[] = {
> +    {.name = "help",
> +        .data = N_("Get or set perf event")
> +    },
> +    {.name = "desc",
> +        .data = N_("Get or set the current perf events for a guest"
> +                   " domain.\n"
> +                   "    To get the perf events list use following command: \n\n"
> +                   "    virsh # perf <domain>")
> +    },
> +    {.name = NULL}
> +};
> +
> +static const vshCmdOptDef opts_perf[] = {
> +    {.name = "domain",
> +     .type = VSH_OT_DATA,
> +     .flags = VSH_OFLAG_REQ,
> +     .help = N_("domain name, id or uuid")
> +    },
> +    {.name = "cmt",
> +     .type = VSH_OT_INT,
> +     .help = N_("CMT event, as integer (default 0, disable)")
> +    },

Imagine we add many more perf events - we don't want to be adding
args to virsh for each one. Instead of --cmt, we should have
'--event cmt'


Regards,
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 :|




More information about the libvir-list mailing list