Re: [PATCH v6 08/10] perf metricgroup: Support printing metric groups for system PMUs

From: John Garry
Date: Mon Dec 07 2020 - 13:05:54 EST


On 07/12/2020 17:23, Arnaldo Carvalho de Melo wrote:
+struct metricgroup_print_sys_idata {
+ struct strlist *metriclist;
+ bool metricgroups;
+ char *filter;
+ bool raw;
+ bool details;
+ struct rblist *groups;
+};
I'm doing some reorg to avoid these holes:

[acme@five perf]$ pahole -C metricgroup_print_sys_idata ~/bin/perf
struct metricgroup_print_sys_idata {
struct strlist * metriclist; /* 0 8 */
_Bool metricgroups; /* 8 1 */

/* XXX 7 bytes hole, try to pack */

char * filter; /* 16 8 */
_Bool raw; /* 24 1 */
_Bool details; /* 25 1 */

/* XXX 6 bytes hole, try to pack */

struct rblist * groups; /* 32 8 */

/* size: 40, cachelines: 1, members: 6 */
/* sum members: 27, holes: 2, sum holes: 13 */
/* last cacheline: 40 bytes */
};
[acme@five perf]$

It ended up as:

[acme@five perf]$ pahole -C metricgroup_print_sys_idata ~/bin/perf
struct metricgroup_print_sys_idata {
struct strlist * metriclist; /* 0 8 */
char * filter; /* 8 8 */
struct rblist * groups; /* 16 8 */
_Bool metricgroups; /* 24 1 */
_Bool raw; /* 25 1 */
_Bool details; /* 26 1 */

/* size: 32, cachelines: 1, members: 6 */
/* padding: 5 */
/* last cacheline: 32 bytes */
};
[acme@five perf]$o


Hi Arnaldo,

OK, I'll be less wasteful in my struct organization.

Thanks,
John