Commit Graph

511 Commits

Author SHA1 Message Date
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
d2fd6c4a7f libsysprof: categorize GTK shader loading 2024-03-04 11:39:56 -08:00
2e28a45929 libsysprof: be explicit with integer comparison 2024-03-03 14:35:47 -08:00
b4a592a020 Add test-cases that include sysprof headers into C++ code
Reproduces: https://gitlab.gnome.org/GNOME/sysprof/-/issues/114
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-02-24 11:41:56 +00:00
36f4988ecc Conditionalize uses of C99 restrict keyword
This is part of C99, but not part of Standard C++, so it can't be used
unconditionally if the sysprof headers might get included into C++ code.

Resolves: https://gitlab.gnome.org/GNOME/sysprof/-/issues/114
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-02-24 11:41:56 +00:00
39d0579b05 libsysprof: relax number of device numbers
Fixes #113
2024-02-10 16:27:45 -08:00
15585d2803 libsysprof: improve symbol categorization a bit 2024-02-08 14:47:44 -08:00
802c298e95 libsysprof: allow hex for device major/minor
Noticed by Fabrice Bellet in #104
2024-02-06 12:02:40 -08:00
9eca469402 categories: mark gtk_css_style_snapshot_* as as paint 2024-01-20 08:04:00 -08:00
0bed511430 libsysprof: demangle rust kernel symbols 2023-11-06 20:04:49 -08:00
d852115de1 libsysprof: fallback to software perf counters
If we fail to enable hardware perf counters, fallback to software perf
counters. This fixes Sysprof to work on Fedora Asahi.
2023-10-23 22:27:04 +00:00
e5e57f8ff5 libsysprof: fix format-literal warning
Fixes #99
2023-10-06 09:08:56 -07:00
403704293b libsysprof: fix unused warning 2023-10-06 09:08:38 -07:00
37c2a527b4 libsysprof: be more defensive against oddly formed containers
If we get a container file that is in a format we don't quite understand,
avoid crashing and just bail. That will likely result in the inability
to symbolize properly, but better than crashing.

Fixes #100
2023-09-26 17:27:53 -07:00
45f88e3586 libsysprof: track some mutter abi changes 2023-09-07 19:19:02 -07:00
5dc4e83307 libsysprof: ignore swapper/# scheduler details
We "know" that the swapper runs between each process inherently so no need
to really include that in the scheduler details. It just clutters up the
event timeline. Without it, we're more likely to see patterns in the
scribbles.
2023-09-07 13:18:41 -07:00
6b34ea2118 libsysprof: fix merging of similar processes
We want the "similar process" key to be the argv[0] or something close
to it so that we can coalesce across processes with different arguments.
2023-09-01 14:26:10 -07:00
5f94e09f9c libsysprof: avoid duplicate process records
We want the first process record, but subsequent records should
be ignored, except that we want to take the appropriate comm[]
action from them.
2023-09-01 14:14:25 -07:00
30123284b6 libsysprof: use whole cmdline for process name
This is just more useful than artificially truncating it.
2023-09-01 13:35:39 -07:00
187bed76f4 libsysprof: avoid await() on non-fiber
That is fine to do when the futures are finished, but in this case one
might still be in-flight. Also, wait for all futures to complete before
processing them. Use a finally() block so we can check even if there are
errors.
2023-08-31 15:21:48 -07:00
5c489a4499 libsysprof: avoid an extra string copy 2023-08-31 14:16:17 -07:00
4a668f6860 libsysprof: ignore empty paths 2023-08-31 14:15:57 -07:00
453b3c3f24 libsysprof: fix some unused variables 2023-08-31 14:15:49 -07:00
b2ed132b12 libsysprof: typo fix 2023-08-31 14:14:48 -07:00
64bc9e42ba libsysprof: include binary-path for fallback symbol 2023-08-31 13:25:59 -07:00
9d30b8612c Merge branch 'rust_demangle' into 'master'
libsysprof: Support demangling rust symbols using the v0 scheme

See merge request GNOME/sysprof!78
2023-08-31 18:44:15 +00:00
3994635a2a libsysprof: Support demangling rust symbols using the v0 scheme
This doesn't add support for the legacy symbol mangling scheme which is
currently the default pending support in tools for the v0 symbol
mangling scheme. The legacy symbol mangling scheme is similar enough to
C++'s symbol mangling scheme that demangling them using the C++
demangler generally produces readable symbols. The v0 scheme is entirely
custom and due to backreferences and encoding all generic arguments not
very readable when mangled, so supporting it is more important than
supporting the legacy scheme.
2023-08-31 19:41:16 +02:00
fa8858ebcf libsysprof: add helper to list functions by sample hits 2023-08-30 16:27:50 -07:00
85e085b975 libsysprof: try both short and long-form debubdir
While fixing things for Flatpak (which have a path deduplicating some
of the path parts) works there, it breaks locating the debuglink in
other places such as GNOME OS.

This tries both forms, using the long form first and then the short
form second, since Flatpak is likely a subset of everything that needs
to be located.
2023-08-30 16:27:50 -07:00
2dc6b1b7a5 libsysprof: truncate common prefix using debug dir
If we have a path like /app/bin/gnome-builder and the debug prefix is
/app/lib/debug then we don't want to end up with /app/lib/debug/app/bin
as the real data directory is /app/lib/debug/bin.

This often works with /usr because /usr/lib/debug/usr can link back to it's
parent. But we should try to do the right thing instead of relying on that
anyway.
2023-08-29 13:41:49 -07:00
6ed1317012 libsysprof: avoid some GError creation 2023-08-29 13:40:06 -07:00
9839d18238 libsysprof: include /app/lib/debug debug dir 2023-08-29 13:21:47 -07:00
b46fe4dd75 libsysprof: allow listing traceables from a node
This will allow use from the flamegraph which does not use
SysprofCallgraphFrame objects.

Related #95
2023-08-29 11:26:41 -07:00
480543fe87 libsysprof: add SysprofDocument:busy property
This currently only toggles on/off when a callgraph is being generated or
the document is being saved.

See #94
2023-08-29 09:51:24 -07:00
f3b4e1ca92 libsysprof: propagate devices to processinfo
We need access to this from the process info but can share the instance.
It sucks to walk the hashtable here, but the alternative is to make these
recursive so that we can check a parent mount namespace.

Until then, take the hit and iterate all the pids to populate them with
the additional device.

Related GNOME/gnome-builder#2090
2023-08-28 21:56:56 -07:00
7d17e29f39 libsysprof: ignore irq/ kernel tasks 2023-08-28 20:47:58 -07:00
0539497886 libsysprof: attempt to new spawned process information
If a new process is spawned after the recording has started (processes
spawned *by* sysprof are done before recording starts) then try to extract
information about that process and append it to the recording.

The goal here is to get enough process information to actually decode the
process without creating fork()/exec() amplification.

Related GNOME/gnome-builder#2090
2023-08-28 17:27:18 -07:00
31547de795 libsysprof: rename follow_fork() to follow_process()
This is more of what we want to be doing anyway, we don't care about all
the forks in existence.

Additionally, include the comm[] with the pid so that instruments can take
action based on it.
2023-08-28 17:24:27 -07:00
c4e96bb314 libsysprof: add flag to ignore kernel processes 2023-08-28 15:03:56 -07:00