Commit Graph

549 Commits

Author SHA1 Message Date
aaf4cc3d22 sysprof-power-profile: Use UPower DBus API
Since some time the power-profiles-daemon project has been moved under
the upower umbrella and renamed its API to follow that.

While the legacy name is still supported, there are plans to not support
it anymore in future [2]. So let's update gnome-shell code to use the
current main name instead.

[1] https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/merge_requests/148
[2] https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/merge_requests/166
2025-02-10 01:19:39 +01:00
4999ae8598 libsysprof: add SysprofSymbolsBundle:enable-debuginfod property
This adds a property instead of the global to key off if the debuginfod
resolver should be used to bundle symbols into the capture at the
augmentation point post-capture.

This defaults to off because we do not want to auto-include them when
recording from the GTK UI (as we'd spend a bunch of time not showing a
window) but we do want to include them from sysprof-cli as that could
be running on a remote machine/container/vm with different debug URLs.

In the future, that could be improved with a different UI flow though.

Related: #130
2025-02-06 22:23:24 -08:00
91c8bc7105 libsysprof: Add debuginfod toggle for sysprof-cli inside libsysprof
Signed-off-by: varun-r-mallya <varunrmallya@gmail.com>
2025-02-06 00:59:34 +05:30
202129e3b5 sysprof: Enable debuginfod option in tests
Signed-off-by: varun-r-mallya <varunrmallya@gmail.com>
2025-02-03 22:25:45 +05:30
0c5f0c3c65 sysprof: Add debuginfod toggle on greeter and make it persist 2025-02-01 02:37:16 +05:30
b90ec5fd9f sysprof: fix memory leak in GDateTime 2025-01-27 16:31:30 +05:30
1a497564e0 sysprof:fix UTC recording time to local 2025-01-25 01:18:58 +05:30
0e1effcdcc libsysprof: ignore cancellable during IO parsing 2024-11-26 22:08:55 -08:00
6f5d119539 libsysprof: guard message string and dup contents 2024-11-26 21:46:54 -08:00
4bd113402b libsysprof: avoid UB on bsearch 2024-11-25 16:24:39 -08:00
c6cb5473ae libsysprof: add serialize symbols helper 2024-11-25 14:15:58 -08:00
105dc0d0be libsysprof: add loading helper 2024-11-25 14:15:47 -08:00
3a654ed959 recording: track DEBUGINFOD_URLS environment variable
This is handy to know in case we want to use it to find symbols after
the fact with a capture.
2024-11-14 10:49:27 -08:00
33b010f92b libsysprof: Show mark duration in tooltip
This helps (a lot!) with the Waterfall view. In fact, I cannot think
of a situation where knowing the duration (in addition to the start
and end times) won't help.
2024-11-14 13:52:29 +01: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
8995c65444 sysprof-user-sampler: implement await for FDs
This allows us to not need libdex 0.9+ for use by the sampler.
2024-11-13 15:51:34 -08:00
ea340e3c61 libsysprof: check for PERF_REG_EXTENDED_MASK availability 2024-11-08 11:43:32 -08:00
6e3e1637be libsysprof: add SysprofUserSampler for live unwinding
This instrument triggers the live unwinder in sysprofd to capture a
pre-configured amount of stack contents and CPU registers. You can use
this instead of SysprofSampler in cases where you do not have frame-
pointers but want a useful trace.

It does have a moderate amount of CPU overhead compared to just relying
on frame-pointers so keep that in mind. Generally useful on platforms
that do not have frame pointers such as CentOS.
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
fde9f5868c libsysprof: add muxer GSource
This allows copying events from a capture stream transparently into the
destination. No processing of the stream is performed, but that may change
in the future to accomidate JIT/Counter translations.

Internal only as support for upcoming live unwinding via external process.
2024-11-03 10:37:20 -08:00
d435c42666 libsysprof: actually unmap our event stream 2024-10-24 18:01:43 -07:00
c9a1b322cd libsysprof/sampler: track lost records as a counter/log
This makes it much easier to see what happened from the capture file which
may originate from a user different than the person inspecting it.
2024-10-24 12:49:48 -07:00
2838024227 libsysprof: add union for perf "lost" records 2024-10-24 12:42:55 -07:00
d5d3c71879 libsysprof: remove unnecessary address calculation
We are only fallback symbols here, which is 1 address-wide.
2024-10-23 11:54:33 -07:00
29fc388824 build: always build debuginfod symbolizer
Even if it is disabled, we want the GType enabled and part of our ABI. We
will return NULL if one is created and debuginfod is not supported or if
we failed to create a client.
2024-10-11 11:46:26 -07:00
e70a5b076c libsysprof: return NULL instance unless debuginfod works
If we are configured with support for debuginfod and it fails to initialize
or we are not configured to use debuginfod, always ensure g_object_new()
will return a NULL instance back.

This helps prevent against misconfigured instances so we do not need to
do so many checks in vfuncs as well as allowing us to have the GType be
available always even when not built with debuginfod.
2024-10-11 11:45:41 -07:00
0d8e004558 libsysprof: fix building with -Ddebuginfod=auto 2024-10-11 11:26:20 -07:00
c009532c91 libsysprof: ensure access to process info 2024-10-11 11:09:48 -07:00
d2471d4bf5 libsysprof: add debuginfod symbolizer
This is based on a debuginfod_client provided by Barnabás Pőcze in !73.
It extends it to use the new task infrastructure to elevate the download
process to the user while loading a capture file.
2024-10-10 17:12:30 -07:00
1464e3a48e libsysprof: hoist fallback symbol creation
This makes sure that we get that even when not using the Elf symbolizer
but also means we can fallback through the Elf symbolizer into the
debuginfod symbolizer.
2024-10-10 17:04:19 -07:00
25b539de54 libsysprof: add setup hooks for symbolizers
This gives the symbolizer access to the loader so we can propagate tasks
back to it.
2024-10-10 17:03:30 -07:00
50d556b13e sysprof: add SysprofDocumentTask abstraction
This provides a task abstraction to SysprofDocumentLoader so that we can
elevate information about tasks to the user interface. It also moves the
spinner to a menu button w/ popover to display those tasks.
2024-10-10 17:02:06 -07:00
1c4c266a05 libsysprof: elf: do not generate fallback names
Fallback names are only used in `SysprofElfSymbolizer` at the
moment, but it also has code to generate fallback symbols.
2024-10-09 16:37:02 -07:00
aef623cf15 libsysprof: elf: do not allow setting self as debug link
That will cause infinite recursion in `sysprof_elf_get_symbol_at_address_internal()`.
Also note that loops are still possible, this change
only prevents one way of creating loops.
2024-10-09 16:37:02 -07:00
6ab9df35ed libsysprof: Kill dbus-monitor after D-Bus capturing is done
Previously, the `dbus-monitor` process was never terminated.
Unfortunately, tying up some memory is not the worst consequence
of this: after some time file descriptors that are sent on the
bus start to accumulate. This can be especially problematic
when there are unexpected read/write ends of pipes.
2024-09-29 04:13:32 +02:00
4142472984 libsysprof: collapse recursive functions 2024-09-12 12:44:08 -07:00
15844df5b9 callgraph: use bump allocator for callgraph nodes 2024-09-12 10:52:41 -07:00
f446178796 allocator: add 16kb page bump allocator
This is a private allocator that can be used for large groups of
allocations that are tied to a specific object.

For example, the callgraph owning many nodes can use this so all the nodes
are allocated together, but also freed in a single stage ignoring all the
complex GList linked nodes among them.
2024-09-12 10:52:18 -07:00
b726f49d15 Turn polkit-agent support into an optional feature.
This simplifies deployment on embedded devices, where polkit is usually
unncessary at runtime, but pulls in quite a few otherwise unncessary
dependencies. Start to improve the situation by allowing to selectively
disable polkit-agent support at compile time, which aids in container
usage scenarios, where one wants to invoke 'sysprof-cli' from within
the container. Bypassing polkit-agent in the container is then desired,
since the host sysprofd will handle asking for permissions to enable
the tracing. It allows for a simpler setup of rootless podman
containers, avoiding UID mismatches, that lead to rejection of the
tracing enablement.

- Add a new 'polkit-agent' meson build feature, that allows to force disabling
  polkit-agent support (-Dpolkit-agent=disabled).

- Mark the 'polkit-agent' feature as enabled, by default, to reflect
  the current status (sysprof-cli did not build without polkit-agent support).

- libsysprof/sysprof-instrument.c: Build fix when polkit is not available,
  remove the unnecessary 'g_autopr(PolkitDetails) details' variable.

- Alter the sysprof-cli dependencies to only attempt to link against
  polkit-agent, if necessary. Modify sysprof-cli.c to wrap all code using
  polkit-agent in HAVE_POLKIT_AGENT blocks.
2024-08-20 20:46:11 +02:00
54295a1466 libsysprof: port GPtrArray sort to gtk_tim_sort() 2024-08-16 12:50:21 -07:00
fbab86314a libsysprof: use gtk_tim_sort() to sort jitmaps 2024-08-16 12:43:13 -07:00
e11e2e3bc8 libsysprof: use gtk_tim_sort() for kernel kallsyms array 2024-08-16 12:41:37 -07:00
9c896e0bb4 libsysprof: use gtk_tim_sort() for packed symbols 2024-08-16 12:39:41 -07:00
dde273e25e libsysprof: correct awkward double values
We still get some really crazy huge numbers from GTK for FPS, likely from
division issues. Just normalize it to zero for now.
2024-08-16 12:37:53 -07:00
cdb011b403 libsysprof: use gtk_tim_sort() for counter value sorting
This is generally faster than g_array_sort() due to all the heuristics
involved, which are likely to hold true for us with counter data.
2024-08-16 12:14:05 -07:00
836edc0c87 libsysprof: fix tracefd string for child process 2024-08-14 14:36:25 -07:00
bfe55f46b2 libsysprof: fix size to copy 2024-07-26 16:58:21 +05:30
3c655a6f3e libsysprof: add missing header for close function
This was detected by compiling against musl-libc
2024-03-18 22:18:52 +01:00
c826dc5ec8 libsysprof: mark vulkan frame as graphics 2024-03-08 14:15:28 -08:00
d7eff5864b build: ensure symbols are exported for libsysprof-6
This fixes an issue where the symbols are not getting T as they are dropped
when pulling in the static archive.

This compiles twice, but that is fine for now until we come up with something
better in the long run.
2024-03-07 14:06:05 -08:00