lkml.org 
[lkml]   [2010]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC][PATCH v2 11/11] perf top: demo of how to use the sysfs interface
From
Date
On Thu, 2010-05-20 at 02:18 +0800, Corey Ashford wrote:
>
> On 5/18/2010 6:49 PM, Lin Ming wrote:
> > Just a temporary patch to show how to use the pmu sysfs interface...
> >
> > Signed-off-by: Lin Ming <ming.m.lin@intel.com>
> > ---
> > tools/perf/builtin-top.c | 13 +++++++++++++
> > 1 files changed, 13 insertions(+), 0 deletions(-)
> >
> > diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> > index adc179d..eaa9405 100644
> > --- a/tools/perf/builtin-top.c
> > +++ b/tools/perf/builtin-top.c
> > @@ -1206,6 +1206,7 @@ static void start_counter(int i, int counter)
> > struct perf_event_attr *attr;
> > int cpu;
> > int thread_index;
> > + int sys_fd;
> >
> > cpu = profile_cpu;
> > if (target_tid == -1 && profile_cpu == -1)
> > @@ -1226,9 +1227,21 @@ static void start_counter(int i, int counter)
> >
> > for (thread_index = 0; thread_index < thread_num; thread_index++) {
> > try_again:
> > + /*
> > + * This is just an ugly demo of how to use the sysfs interface.
> > + * You can also parse the <event-name> and open sys file as,
> > + * sys_fd = open("/sys/devices/system/cpu/events/<event-name>/event_source/id", O_RDONLY);
> > + */
>
> In this above case, does this sys_fd also specify the event I am going to open, in addition to its event source? I'd assume not since event_source is a symlink to /sys/devices/system/cpu/event_source (right?)

Right, this sys_fd only specifies the event source.

> How do I specify the exact event id via the sysfs interface?

/sys/devices/system/cpu/events/<event-name>/id

But in this patch series, the event id sysfs interface is not used yet.

Thanks,
Lin Ming

>
> Thanks,
>
> - Corey
>



\
 
 \ /
  Last update: 2010-05-20 03:21    [W:0.115 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site