gui: Use perf if available

So that we can have access to all sorts of hardware and software counters and
as well stop polling /proc to notice new threads and threads dying.

To check that it is using, see the signature one mmap per cpu mmaps + the
perf.so binding being dlopen'ed by the python interpreter when finding 'import
perf', etc.

 # cat /proc/`pidof tuna`/maps
 ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
 [root@emilia tuna]# cat /proc/1883/maps  | grep perf
 7fa583072000-7fa5830f3000 rw-s 00000000 00:09 4166      anon_inode:[perf_event]
 7fa5830f3000-7fa583174000 rw-s 00000000 00:09 4166      anon_inode:[perf_event]
 7fa583174000-7fa5831f5000 rw-s 00000000 00:09 4166      anon_inode:[perf_event]
 7fa5831f5000-7fa583276000 rw-s 00000000 00:09 4166      anon_inode:[perf_event]
 7fa583276000-7fa5832f7000 rw-s 00000000 00:09 4166      anon_inode:[perf_event]
 7fa5832f7000-7fa583378000 rw-s 00000000 00:09 4166      anon_inode:[perf_event]
 7fa583378000-7fa5833f9000 rw-s 00000000 00:09 4166      anon_inode:[perf_event]
 7fa5833f9000-7fa58347a000 rw-s 00000000 00:09 4166      anon_inode:[perf_event]
 7fa58347a000-7fa583483000 r-xp 00000000 fd:00 2229604   /home/acme/git/build/perf/lib.linux-x86_64-2.6/perf.so
 7fa583483000-7fa583682000 ---p 00009000 fd:00 2229604   /home/acme/git/build/perf/lib.linux-x86_64-2.6/perf.so
 7fa583682000-7fa583685000 rw-p 00008000 fd:00 2229604   /home/acme/git/build/perf/lib.linux-x86_64-2.6/perf.so
 [root@emilia tuna]#

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2 files changed