This allows Meson to associate the pkg-config module with the "main"
library that it represents, in an unambiguous way.
Signed-off-by: Simon McVittie <smcv@debian.org>
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>
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.
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
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
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
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
As preparation for dropping the GLib dependency from libsysprof-capture,
move the `GSource` which links a `MappedRingBuffer` to a `GMainContext`
from libsysprof-capture to libsysprof.
This requires adding one new piece of API to libsysprof-capture to check
whether the `MappedRingBuffer` is empty.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Helps: #40
In preparation for dropping the GLib dependency from libsysprof-capture,
move the autocleanup definitions up to libsysprof. Add a new header for
them.
This is slightly awkward in the tools, which depend on
libsysprof-capture but not libsysprof. Rather than make them depend on
libsysprof (which might be disabled at configure time), include the
`sysprof-capture-autocleanups.h` file between source directories.
`SYSPROF_COMPILATION` needs to be defined for this to work.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Helps: #40
It has previously been implicitly pulled in by libsysprof-capture, but
that will change in future.
Correspondingly, add some missing `glib.h` includes.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Helps: #40
We can't get all the symbols here because of -Bsymbolic on the glib
library, but we can get the higher level bit. And if we're blocking for
a period of time, it can help track things down to know we block for
longer time periods.
The kernel symbol resolver requires access to sysprofd, which might not
be available in some contexts (such as when no polkit agent is available).
This allows that to continue working by disabling the kernel with the
user-only setting.
If we're running on a GCC older than 4.9, then we won't have the
stdatomic.h available. We can just use a full barrier instead using
__sync_synchronize() to get the same effect, albeit slower.
This is useful to find allocations free'd right after they were created.
A temporary allocation is currently defined as a free() right after an
allocation of that same memory address. From a quick glance, that appears
to be similar to what I've been seeing in heaptrack all these years.
In the long term, I'd expect we can do something more useful such as
"freed from similar stack trace" since things like g_strdup_printf()
would obviously break important temporary allocations.
We might get this information from multiple sources (such as Linux's perf
or the proc data source). So only add this information once to avoid
having additional data we don't care about.
This also helps ensure we get a proper tree for the callgraph without
splitting things between updated cmdline information.
We want to be backtracing directly into the capture buffer, but also need
to skip a small number of frames.
If we call the backtrace before filling in information, we can capture to
the position *before* ev->addrs and then overwrite that data right after.
This seems to be significantly faster than doing the manual stepping. A
quick look shows that it has a number of special cases which we'd have
to duplicate, so best to just use it directly.