Commit Graph

58 Commits

Author SHA1 Message Date
ddf13ca3d8 sysprofd: remove unused code 2024-11-13 15:53:12 -08:00
083b2edbc0 libsysprof: provide unwind pipe from client
We don't need a socketpair for this. Additionally, things seem to work
better from the service when the client provides the pipe. Otherwise, when
running as a dbus service I often have issues with things getting closed
out from under us.
2024-11-13 15:51:42 -08:00
9c7ede8ad8 unwinder: wait for completion of subprocess 2024-11-13 15:46:01 -08:00
1bd79af439 sysprofd: add support for unwinding without frame pointers
This provides a new sysprof-live-unwinder subprocess that runs as root to
allow accessing all processes on the system via /proc/$pid/. It is spawned
by sysprofd with various perf event FDs and a FD to write captures to.

Ideally the capture_fd is something that will naturally error if the client
application crashes (such as a socketpair() having the peer close). This
is not enforced but encouraged. Additionally, an event_fd is used to allow
the client application to signal the live-unwinder to exit.

Unwinding is performed by looking at the modules loaded into the target
pid and using libdwfl to access DWARF/CFI/etc state machinery. Stack data
does not touch the disk as it exists in a mmap buffer from perf and is
then translated into a callchain and sent to the Sysprof client.

Unwinding occurs as normal post-mortem though is improved through the use
of debuginfod to locate the appropriate symbols.
2024-11-03 10:59:05 -08:00
39b96f47f5 libsysprof: add support for stack/regs options in attr
This requires a coordinating sysprofd that knows how to handle reading the
new attributes. Setting these fields will allow snapshotting the contents
of the stack and registers to do offline unwinding.

Also make the conversion to GVariant available outside the module so that
we can consume it for live unwinding.
2024-11-03 10:59:00 -08:00
a15595026d Fix links 2024-03-15 19:58:59 +01:00
95a3177623 Revert "meson: remove unnecessary join_path() with get_option('prefix')"
This reverts commit 602a4d7fa7.

You absolutely must have these paths expanded when in use in system files.
2023-08-01 19:21:41 -07:00
602a4d7fa7 meson: remove unnecessary join_path() with get_option('prefix')
Meson will expand the paths for you.
2023-07-28 14:04:48 -05:00
f40587a38a meson: remove unnecessary argument nesting 2023-07-28 14:03:51 -05:00
f93767cfb2 meson: use variables for gio-2.0, glib-2.0, and gio-unix-2.0 2023-07-28 14:00:04 -05:00
2800a45939 sysprofd: remove version 2 policy
This existed for long enough to transition, no more need for it.
2023-07-27 12:22:31 -07:00
d1ae6b7b4a sysprofd: remove legacy v2 bits 2023-07-24 16:33:04 -07:00
29772e7ac2 sysprofd: add proxy support for mmap2/build_id
We will want to be able to open perf event streams with these options so
that we can get the build-id extracted from an ELF without having to rely
on parsing it at resolution time.

Additionally, it could give us an option for live-decoding at some point
in userspace without having to write the major DWARF capture data to disk.
2023-07-24 15:30:16 -07:00
dbb7833cbf libsysprof: join libsysprof-analyze and libsysprof-profile
This brings together the two libraries back into one now that the whole
design is pretty well sorted out. They depend on roughly the same libraries
anyway and it's way easier of the single library can both read and write
the capture files (along with bringing in libsysprof-capture symbols in
a single place).
2023-07-19 17:40:41 -07:00
8078ecc60a build: fix some various build options 2023-07-19 12:13:27 -07:00
8dd7478e96 janitorial: move dbus service files into sysprofd
This is the only place they are really used directly, so keep them there.
2023-07-18 16:13:01 -07:00
1fba250444 build: drop legacy v2 service and simplify build system
This removes -Dagent and just uses -Dtools as it only affects sysprof-cli
and sysprof-agent. We still need to patch sysprof-cli for recent changes
as we did for sysprof-agent though.

Additionally, we haven't used the v2 service in forever, so drop that as
I can't imagine anyone has been using it.
2023-07-17 15:11:10 -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
9c98b10fee build: remove deprecated meson feature 2022-04-01 16:56:32 -07:00
6f11fcf510 sysprofd: fix warning 2021-03-22 14:55:04 -07:00
4777e74862 sysprofd: ftruncate() when overwriting files
This is really only used for proc like files which are generally a single
page, but might as well start from zero.
2021-02-24 13:03:24 -08:00
667180cbc8 sysprofd: add API to set perf_event_paranoid
This will allow us to get more information on demand when running the
profiler without endless tweaking by end users.
2021-02-24 11:26:10 -08:00
e647a83557 turbostat: fix ref count check 2020-08-21 13:15:38 -07: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
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
d89a689ab4 sysprofd: remove use of GAtomicRCBox
Using an embedded ref count allows us to backport to older operating
systems for which GLib is restricted to 2.56.
2020-02-20 11:01:02 -08:00
b624ec8809 build: track changes to GLib and gdbus-codegen
GLib is already doing this, which broke a number of auto-generated code.
This tracks those changes and manually sets the annotations so that we
are guaranteed to get this behavior.

We'll need to fix other uses (such as in Mutter), but we have to do that
already because of the change in GLib.

Fixes #17
2019-10-30 14:46:20 -07:00
5ff150d365 turbostat: remove prctl
This won't be reliable since our handlers are run on threads.
2019-07-31 13:20:05 -07:00
f9f7e29e54 turbostat: use kill() to force sample by turbostat
This is more reliable than using a PTY and allows us to use a regular
pipe to output data into a GIOChannel. This also changes the design to
use async IO watches for sample delivery.
2019-07-31 13:08:42 -07:00
a3d0ddc231 sysprofd: add RAPL profiler on the org.gnome.Sysprof3 D-Bus peer
This allows consumers to get a RAPL profiler object on the D-Bus at
org.gnome.Sysprof3 with path /org/gnome/Sysprof3/RAPL. This can be used
by the clients to record extra power statistics.

It requires the `turbostat` program to be installed, and is provided in
packages such as `kernel-tools` on Fedora. Distributions may want to
ensure that is available as a dependency of Sysprof, but it is not
strictly required.
2019-07-30 15:29:43 -07:00
b8898fceea service: remove unnecessary code
This is fixed in glib now.
2019-07-30 15:17:32 -07:00
09c457c880 sysprofd: implement org.gnome.Sysprof2 compatability API
This allows the new sysprofd to service requests for older clients
expecting to talk to or.gnome.Sysprof2.
2019-06-25 14:27:43 -07:00
fc745767d4 governor: add daemon API and helpers to set CPU governor 2019-06-14 08:03:37 -07:00
ce6ba83ff3 sysprofd: remove debug code 2019-06-05 10:50:52 -07:00
7fd8ca4c8f sysprofd: make sysprofd exit after 120 seconds of inactivity 2019-05-29 15:13:01 -07:00
c368da09de libsysprof-ui: allow restricting remote proxy 2019-05-29 15:13:00 -07:00
931112b195 sysprofd: actually check authorization result 2019-05-29 15:13:00 -07:00
9d72203687 sysprofd: add API to get a FD for a file in proc
This is useful for optimized parsing of proc files such as necessary by
the memory source to seek() back to the start (instead of re-opening a
new file).
2019-05-29 15:13:00 -07:00
dfdebf115f sysprofd: add comm and do some postprocessing 2019-05-29 15:13:00 -07:00
ecbca06013 sysprofd: add hook to postprocess cmdline 2019-05-29 15:13:00 -07:00
3310d83257 sysprofd: use add_value()
Otherwise we need another GVariantBuilder
2019-05-29 15:13:00 -07:00
a318a135c6 sysprofd: fix include 2019-05-29 15:13:00 -07:00
d6d4c0d140 sysprofd: start on optimized getprocessinfo helper
Calling all the individual function calls to get process information would
be considerably inefficient, so we can coalesce a bunch of that and change
our process-model implementation (and proc source) to use this.
2019-05-29 15:13:00 -07:00
200f7484d1 sysprofd: remove consistency check
We can try and just let the syscall tell us what happened.
2019-05-29 15:13:00 -07:00
aafcc0a57a sysprofd: remove debug code 2019-05-29 15:13:00 -07:00
623d7ad027 build: cleanup dependency checking
We always require polkit now, so that we can fallback when we fail to
communicate with the peer.
2019-05-29 15:13:00 -07:00
0b284329d4 sysprof3: start moving API towards sysprof-3 2019-05-29 15:13:00 -07:00
1bd0107c54 build: fix various includes for older GCC 2019-05-29 15:13:00 -07:00
cd3b4d6538 src: use helpers and add group_fd to remote API 2019-05-29 15:13:00 -07:00
427a4ca79d src: add helpers for common clinet/service side utils 2019-05-29 15:12:59 -07:00