Commit Graph

2573 Commits

Author SHA1 Message Date
21ebc8f1af sysprof-cat: use single finally to exit main loop 2024-10-23 11:40:54 -07:00
6d10a4337f sysprof-cat: load document asynchronously from load fiber 2024-10-23 11:40:54 -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
788b1995b9 libsysprof-capture: add version macros for 48 2024-10-09 21:42:36 -07:00
fcfd8c1d68 sysprof: update to AdwSpinner 2024-10-09 16:39:50 -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
7b7317ead2 sysprof: Use PRIi64 instead of G_GINT64_FORMAT 2024-10-09 17:36:49 +00:00
5707ed0cac sysprof: ignore various libadwaita deprecations
This is our only option for situations where we would have no other top-
level window, so just ignore them for now.
2024-10-02 12:56:12 -07:00
92a1179982 sysprof: fix various GTK deprecations 2024-10-02 12:56:12 -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
7c93149315 Introduce sysprof-cat
It's a simple CLI tool that dumps the contents of a Sysprof capture
file in a syntax inspired by GTK's render node syntax.

It prints metadata, the callgraph, marks, and counters. Other fields
may be added as needed, but for now this is sufficient for inspecting
WebKit captures.

There are CLI args for not printing particular groups, so that we can
filter out what we need.
2024-09-26 13:11:55 -03:00
ed9bac07d0 sysprof: Match "webkit" for counters as well
WebKit may start introducing counters for page rendering, and it's
great to be able to see them in Sysprof UI :)
2024-09-25 15:37:37 -03:00
b8781e733c flame-graph: trim off some whispies 2024-09-12 13:07:51 -07: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
eca993b42c preload: add static assertion with offsetof() check 2024-09-12 09:26:13 -07:00
c228634fcb libsysprof-capture: handle unwind length < 0 gracefully
Also do the snapshot before setting up frame so that unwinders can do
tricks to use extra space before the addr location.
2024-09-12 09:23:10 -07:00
23299b0746 Set icon for the window 2024-08-29 16:28:43 +02:00
10217bb0e2 libsysprof-capture: fix set_fd_blocking()
It was missing an include for the define and the variable was flat out
wrong when porting.

Fixes: #124
2024-08-22 08:33:45 -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
b06c08c64e sysprof: use gtk_tim_sort() to sort rectangles for bsearch 2024-08-16 12:46:36 -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
d67adc598b sysprof: fix upper bound for graphics charts 2024-08-16 12:01:51 -07:00
6d9a8d490b sysprof: add gio/mutter to graphics section 2024-08-16 11:13:07 -07:00
265eeeb12f sysprof: Also render labels for instant marks
This was an oversight from the original commit!

Render labels for instant marks as well. The PangoLayout is shared
between ranged and instant marks, and therefore moved to an earlier
point in the function.
2024-08-15 17:52:01 -03:00
cf7dfbb22d sysprof: use black when not using dark mode
This extremely unclever hack works around the styling issue in light mode
from !98 as mentioned at:

  https://gitlab.gnome.org/GNOME/sysprof/-/merge_requests/98#note_2196955

It just uses black if we're out of rect and not in dark mode.
2024-08-15 13:16:53 -07:00
32690091ef sysprof-cli: set GJS_ENABLE_PROFILER 2024-08-14 14:40:39 -07:00
836edc0c87 libsysprof: fix tracefd string for child process 2024-08-14 14:36:25 -07:00
1a19aba570 sysprof: use AdwAboutDialog 2024-08-14 13:55:11 -07:00
ec2b207191 Merge branch 'gbsneto/mark-name-in-waterfall' into 'master'
sysprof: show mark name in waterfall marks

See merge request GNOME/sysprof!98
2024-08-07 20:34:55 +00:00
444b4fff75 sysprof: Adjust font size slightly
Makes the Waterfall view look better.
2024-08-07 14:05:59 -03:00
43dd3f5062 sysprof: Render label outside rect if it doesn't fit
This allows reading the mark name even when it is too small to fit any
text.
2024-08-07 14:05:59 -03:00
aa15d5f49f sysprof: Don't initialize GValue before evaluation
GtkExpression infrastructure already initializes the GValue.

Fixes a warning introduced by the previous commit.
2024-08-07 11:32:29 -03:00
7cd51d1502 sysprof: show mark name in waterfall marks
This makes is much easier to inspect waterfall marks, since we can spot
at a glance which marks are there, without having to hover each mark
individually with the cursor to see the tooltip.

This helps WebKit profiling in particular, which is a heavy user of
marks.
2024-08-07 11:18:03 -03:00
fd67844d8b sysprof: put recording pad contents in a window handle
So that it can be dragged around easier by users.
2024-08-06 14:14:30 -07:00
a4c92033a2 sysprof: fix color array initialization 2024-07-26 23:05:24 +05:30