Commit Graph

86 Commits

Author SHA1 Message Date
582986f5c9 libsysprof-capture: free deduplicated array entries 2023-05-12 14:09:43 -07:00
dc99b46254 libsysprof-capture: fix leak of mapped ring buffer structure 2023-05-12 14:02:46 -07:00
efab045006 libsysprof-analyze: start on sysprof-analyze library
The goal here is to break up libsysprof into a library for recording
profiles (using libsysprof-capture) and a library for analyzing profiles
(both used by the sysprof UI).
2023-04-25 11:57:26 -07:00
dcbeb0f87a libsysprof: add SysprofCaptureModel
This adds a GListModel that we can use to load capture files. The goal here
is to map the entire capture into memory so we can avoid reading lots of
buffers. That also allows for the model items to live as long as the model
is alive (or underlying file map, really).

The next goal is to stack features on top of this such as implementing the
callgraph as a filter of the model, or generic filters between the
callgraph model and the actual data source model.
2023-04-24 17:26:45 -07:00
757d36ae8e Cleanup the build a bit
Makes the Meson build a little bit better and cleans up some of the
formatting.
2022-05-25 14:07:02 -05:00
b31d3557ed testprocessmodel: fix some porting issues 2022-04-01 13:15:49 -07:00
5e9591903a testcaptureview: fix signal name 2022-04-01 13:15:49 -07:00
5817cf85fd testprocessmodel: port to GTK 4 2022-04-01 13:15:49 -07:00
5ca7baa688 testcaptureview: port to GTK 4 2022-04-01 13:15:49 -07:00
5e55f5f2cc build: switch build to GTK 4 2022-04-01 13:14:51 -07:00
b4c8530019 build: remove libdazzle 2022-04-01 13:14:51 -07:00
0518cae7f9 tests: use integer types
So we can catch negative values.
2021-11-04 20:07:54 -07:00
468b45b086 tests: fix inode check
We care about the event, not what we read.
2021-09-21 16:05:00 -07:00
f09e378ca0 tests: ignore zero inode 2021-09-21 16:03:48 -07:00
b0812681b2 tests: style cleanup 2021-09-21 15:40:42 -07:00
5b6377ee78 tests: make resolving path match elf resolver
Just use the ev->filename if we didn't translate the path (so we can avoid
extra string copies).
2021-09-21 15:39:47 -07:00
0fd7ea3f80 tests: cleanup addr decode output 2021-09-21 11:50:34 -07:00
09360c5cb9 tests: add test to dump translated maps 2021-09-21 11:50:22 -07:00
728c5081d1 more work on resolver kinds 2021-09-17 17:11:06 -07:00
5f43a57ab0 tests: add util to extract build-id
Easier to remember than readelf stuff and tests the same code paths.
2021-09-16 22:59:28 -07:00
4d12f9eea7 build: use static library for tests 2021-09-16 22:58:51 -07:00
e02785ba23 start on new resolver for paths 2021-09-14 19:53:46 -07:00
1d2c00b120 tests: make test tool system independent
We don't want to rely on host /proc/mounts or we cannot really test this
on machines other than the target failure.
2021-08-30 15:25:24 -07:00
14139232d5 capture: rename PidRoot to Overlay and add src/dst
Really what we want to deal with here is tracking an overlay that we may
need to be able to decode after the fact (in case processes exit or we
need to do post-processing symbol resolution).

For the podman case, that is $some_path mapped to root (/), generally
speaking. For flatpak though, that would have two mappings, one for
/app and another for /usr (possibly more).
2021-02-25 13:43:09 -08:00
afafeacc70 tests: avoid use of file that changes in test case
It turns out that /proc/cpuinfo changes out from under us rather frequently
and that makes it a bad use-case for a unit test. This uses meson.build
which presumably wont change while running the tests.
2021-02-24 17:41:09 -08:00
937e162472 tests: fix environment for running tests
These should not be in quotes so that we can build actual file paths
from them.
2021-02-24 17:39:35 -08:00
843585e00d cursor: handle NULL readers gracefully
Fixes #55
2021-02-23 15:33:51 -08:00
620f1f0ff0 build: fix build warnigns with Clang 2020-08-14 12:57:50 -07:00
16b7cb0a96 tests: include <errno.h> where appropriate 2020-08-08 10:50:56 -04:00
e8790bc3d6 build: Add more Meson options for disabling parts of the build
This is all aimed at making it so that sysprof can be built as a
subproject within GLib, with only `libsysprof-capture-4.a` being
produced as output.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-03 22:01:33 +01:00
3c7b76c6ba build: Move Meson dependency() calls to where they’re used
This avoids making the project depend on all its dependencies, some of
which are optional, when being built as a Meson subproject.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-03 22:01:33 +01:00
97ddf5a0cc libsysprof: port UI to new ABI
Some minor changes were necessary so that we could change the ABI in
libsysprof-capture to be free from GLib (and therefore used by GLib).

This also adds some wrappers for capture API in libsysprof so that we
can continue to use GError from UI code.
2020-07-03 22:00:34 +01:00
45c8c95706 libsysprof-capture: Drop GError usage from SysprofCaptureWriter
Use `errno` instead, which is icky, but given that all of the failure
modes are from POSIX I/O functions, it’s at least in keeping with them.

This is a major API break.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
2020-07-03 22:00:34 +01:00
e19d70bca0 libsysprof-capture: Drop GError usage from SysprofCaptureReader
Use `errno` instead, which is icky, but given that all of the failure
modes are from POSIX I/O functions, it’s at least in keeping with them.

This is a major API break.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
2020-07-03 22:00:34 +01:00
6a45f020f7 libsysprof-capture: Add SysprofCaptureJitmapIter to replace GHashTable
Change `sysprof_capture_reader_read_jitmap()` to return a `const
SysprofCaptureJitmap *` (like the other `read` functions), and add a new
`SysprofCaptureJitmapIter` type to allow easy iteration over the jitmap.

This allows a use of `GHashTable` to be removed from the API. It breaks
the libsysprof-capture API and ABI.

All the callers iterate over the jitmap rather than looking up elements
by key. If that functionality is needed in future, additional API can be
added to allow it on `SysprofCaptureJitmap`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
2020-07-03 22:00:34 +01:00
75b69d0a89 libsysprof-capture: Rewrite list_files() to avoid GHashTable/GPtrArray
This changes its API and ABI: it now returns an allocated array of const
strings, rather than an allocated array of allocated strings.

The call sites in the source tree have been adjusted accordingly.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
2020-07-03 22:00:34 +01:00
5636bbf4f0 libsysprof-capture: Use stdbool instead of gboolean
Another step towards dropping GLib as a dependency of
libsysprof-capture.

Unlike the previous commit which replaced GLib integer types with the
bitwise equivalent C standard types, `stdbool` is potentially a different
width from `gboolean`, so this is an ABI break.

It therefore involves some changes to callback functions in the tests
and tools, and in libsysprof.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
2020-07-02 21:07:11 +01:00
d1a8dc40f5 tests: Add missing dependency on glib-2.0
It has previously been implicitly pulled in by libsysprof-capture, but
that will change in future.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
2020-07-02 21:07:11 +01:00
5dea152c77 tests: use G_GSIZE_FORMAT instead of G_GUINT64_FORMAT for gsize
This fixes the build on 32-bit platforms with -Werror-format

fixes #32
2020-03-07 10:45:17 +01:00
82c2ee5a73 build: fix building in jhbuild
Not sure why we are hitting this, but we are so just force it to work.
2020-03-06 13:43:15 -08:00
d34e277a6a tests: initialize allocated value to 0 2020-02-24 15:27:58 -08:00
f1322de9e6 tests: add median to calculation 2020-02-24 15:15:20 -08:00
a9dcb58ca6 tests: add in-tree testing tool to list allocations within mark
This would be nice to have more generally useful via filters in the
allocations view. But for now, just make something simple work.
2020-02-24 15:11:01 -08:00
1017fed467 tests: add missing locale.h include 2020-02-20 10:59:57 -08:00
4fd2068367 tests: ensure we sort by time after pid/tid 2020-02-18 12:00:08 -08:00
521024d51f tests: add tool to list total/temp/leaked allocations
This is just a quick example of how to find temporary allocations.
2020-02-18 11:56:51 -08:00
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
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
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
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