On Wed, Apr 12, 2017 at 03:26:36PM +0200, Ján Tomko wrote: > On Wed, Apr 12, 2017 at 12:27:11PM +0100, Daniel P. Berrange wrote: > > The virPerfGetEventAttr method contains a totally pointless > > loop. Remove it, verify the array size statically, and then > > just use an array index to access the perf event. > > > > Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> > > --- > > src/util/virperf.c | 143 +++++++++++++++++++++++++---------------------------- > > 1 file changed, 66 insertions(+), 77 deletions(-) > > > > diff --git a/src/util/virperf.c b/src/util/virperf.c > > index e39cebb..7366efc 100644 > > --- a/src/util/virperf.c > > +++ b/src/util/virperf.c > > [...] > > > + [VIR_PERF_EVENT_STALLED_CYCLES_BACKEND] = { > > + .attrType = PERF_TYPE_HARDWARE, > > + .attrConfig = PERF_COUNT_HW_STALLED_CYCLES_BACKEND > > + }, > > + [VIR_PERF_EVENT_REF_CPU_CYCLES] = { > > Up to VIR_PERF_EVENT_REF_CPU_CYCLES, the initialization is indexed > by the enum value... > > > # ifdef PERF_COUNT_HW_REF_CPU_CYCLES > > - .attrType = PERF_TYPE_HARDWARE, > > - .attrConfig = PERF_COUNT_HW_REF_CPU_CYCLES > > + .attrType = PERF_TYPE_HARDWARE, > > + .attrConfig = PERF_COUNT_HW_REF_CPU_CYCLES > > # else > > - .attrType = 0, > > - .attrConfig = 0, > > + .attrType = 0, > > + .attrConfig = 0, > > # endif > > }, > > - {.type = VIR_PERF_EVENT_CPU_CLOCK, > > - .attrType = PERF_TYPE_SOFTWARE, > > + {.attrType = PERF_TYPE_SOFTWARE, > > .attrConfig = PERF_COUNT_SW_CPU_CLOCK}, > > ... but the rest does not. > > ACK with the inconsitency fixed. Opps, yes, my mistake when resolving the conflict Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list