Re: [PATCH] perf kvm: fix sample_type manipulation

From: David Ahern
Date: Fri Sep 06 2013 - 09:59:30 EST


On 9/6/13 6:53 AM, Arnaldo Carvalho de Melo wrote:
Em Fri, Sep 06, 2013 at 09:48:54AM +0300, Adrian Hunter escreveu:
Manipulating the sample_type of an evsel requires
the use of:
perf_evsel__set_sample_bit()
and perf_evsel__reset_sample_bit()

Fine, but...

hmmm... this is a relatively new API (7be5ebe8). The kvm-live command and my scheduling daemon pre-date its introduction.


Manipulating the sample type of an evlist requires
the id position to be recalculated.

And this is hot of the presses ... 75562573.


... can't we hide this detail? I.e. we could do it like we do with the
alloc_{mmap,poll}() evlist methods in perf_evlist__mmap(), checking if it was
already done, etc.

This we reduce the contact surface for tools using evlists and evsels.

I.e., this sequence:


+ perf_evlist__set_id_pos(evlist);
+
err = perf_evlist__open(evlist);

Could remain just:

err = perf_evlist__open(evlist);

perf code has been around a while now and I know there are a number of local analysis commands built around it. API changes like this -- required ones at that -- need to be simple and some error checking built in where possible.

... and documentation for the API on what commands should be doing and in what order.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/