While I'm not thrilled to add new frame types for every sort of thing, I
think having this will be relatively useful so we can improve decoding
operations.
This adds SysprofCapturePidRoot which lets us specify a root directory
on the host system for which is the real root (/) of the PID. This can
be useful when reconstructing overlays for containers and you need to
direct access to alternate roots.
The layer gives us some ability to try to deal with overlayfs, albeit at
a very rudimentary level. In most cases I anticipate we just deal with
the main root and ignore overlays until necessary.
All three of these structs are already defined in
`sysprof-capture-types.h`, which is included from these three headers.
Drop the duplicate definition to silence the Clang warning:
```
In file included from /opt/gnome/install/include/sysprof-4/sysprof-capture.h:63:
/opt/gnome/install/include/sysprof-4/sysprof-capture-cursor.h:67:38: warning: redefinition of typedef 'SysprofCaptureCursor' is a C11 feature [-Wtypedef-redefinition]
typedef struct _SysprofCaptureCursor SysprofCaptureCursor;
^
/opt/gnome/install/include/sysprof-4/sysprof-capture-types.h:98:41: note: previous definition is here
typedef struct _SysprofCaptureCursor SysprofCaptureCursor;
```
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
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
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
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
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
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).
This allows embedding the static capture library without having to deal
with license incompatibility while retaining the patent clause. We want
as many consumers of the format as makes sense without the restriction
of what kind of app/library/tooling they are.
The application, sysprofd, libsysprof, and libsysprof-ui continue to be
GPLv3+.
As we gain in usage, we need to be more careful about using a prefix
that will not collide with other symbols. So version 3 of our ABI will
change to using Sysprof/SYSPROF/sysprof as the various prefixes.
The soname/api version bump will happen later on this branch so that
things are easier to test up until then.