Commit Graph

78 Commits

Author SHA1 Message Date
4708a509aa Fix PowerPC checks for __NR_perf_counter_open.
__ppc__ isn't defined here on Debian powerpc. Grepping through the headers
installed in /usr/include, there are a few references to __ppc__ and
__ppc64__, but I suspect they're for other OSs.

Signed-off-by: Michel Dänzer <michel@daenzer.net>
2011-08-31 19:58:09 -04:00
791fff95c3 cli: Allow to get samples from single pid
perf lets you decide to only get events that concerns a single process
and thus make sysprof profile this process instead of the whole system
(it can happen that you don't really care about other processes that are
just then noise).

As a side effect, this allows sysprof to not run as root if you have the
rights on the process you want to profile.
2011-01-27 17:07:07 -05:00
c960ebd52f Use the SET_OUTPUT ioctl to direct all output to the same buffer
This ensures that we don't get events out of order, which will make
the profiles look a lot less bogus on multi-core systems.
2010-04-24 10:50:26 -04:00
73922a0af9 Eliminate some compiler warnings 2010-04-23 11:56:14 -04:00
a03172b11f Use d_print() instead of g_print() for debug spam 2010-04-23 11:56:14 -04:00
aab051f944 Fix encoding of error message
Use g_strerror instead of strerror to get UTF-8
2010-03-23 18:09:14 +01:00
b957f30379 Really disable hardware counters. 2010-03-21 12:14:33 -04:00
2d5cf4c93f Ignore fork events that are just new threads being spawned.
These would cause mysterious new processes to show up.
2010-03-10 06:58:22 -05:00
08d4d26060 Disable use of hardware perf counters.
They don't seem to actually work on a lot of hardware.
2010-03-09 12:27:49 -05:00
1707bebe93 Stop using double mmap trick.
It has issues on various architectures, such as ARM, and there was
never any guarantee that it would actually work. So since we'd need
fallback code anyway, and the main point of it was simplifying the
code, just get rid of it and handle the overflow conditions manually.
2010-03-09 12:27:43 -05:00
Nix
106a734c4f Wire up __NR_perf_counter_open syscall for almost all arches as of
Currently, sysprof hardwires the syscall number of
__NR_perf_counter_open. That's all very well, except... like other
syscall numbers, it varies per-arch. With a few exceptions
(e.g. sparc64), it even varies between 32-bit and 64-bit x86 arches.

This patch provides the defines for every number I could see assigned
in git trunk right now, with the exception of some of the ARM ones, where
I couldn't see how to differentiate between the various sorts of ARM to
figure out what the syscall base was. For those, let's wait for libc to
catch up.

The only arch I've been unable even to guess at is the very new S-Core,
which is the only user so far of the generic syscall table in
<include/asm-generic>. This specifies a value of 241, but I can't hook
it up because I can't find an S-Core toolchain anywhere so I don't know
what #define to check for, and googling gives no clues.

Only tested on x86-64 (where it now works) so there may be all sorts of
bugs in the rest of it (well, in the #defines anyway, though most were
checked against GCC trunk).
2010-02-08 13:16:00 -05:00
3e4921b92d Unconditionally fall back to software if opening hardware counters fails
If hardware counters are not available, fall back to SW regardless of
why the hardware counters aren't available. The error code can be
either ENOTSUPP or ENODEV depending on CPU type, so it's simpler to
just retry in all cases, and only fail if the software fallback
failed.
2010-02-01 14:02:41 -05:00
ef2da92b0a More error handling. 2009-11-02 13:52:11 -05:00
71f2cd3a64 Return error when the counter can't be opened. 2009-11-02 13:30:04 -05:00
ae77f078d3 Skip symbols from IRQ stack.
There is a bug in the kernel where it includes the stack of the IRQ
that generated the event, so that the stack ends up looking like this:

	[ip] [irq stack] [real stack].

As a temporary workaround, this patch filters out the irq stack
symbols.
2009-10-29 07:31:31 -04:00
7fc23589a2 Exclude idle events and set sample_period to 200000 2009-10-23 13:42:11 -04:00
70d03f4bf2 Set wakeup_events to 149, not 150 2009-10-21 12:31:43 -04:00
432cd9ce55 Add support for software fallback counters 2009-10-21 06:58:20 -04:00
79107145c0 Really make it compile on older kernels 2009-09-25 11:50:08 -04:00
626078e873 Make it distcheck
Also add a warning about compiling against a too old kernel.
2009-09-25 11:37:26 -04:00
9072f891fd Eliminate 'partial' string 2009-09-24 10:46:59 -04:00
08fc4f64a9 Read data before stopping collector.
Stop debug spew.
2009-09-11 04:07:11 -04:00
09ffea0d57 TODO, plus a number of other fixes 2009-09-08 19:35:03 -04:00
6dabcefec5 Better handling of events without stacktraces 2009-09-08 03:03:38 -04:00
23147e1141 Remove stash from collector 2009-09-08 03:03:26 -04:00
e277712037 Initial support for fork/exit events 2009-09-08 03:03:24 -04:00
3d9cbe20e7 Remove last bits of process.[ch] 2009-09-08 03:03:15 -04:00
b8364e2847 Don't compile process.[ch] anymore 2009-09-08 03:03:14 -04:00
43e419f774 Simpler message formatting 2009-09-08 03:03:11 -04:00
29e270cb8d Various debug spew 2009-09-08 03:03:08 -04:00
d34a1cf460 Add symbol resolution to tracker 2009-09-08 03:03:07 -04:00
cdc7ce7e12 Add process and map tracking to tracker 2009-09-08 03:03:06 -04:00
5072c23f42 Add events to tracker instead of stash 2009-09-08 03:03:04 -04:00
b86b04910f Fake new_process and new_map events when a tracker is created 2009-09-08 03:03:03 -04:00
139acd0287 Hook up dead period, and only call back after a complete batch of samples 2009-09-08 03:03:01 -04:00
e387de1c3a Make StackStash store uint64_ts instead of pointers 2009-09-08 03:02:56 -04:00
47795ba85b Use a buffer of 32 pages.
Also remove a debug print statement.
2009-09-08 03:02:49 -04:00
08ba6bfbd3 Use two consecutive mappings of the ring buffer.
This allows us to not ignore wrapping and just process events instead
of having to copy the data to temporary storage.
2009-09-08 03:02:37 -04:00
594a58d674 Initial port to perf counters 2009-09-08 03:02:11 -04:00
62ffe734b0 Call back after collecting all traces.
2008-03-24  Soren Sandmann <sandmann@daimi.au.dk>

        * collector.c (collect_traces): Call back after collecting all
        traces. 

        * TODO: update

        * process.c: Simpler code to find vmlinux 



svn path=/trunk/; revision=406
2008-03-29 19:08:01 +00:00
c2de993836 Use kernel builtin tracer instead of copying everything ourselves.
2008-03-20  Soren Sandmann <sandmann@redhat.com>
 
       * module/sysprof-module.c (trace_kernel): Use kernel builtin
       tracer instead of copying everything ourselves.


svn path=/trunk/; revision=401
2008-03-20 09:49:46 +00:00
542967b1f7 Update a comment
svn path=/trunk/; revision=399
2008-03-02 00:08:21 +00:00
b98db05f9b Add commented out code to reject callback.
2008-02-17  Soren Sandmann  <sandmann@redhat.com>

	* collector.c (lookup_symbol): Add commented out code to reject
	callback.

	* elfparser.c (struct ElfParser): Store the filename if any
	(elf_parser_get_sym_address): Subtract the load address, so the
	result will be an offset into the text section.

	* process.[ch] (process_lookup_symbol): Add an offset out-argument
	
	* binfile.[ch] (bin_symbol_get_address): New function

	* TODO: updates



svn path=/trunk/; revision=397
2008-02-17 23:31:19 +00:00
d3b5cc446f Update TODO
svn path=/trunk/; revision=394
2007-11-19 17:56:02 +00:00
f7a138fa15 +2007-11-17 Soren Sandmann <sandmann@daimi.au.dk>
+
+       * collector.c (collector_create_profile): Don't collect traces here.
+


svn path=/trunk/; revision=390
2007-11-17 06:23:39 +00:00
41efdc9c7e Formatting
2007-11-16  Soren Sandmann <sandmann@daimi.au.dk>

	* module/sysprof-module.c (n_traces_available): Formatting
	
	* module/sysprof-module.c (sysprof_poll): Require 16 traces rather
	than 8. 
	

svn path=/trunk/; revision=389
2007-11-17 03:48:31 +00:00
c00ccd69c7 updates
2007-11-16  Soren Sandmann <sandmann@daimi.au.dk>

	* TODO: updates
	
	* module/sysprof-module.c (sysprof_poll): Only select readable
	when there is at least eight traces available

	* collector.c (collect_traces): New function, old on_read()
	
	* collector.c (collector_create_profile): Collect traces here as
	well.


svn path=/trunk/; revision=388
2007-11-17 02:53:22 +00:00
1867b97a8d Use an array instead of a list. Look for vmlinux in the source directory.
2007-10-22  Soren Sandmann <sandmann@daimi.au.dk>

        * process.c (look_for_vmlinux): Use an array instead of a
        list. Look for vmlinux in the source directory.

        * elfparser.c (elf_parser_get_crc32): Only use MADV_DONTNEED if
        the data is file-backed.

        * TODO: updates.

        Various formatting fixes


svn path=/trunk/; revision=385
2007-10-25 02:45:54 +00:00
476e6f0c1b Call callback with an extra boolean indicating whether the sample read was
2007-10-20  Soren Sandmann <sandmann@daimi.au.dk>

       * collector.c (on_read): Call callback with an extra boolean
       indicating whether the sample read was the first one

       * collector.c (add_trace_to_stash): Allocate addresses on the
       stack if possible.

       * sysprof.c (on_new_sample): Only call update_sensitivity() on the
       first sample.

       * stackstash.c (stack_stash_add_trace): Move match to front


svn path=/trunk/; revision=373
2007-10-20 23:51:35 +00:00
f1cbdbf27c Add support for looking up kernel symbols from /proc/kallsyms
2007-09-16  Soren Sandmann <sandmann@daimi.au.dk>

	* process.c (process_lookup_kernel_symbol): Add support for
	looking up kernel symbols from /proc/kallsyms

	* sysprof-text.c (dump_data): Print note that the file is being
	saved.

	* module/sysprof-module.[ch] (timer_notify): Send a copy of the
	kernel stack to userspace.

	* collector.c: Do kernel symbol lookups.
	

svn path=/trunk/; revision=372
2007-09-17 01:43:07 +00:00