Re: [PATCH] perf tools: Allow multiple threads or processes inrecord, stat, top

From: Arnaldo Carvalho de Melo
Date: Fri Feb 10 2012 - 09:28:27 EST


Em Fri, Feb 10, 2012 at 02:42:01PM +0900, Namhyung Kim escreveu:
> 2012-02-09 11:44 PM, Arnaldo Carvalho de Melo wrote:
> > [root@aninha linux]# tools/perf/python/twatch.py
> > Traceback (most recent call last):
> > File "tools/perf/python/twatch.py", line 16, in<module>
> > import perf
> > ImportError: /home/acme/git/build/perf/python/perf.so: undefined symbol: ui__error

> > it breaks, I'll check an alternative way to report problems without
> > calling ui__ methods from thread_map.
>
> I have a different result:
> $ git checkout tip/perf/core
> HEAD is now at c98fdeaa9273... x86/sched/perf/AMD: Set sched_clock_stable
> $ patch -p1 < perf-allow-multiple-threads.patch
> patching file tools/perf/Documentation/perf-record.txt
<SNIP>
> $ cd tools/perf
> $ make -j8
<SNIP>
> $ sudo python/twatch.py
> Traceback (most recent call last):
> File "python/twatch.py", line 41, in <module>
> main()
> File "python/twatch.py", line 25, in main
> evsel.open(cpus = cpus, threads = threads);
> OSError: [Errno 22] Invalid argument

This is another problem and one I would appreciate if you could fix :-)

I mentioned it to David in a private message and there was at least one
instance where Linus was involved and I promised to fix this but haven't
find the time to do so.

The problem is that one needs to research how to make the python binding
to be rebuilt when one of the files that are linked into it changes.

Please take a look at tools/perf/util/setup.py and you'll see:

perf = Extension('perf',
sources = ['util/python.c', 'util/ctype.c', 'util/evlist.c',
'util/evsel.c', 'util/cpumap.c', 'util/thread_map.c',
'util/util.c', 'util/xyarray.c', 'util/cgroup.c',
'util/debugfs.c'],
include_dirs = ['util/include'],
extra_compile_args = cflags,
)

Probably is something simple in the Makefiles.

So please try again after doing:

cd tools/perf
rm -rf python/perf.so
make

And you should get the same problem. Also check
/proc/sys/kernel/perf_event_paranoid as this script does syswide sampling.

I'll try to fix this problem now that I took the time to think about it
8-)

- Arnaldo
--
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/