Commit Graph

704 Commits

Author SHA1 Message Date
69e4fb2588 libsysprof-capture: allow using ring in readwrite mode
This is a first step to be able to use the ring buffer as the backing
buffer for the SysprofCaptureWriter.
2020-02-15 22:50:22 -07:00
36860b449e libsysprof-capture: unref GSource after attaching 2020-02-15 22:27:34 -07:00
ca5c66245c libsysprof-capture: ignore some types when extending end_time 2020-02-15 22:17:23 -07:00
ed7c9bbaef libsysprof-capture: fix advancement in drain callback 2020-02-15 22:02:03 -07:00
c74c02a2d9 libsysprof-capture: update ring position while walking
This ensures that the producer can produce as soon as the reader has moved
past that data. Now that the callback has a mutable consumption value, they
can read the whole data in one shot anyway.
2020-02-15 21:55:08 -07:00
c0697c91cc libsysprof-capture: increase rate of buffer read
This ideally should be dynamic in the future to copy out data at a rate
that keeps us around 33% usage rate so that we can still burst if we need
to but keep things empty enough to not loose data.
2020-02-15 21:53:34 -07:00
47768859ad libsysprof-capture: whitespace cleanup 2020-02-15 20:50:05 -07:00
cb1b7d03fb libsysprof-capture: check frame types when peeking 2020-02-15 20:49:47 -07:00
c36420d716 libsysprof-capture: write final frame
This frame type can be used to communicate with the peer over the mapped
ring buffer to denote that writing is finished and it can free any
resources for the mapping.
2020-02-15 20:49:27 -07:00
e3ed30eb48 libsysprof-capture: remove framing data from MappedRingBuffer
This removes the 8 bytes of framing data from the MappedRingBuffer which
means we can write more data without racing. But also this means that we
can eventually use the mapped ring buffer as our normal buffer for
capture writing (to be done later).
2020-02-15 20:46:05 -07:00
e7f2702f88 memprof: simplify memprof source
This doesn't need to be using trace-fd anymore now that we have the
collector API.
2020-02-13 18:58:35 -08:00
04d599c718 preload: port memory collector to collector API
This uses a simplified form of collection without writing to capture
files directly. The data is written into a ring buffer for Sysprof to
pick up and copy into the real destination file. Using the mmap() ring
buffer allows loss of data when Sysprof cannot keep up, but on the other
hand allows the inferior to be fast enough to be useful.
2020-02-13 18:58:03 -08:00
c546d31ad9 libsysprof-capture: add simplified collector API
This is a simplified API for the inferior to use (such as from a
LD_PRELOAD) that will use mmap()'d ring buffer created by Sysprof. Doing
so can reduce the amount of overhead in the inferior enough to make some
workloads useful. For example, collecting memory statistics and backtraces
is now fast enough to be useful.
2020-02-13 18:56:54 -08:00
ec67106a4d libsysprof-capture: add missing platform header 2020-02-13 18:54:42 -08:00
089f5d7c56 control-fd: add SysprofControlSource
This is a source that will allow the inferior to call into Sysprof to
create a new mmap()'d ring buffer to share data. This allows significantly
less overhead in the child process as Sysprof itself will take care of
copying the data out of the inferior into the final capture file. There is
more copying of course, but less intrusive to the inferior itself.
2020-02-13 18:53:58 -08:00
77400c57c1 libsysprof-capture: add mmap()'d ring buffer
This is the start of a ring buffer to coordinate between processes without
the overhead of writing directly to files within the inferior process.
Instead, the parent process can monitor the ring buffer for framing
information and pass that along to the capture writer.
2020-02-13 18:50:20 -08:00
aca1a6a765 libsysprof-ui: check for valid frame type before incrementing 2020-02-13 14:32:34 -08:00
a8c6038679 libsysprof-capture: fix version value for 3.36 2020-02-13 14:32:34 -08:00
86dcedfba0 libsysprof-capture: add sysprof_getpagesize()
This is a helper to get the page size on various platforms so that calling
code does not need to duplicate that effort.
2020-02-13 14:32:34 -08:00
19e077736b libsysprof-capture: use sysconf() instead of getpagesize() 2020-02-13 14:32:34 -08:00
6cb55f4d71 libsysprof-capture: add raw frame helper
This helps when shuffling data between sources so that you can simply
memcpy() into the destination buffer.
2020-02-13 14:32:34 -08:00
1d44282edb libsysprof-capture: add define for last frame type 2020-02-13 14:32:34 -08:00
3e7acd5663 libsysprof: protect against bad reads 2020-02-13 14:32:34 -08:00
3f07cf2748 libsysprof: decode allocation frames into symbol map
This ensures that we have proper symbols when opening a file with
allcoation frames.
2020-02-11 18:40:29 -08:00
c39cf46776 tools: perform cleanup/supplementals when stopping profiler 2020-02-11 18:39:20 -08:00
b351e1a50a capture: add comment about frame tracking 2020-02-11 18:07:31 -08:00
33c81a3a9c memprof: add memory profiling using LD_PRELOAD
This brings over some of the techniques from the old memprof design.
Sysprof and memprof shared a lot of code, so it is pretty natural to
bring back the same callgraph view based on memory allocations.

This reuses the StackStash just like it did in memprof. While it
would be nice to reuse some existing tools out there, the fit of
memprof with sysprof is so naturally aligned, it's not really a
big deal to bring back the LD_PRELOAD. The value really comes
from seeing all this stuff together instead of multiple apps.

There are plenty of things we can implement on top of this that
we are not doing yet such as temporary allocations, cross-thread
frees, graphing the heap, and graphing differences between the
heap at to points in time. I'd like all of these things, given
enough time to make them useful.

This is still a bit slow though due to the global lock we take
to access the writer. To improve the speed here we need to get
rid of that lock and head towards a design that allows a thread
to request a new writer from Sysprof and save it in TLS (to be
destroyed when the thread exits).
2020-02-07 19:00:33 -08:00
cae70498da callgraph: fix whitespace 2020-02-07 16:54:43 -08:00
9689b8c9c6 selection: whitespace cleanup 2020-02-07 16:54:23 -08:00
31d83a12b9 elf: short-circuit symbol resolving 2020-02-07 16:54:18 -08:00
4c5fec742f jitmap: whitespace cleanup 2020-02-07 16:54:12 -08:00
2e72e6af84 capture: fix format type for address on macOS 2020-02-07 11:00:09 -08:00
47c09cb241 build: add version macros for 3.36 2020-01-31 09:13:50 -08:00
981873af75 cli: add --merge command line option
This allows the caller to merge multiple syscap files into one such as:

  sysprof-cli --merge a.syscap b.syscap > c.syscap

Fixes #26
2020-01-29 08:17:36 -08:00
0b4defe135 binfile: fix path check 2020-01-24 12:54:51 -08:00
9a3a95a5ca podman: add debug directories from podman containers
This is meant to allow us to find the debug files for a given library for
podman containers running as the current user. However, we still need to
try to translate the fuse-overlayfs paths when parsing the /proc/pid/mounts
or we'll have incorrect paths coming from the event stream.
2020-01-24 10:54:32 -08:00
d176efe91c lookaside: cleanup whitespace 2020-01-24 10:51:36 -08:00
bae10987f0 libsysprof-ui: fix timing information for marks tooltips 2020-01-24 09:29:34 -08:00
94b0ecb758 display: provide recording time for display titles 2020-01-23 12:46:44 -08:00
460df56fa5 visualizers: clear selected row when showing details
The details don't correspond to any selected row, so clear the row when
we switch to the details page.
2020-01-23 12:36:04 -08:00
bcfaa6caa8 perf: use task-ids instead of pids
The pids might overlap, which isn't that useful for us when we are creating
threads. Instead use the task-ids (which should basically overlap anyway).
2020-01-23 12:26:18 -08:00
731b6dd379 sysprof: allow passing program path to sysprof
If the path provided to us is an executable program (instead of a syscap
file) then we can setup the path as the binary to execute in the profiler
assistant and save the user a couple clicks.
2020-01-23 11:59:50 -08:00
599ecaebe1 display: remove unused variable 2020-01-23 11:59:50 -08:00
7dad1f2ab4 marks: add end time to mark details 2020-01-22 12:01:26 -08:00
812b0d60a0 counters: use counter description in menu item 2020-01-21 21:06:41 -08:00
db160cf536 ui: avoid concurrent reloads of stack depths
This ensures that we only have one thread doing reloads of stack frame
depths at a time. While we only ref the reader in the state, it should
still be fine because cursors *always* make a copy of the reader for their
internal use. I don't think this should fix #23, but it may reduce the
chances of it happening.

It's unclear to me what could cause #23 to happen, unless for some reason
multiple threads were sharing the reader's internal buffer causing the
frame-> dereferences to be junk. But as stated with reader copies, that
should not be able to happen.

Another possible avenue is that the task is cancelled and for some reason
the task is clearing the task data while the thread is running. Again,
that is not supposed to be possible given the design of GTask as it
should not release task data until finalized.
2020-01-08 11:13:24 -08:00
bd2da8baa0 ui: use g_atomic_rc_box
This changes a couple of our structures to use the atomic rc box instead
of gslice directly. It shouldn't affect anything, just some general
modernization while looking at #23
2020-01-08 11:00:54 -08:00
c4eaa53f20 libsysprof: handle bus/proxy failure gracefully 2020-01-02 10:31:12 -08:00
8a86d5f1a0 test: Fix detection of pagesize at runtime
Not all architectures have a page size of 4k, detect it at runtime

Fix: https://gitlab.gnome.org/GNOME/sysprof/issues/21
2020-01-02 12:44:27 +01:00
994b0535ef Fix endianness detection when writing a frame
Properly detect endianness at compilation time

This fixes the tests on big-endian machines

Fix: https://gitlab.gnome.org/GNOME/sysprof/issues/7
2020-01-02 12:44:15 +01:00