Commit Graph

200 Commits

Author SHA1 Message Date
3c5540047f build: bump for development 2022-04-01 12:41:14 -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
4758fb42ce capture: add pid-root frame type
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.
2021-02-24 17:56:37 -08:00
ff22417de9 build: add missing 3.40 version macros 2021-02-24 17:41:20 -08:00
adf8a3cd6a version: relicense with the rest of sysprof-capture 2021-02-24 09:39:01 -08:00
843585e00d cursor: handle NULL readers gracefully
Fixes #55
2021-02-23 15:33:51 -08:00
77a340e3f6 build: use specify pic for static libsysprof-capture 2021-02-19 09:37:24 -08:00
b8950c9409 platform: handle some differences on macOS 2020-11-16 14:13:50 -08:00
f18fbe5ae8 build: various fixes for compiling on macOS 2020-11-16 14:01:02 -08:00
8f8ce85327 libsysprof-capture: Drop duplicate struct typedefs
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>
2020-11-16 15:15:26 +00:00
f0303f4b68 meson: Fix pkgconfig generation
This fix error when gio is a subproject, when there is pc file
assotiated for objects in libraries_private meson automatically promote
them to requires.

Also remove some values that are already the default.
2020-10-01 10:15:38 -04:00
b39a43d218 capture: dont leak listed files strings
Fix leak introduced by #50
2020-09-28 15:56:36 -07:00
28bb526603 capture: fix sysprof_capture_reader_list_files()
This needs to stash the string pointers internally so that we can maintain
ABI and still fix the issue at hand.

Fixes #50
2020-09-28 15:53:54 -07:00
254b9f8f69 capture: fix compilation on Clang 11
Fixes #48
2020-09-16 12:41:09 -07:00
2260945e8f Merge branch 'wip/issue49' into 'master'
libsysprof, libsysprof-ui: Generate pkg-config dependencies

Closes #49

See merge request GNOME/sysprof!38
2020-09-16 18:09:27 +00:00
04b6fdfcbe libsysprof, libsysprof-ui: Generate pkg-config dependencies
Otherwise, using libsysprof-ui will usually fail because <dazzle.h>
is not added to the search path.

Resolves: https://gitlab.gnome.org/GNOME/sysprof/-/issues/49
Signed-off-by: Simon McVittie <smcv@debian.org>
2020-09-16 10:48:04 +01:00
68c50ba869 build: Pass libraries to pkgconfig.generate as a positional argument
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>
2020-09-16 10:47:22 +01:00
088408c085 sysprof-capture-condition: always return even if unreachable
Fix the problem with -Werror=return-type
2020-09-15 20:51:28 +07:00
429223635e compat: add TEMP_FAILURE_RETRY compatiable implementation 2020-09-15 20:30:48 +07:00
50439c9ca9 compat: add fallback implementation for reallocarray(3) 2020-09-15 20:30:48 +07:00
9ce6353ea4 collector: add missing config.h include
This was causing symbols to not be exported when used within libsysprof.
2020-08-21 13:45:50 -07:00
7b74c73205 capture: use plural naming for request_counters() 2020-08-19 15:14:53 -07:00
361b29a459 capture: add sysprof_collector_is_active()
This can be used to check if a collector is actively running.
2020-08-19 15:12:19 -07:00
61be0a0455 capture: add API to request a counter id 2020-08-19 15:09:52 -07:00
b913de8882 capture: add counter define/set collectors 2020-08-19 13:43:30 -07:00
c7e0e11fc2 captur: cleanup headers 2020-08-19 13:43:30 -07:00
691b6ef342 macros: simplify static assert fallback to use __COUNTER__
It is rather annoying that the other sizeof form doesn't work with Clang.
This at least gets things working (assuming you have __COUNTER__ support)
which most things we care about do at this point (including MSVC).
2020-08-14 12:59:29 -07:00
620f1f0ff0 build: fix build warnigns with Clang 2020-08-14 12:57:50 -07:00
cae28263ff build: remove 0.54 meson feature
Since this causes us to fail to build with GTK CI
2020-07-28 11:09:52 -07:00
2769ad9aaf build: give access to profiler path from dependency 2020-07-28 10:27:04 -07:00
462e08270e libsysprof-capture: Don’t unset SYSPROF_CONTROL_FD
By design, it needs to be usable from multiple threads so they can each
request a thread-local mapped ring buffer. This becomes particularly
obvious if you want to send `sysprof_collector_mark()`s from two
libraries (say, GLib and libsoup); the first thread/library to call
`sysprof_collector_mark()` will win.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-17 19:12:01 +01:00
72d70b8514 sysprof-capture: fix typo 2020-07-07 07:50:58 -07:00
555ec04e32 macros: check for C++ 14 feature macros 2020-07-06 16:09:03 -07:00
1c32c1ece5 libsysprof-capture: Add a missing string.h include
It’s needed for `strdup()` which is now used in a macro in this header.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-06 11:27:44 +01:00
eae4eb4ad7 build: Drop redundant _GNU_SOURCE definitions
It’s defined in `meson.build` now. See the previous commit.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-06 11:27:28 +01:00
57183ab8e2 macros: add static assert helper
So that we can use this from gnu99 such as from GTK.
2020-07-04 16:11:31 -07:00
50d33452ab macros: add helper to check for gcc version 2020-07-04 16:11:06 -07:00
6fde9c5ce6 libsysprof-capture: Add sysprof_collector_mark_{v,}printf() methods
These are just like `sysprof_collector_mark()`, but do the printf
formatting of the message internally, and only once the collector has
been fetched — so there is no overhead from the printf if sysprof is not
enabled at runtime.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-03 22:01:33 +01:00
d6e8d39292 build: Add subproject support for libsysprof-capture
This will be used to build libsysprof-capture as a subproject within
libglib, with the symbols from libglib being left unresolved until the
static libsysprof-capture is linked into libglib.

When built as a subproject, libsysprof-capture won’t install anything.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-03 22:01:33 +01:00
484bc328ee collector: set unlikely for pthread_once() 2020-07-03 22:00:34 +01:00
5d20c3f6cf collector: disable re-entrancy during initialization
When creating a new collector, we need to prevent the following
call to sysprof_malloc0() from re-entering us into the same
position.
2020-07-03 22:00:34 +01:00
608582d3c4 libsysprof-capture: Drop GLib dependency
None of the code uses it any more. This means that `libsysprof-capture.a`
can now be used within `libglib-2.0.so` for collecting main loop
statistics.

Brought to you by Opeth’s Deliverance on repeat.

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

Fixes: #40
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
fde278fb7f libsysprof-capture: Drop sysprof_capture_writer_set_flush_delay()
It was unused anywhere within sysprof.git, and couldn’t be modified to
drop its GLib dependency while still retaining its functionality.

If it’s still needed, it’ll have to be reimplemented in libsysprof.

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

Helps: #40
2020-07-03 22:00:34 +01:00
cef698e658 libsysprof-capture: wrap strdup to be NULL-safe 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
13b1e79901 libsysprof-capture: Use POSIX socket functions rather than GSocket
This should be equivalent.

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

Helps: #40
2020-07-03 22:00:34 +01:00
5a2144e254 libsysprof-capture: Port from GLib to pthreads for locking and once-init
Another step towards dropping the GLib dependency.

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

Helps: #40
2020-07-03 22:00:34 +01:00