[libvirt] [PATCH] perf: add one more perf event support

John Ferlan jferlan at redhat.com
Tue Dec 6 12:31:18 UTC 2016


[...]

> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c
> @@ -11195,24 +11195,26 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
>   *
>   * VIR_DOMAIN_STATS_PERF: Return perf event statistics.
>   * The typed parameter keys are in this format:
> - * "perf.cmt" - the usage of l3 cache (bytes) by applications running on the
> - *              platform as unsigned long long. It is produced by cmt perf
> - *              event.
> - * "perf.mbmt" - the total system bandwidth (bytes/s) from one level of cache
> - *               to another as unsigned long long. It is produced by mbmt perf
> - *               event.
> - * "perf.mbml" - the amount of data (bytes/s) sent through the memory controller
> - *               on the socket as unsigned long long. It is produced by mbml
> - *               perf event.
> - * "perf.cache_misses"     - the count of cache misses as unsigned long long.
> - *                           It is produced by cache_misses perf event.
> - * "perf.cache_references" - the count of cache hits as unsigned long long.
> - *                           It is produced by cache_references perf event.
> - * "perf.instructions"     - The count of instructions as unsigned long long.
> - *                           It is produced by instructions perf event.
> - * "perf.cpu_cycles"       - The count of cpu cycles (total/elapsed) as an
> - *                           unsigned long long. It is produced by cpu_cycles
> - *                           perf event.
> + * "perf.cmt"                     - the usage of l3 cache (bytes) by applications running on the
> + *                                  platform as unsigned long long. It is produced by cmt perf
> + *                                  event.
> + * "perf.mbmt"                    - the total system bandwidth (bytes/s) from one level of cache
> + *                                  to another as unsigned long long. It is produced by mbmt perf
> + *                                  event.
> + * "perf.mbml"                    - the amount of data (bytes/s) sent through the memory controller
> + *                                  on the socket as unsigned long long. It is produced by mbml
> + *                                  perf event.
> + * "perf.cache_misses"            - the count of cache misses as unsigned long long.
> + *                                  It is produced by cache_misses perf event.
> + * "perf.cache_references"        - the count of cache hits as unsigned long long.
> + *                                  It is produced by cache_references perf event.
> + * "perf.instructions"            - The count of instructions as unsigned long long.
> + *                                  It is produced by instructions perf event.
> + * "perf.cpu_cycles"              - The count of cpu cycles (total/elapsed) as an
> + *                                  unsigned long long. It is produced by cpu_cycles
> + *                                  perf event.
> + * "perf.branch_instructions"     - The count of branch instructions as unsigned long long.
> + *                                  It is produced by branch_instructions perf event.

In addition to Peter's comments, the above hunk with adding spaces makes
the lines go longer than 80 characters making things mostly unreadable.
In the long run the data gets used to generate the webpage docs, see:

http://libvirt.org/html/libvirt-libvirt-domain.html#virConnectGetAllDomainStats

I think a better way to format is seen in virDomainMemoryStats. It
doesn't fit perfectly, but sure looks better than the mass of text that
results.

In any case, when you do this kind of formatting change - you need to
check what gets generated to see if it looks reasonable *and* it would
need to be in a separate patch.

[...]

> --- a/src/util/virperf.h
> +++ b/src/util/virperf.h
> @@ -32,10 +32,11 @@ typedef enum {
>      VIR_PERF_EVENT_MBMT,   /* Memory Bandwidth Monitoring Total */
>      VIR_PERF_EVENT_MBML,   /* Memory Bandwidth Monitor Limit for controller */
>  
> -    VIR_PERF_EVENT_CPU_CYCLES,       /* Count of CPU Cycles (total/elapsed) */
> -    VIR_PERF_EVENT_INSTRUCTIONS,     /* Count of instructions for application */
> -    VIR_PERF_EVENT_CACHE_REFERENCES, /* Cache hits by applications */
> -    VIR_PERF_EVENT_CACHE_MISSES,     /* Cache misses by applications */
> +    VIR_PERF_EVENT_CPU_CYCLES,          /* Count of CPU Cycles (total/elapsed) */
> +    VIR_PERF_EVENT_INSTRUCTIONS,        /* Count of instructions for application */
> +    VIR_PERF_EVENT_CACHE_REFERENCES,    /* Cache hits by applications */
> +    VIR_PERF_EVENT_CACHE_MISSES,        /* Cache misses by applications */
> +    VIR_PERF_EVENT_BRANCH_INSTRUCTIONS, /* Count of branch instructions by applications*/

Again - same here. There's no need for the extra spaces.

[...]


> --- a/tools/virsh.pod
> +++ b/tools/virsh.pod
> @@ -945,7 +945,8 @@ I<--perf> returns the statistics of all enabled perf events:
>  "perf.cpu_cycles" - the count of cpu cycles (total/elapsed),
>  "perf.instructions" - the count of instructions,
>  "perf.cache_references" - the count of cache hits,
> -"perf.cache_misses" - the count of caches misses
> +"perf.cache_misses" - the count of caches misses,
> +"perf.branch_instructions" - the count of branch instructions
>  
>  See the B<perf> command for more details about each event.
>  
> @@ -2270,25 +2271,27 @@ performance event. B<eventSpec> is a string list of one or more events
>  separated by commas. Valid event names are as follows:
>  
>  B<Valid perf event names>
> -  cmt              - A PQos (Platform Qos) feature to monitor the
> -                     usage of cache by applications running on the
> -                     platform.
> -  mbmt             - Provides a way to monitor the total system
> -                     memory bandwidth between one level of cache
> -                     and another.
> -  mbml             - Provides a way to limit the amount of data
> -                     (bytes/s) send through the memory controller
> -                     on the socket.
> -  cache_misses     - Provides the count of cache misses by
> -                     applications running on the platform.
> -  cache_references - Provides the count of cache hits by
> -                     applications running on th e platform.
> -  instructions     - Provides the count of instructions executed
> -                     by applications running on the platform.
> -  cpu_cycles       - Provides the count of cpu cycles
> -                     (total/elapsed). May be used with
> -                     instructions in order to get a cycles
> -                     per instruction.
> +  cmt                     - A PQos (Platform Qos) feature to monitor the
> +                            usage of cache by applications running on the
> +                            platform.
> +  mbmt                    - Provides a way to monitor the total system
> +                            memory bandwidth between one level of cache
> +                            and another.
> +  mbml                    - Provides a way to limit the amount of data
> +                            (bytes/s) send through the memory controller
> +                            on the socket.
> +  cache_misses            - Provides the count of cache misses by
> +                            applications running on the platform.
> +  cache_references        - Provides the count of cache hits by
> +                            applications running on th e platform.
> +  instructions            - Provides the count of instructions executed
> +                            by applications running on the platform.
> +  cpu_cycles              - Provides the count of cpu cycles
> +                            (total/elapsed). May be used with
> +                            instructions in order to get a cycles
> +                            per instruction.
> +  branch_instructions     - Provides the count of branch instructions
> +                            executed by applications running on the platform.
>  
>  B<Note>: The statistics can be retrieved using the B<domstats> command using
>  the I<--perf> flag.
> 

And this just makes the output unreadable on an 80 character wide
display/terminal.... It's much easier to view in your branch just use
'man tools/virsh.1' and search on 'cmt' (with your 80 column wide
terminal/window).

John




More information about the libvir-list mailing list