lkml.org 
[lkml]   [2014]   [Dec]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 02/37] perf record: Use a software dummy event to track task/mmap events
On 12/24/14 12:14 AM, Namhyung Kim wrote:
> Prepend a software dummy event into evlist to track task/comm/mmap
> events separately. This is a preparation of multi-file/thread support
> which will come later.

Are you are making this the first event because of how perf internals
are coded -- that the first event tracks tasks events? With the tracking
bit in evsel you should not need to do that. Is there another reason?

---8<---

> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index cfbe2b99b9aa..72dff295237e 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -193,6 +193,44 @@ int perf_evlist__add_default(struct perf_evlist *evlist)
> return -ENOMEM;
> }
>
> +int perf_evlist__prepend_dummy(struct perf_evlist *evlist)
> +{
> + struct perf_event_attr attr = {
> + .type = PERF_TYPE_SOFTWARE,
> + .config = PERF_COUNT_SW_DUMMY,
> + };
> + struct perf_evsel *evsel, *pos;
> +
> + event_attr_init(&attr);
> +
> + evsel = perf_evsel__new(&attr);
> + if (evsel == NULL)
> + goto error;
> +
> + /* use strdup() because free(evsel) assumes name is allocated */
> + evsel->name = strdup("dummy");
> + if (!evsel->name)
> + goto error_free;
> +
> + list_for_each_entry(pos, &evlist->entries, node) {
> + pos->idx += 1;
> + pos->tracking = false;
> + }
> +
> + list_add(&evsel->node, &evlist->entries);
> + evsel->idx = 0;
> + evsel->tracking = true;

perf_evlist__set_tracking_event()?

David



\
 
 \ /
  Last update: 2014-12-26 18:01    [W:0.987 / U:2.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site