The macros don’t seem to make things sufficiently much clearer that it
makes sense to provide them.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Helps: #40
This imposes an arbitrary limit of 2048B on the length of printf-ed log
messages, but is otherwise equivalent.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Helps: #40
libsysprof-capture no longer calls any of the GLib logging functions
which make use of it.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Helps: #40
Another step away from GLib. This changes the OOM behaviour of the
library — previously it would immediately `abort()` on OOM. However, it
seems likely that given the small number of allocations
libsysprof-capture does, it should be able to recover from an OOM
situation more gracefully than larger libraries can — so the new
implementation tries to do that.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Helps: #40
If the system doesn’t provide `strlcpy()` (FreeBSD does, Linux doesn’t),
use an inbuilt copy instead.
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
This is an almost entirely mechanical* conversion from (for example)
`gint` → `int`, `guint8` → `uint8_t`, etc.
It is not entirely complete, as many GLib functions are still used in
libsysprof-capture, which necessitate some use of GLib types.
It also avoids renaming `gboolean` → `bool` as that’s a slightly more
controversial change which will happen in the following commit.
*Code was manually realigned afterwards.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Helps: #40
This is a convenience function to call sysprof_collector_log() while also
formatting the message.
Ideally we'd be able to avoid the string format if we are not currently
collecting data, but that can be left for a future commit. We don't have
recursive locks so we need to duplicate the structure setup.
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 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.
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.