Commit Graph

2560 Commits

Author SHA1 Message Date
bfc989c6c0 build: add sysprof-diff tool
This is not installed currently. It's for testing now but we can start
installing it if/when people want to use it. We could also try to make
it part of sysprof-cli someday.

This tool prints the difference of two trees giving you a -/+ change of
the number of hits incurred on that frame-pointer.
2023-08-30 16:27:50 -07:00
f1234280aa sysprof: setup various cursors
This makes it more obvious that you can select in the time scrubber.
2023-08-30 16:27:50 -07: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
501e35803a Merge branch 'set_cwd' into 'master'
sysprof: add option to set the working directory

See merge request GNOME/sysprof!76
2023-08-29 19:01:16 +00:00
e788e1ed2a sysprof: add option to set the working directory
This is often essential for running non-graphical programs.
2023-08-29 20:58:01 +02:00
7468b80241 sysprof: bind utility traceables to samples view stack child
We want the traceables to match the selection in either the callgraph or
the flamegraph, depending which is visible. The summary is not currently
implemented for flamegraph as it is already naturally a summary by virtue
of it's colorization.

Fixes #95
2023-08-29 11:55:24 -07:00
2ed8c319c0 sysprof: add SysprofFlameGraph:utility-traceables property
This will get updated when a node is clicked/updated. The goal here is to
bind it from the SysprofSamplesSection so that the sidebar will update.

Related #95
2023-08-29 11:33:23 -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
e5413f7fd8 sysprof: show spinner when document is processing
If the document is doing asynchronous work after it has been loaded (which
we use a progressbar to denote), then show a spinner for the activity.

Fixes #94
2023-08-29 09:52:12 -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
8aa55a7b2d sysprof: attempt to highlight to root of flamegraph 2023-08-28 15:44:41 -07:00
279e8ae397 sysprof: leave process 0 visible
This can be a number of samples, and is worthwhile for debugging unless
toggled off in the view options.
2023-08-28 15:03:56 -07:00
7150db0045 sysprof: add ui to toggle ignoring kernel processes 2023-08-28 15:03:56 -07:00
c4e96bb314 libsysprof: add flag to ignore kernel processes 2023-08-28 15:03:56 -07:00
8f26c0037d libsysprof: sniff various forms of kernel process names
This is by no means perfect, but it gets the kernel tasks running on my
machine out of the profiles. We will no doubt need to add more in the
future, or find a way to record a flag for that in the capture format.
2023-08-28 15:03:53 -07:00
fd980eca68 libsysprof: always create pid0 info
That way we don't risk showing "Unknown Process" if we get stack traces
recorded with a 0 pid (which can happen from Perf).
2023-08-28 14:55:43 -07:00
310e43f166 sysprof: add various action symbolic icons
We *should* be able to rely on these icons but not everyone has an up to
date system, particularly if not running GNOME.

Related #93
2023-08-28 14:22:45 -07:00
88dc13d869 sysprof: scroll to the bottom of the flame graph
Unfortunately we don't have a good way to do this in GtkScrolledWindow
where you have an initial gravity pulling you to the bottom of a viewport.

We might be able to fake it with a focusable widget, but that sounds like
more work than just animating to the bottom of the viewport.

Related #93
2023-08-28 14:13:59 -07:00
dc15089133 sysprof: add animation helpers
Reluctantly adding animation helpers so we can do some automated scrolling.
2023-08-28 14:12:43 -07:00
a60bc04de2 sysprof: add UI to toggle merge-similar-processes flags
Related #93
2023-08-28 13:34:11 -07:00
cdfae5f7b9 libsysprof: add callgraph flag to merge similar processes
This is the backing implementation to allow for merging multiple processes
which have identical comm[] fields.
2023-08-28 13:34:11 -07:00
00c02f0f18 libsysprof: handle missing process gracefully
If we get a request for a process that we have not captured any information
about then give it the "Unknown Process" symbol. That way we do not crash
and we also maintain our invariant of not mutating the hash table.
2023-08-28 13:34:11 -07:00
aad3441fee libsysprof: normalize binary path/nick empty strings
If we get an empty string, just normalize that to NULL so that we can be
more likely to match equality checks via hash comparison.

Additionally, break hashes out into two so that we can improve the
situation where some symbols do not have paths but still match. This
can happen with bundled symbols.
2023-08-28 13:33:37 -07:00
e6d9f7c849 sysprof: fix ownership transfer of treelistrow
Fixes #92
2023-08-28 12:20:27 -07:00
a3a2b02b0d libsysprof: assert hashtable stays read-only
We only mutate this during loading of the document so that we can be
confident in multi-threaded workers after loading. This just asserts
that invariant holds true.
2023-08-28 12:19:16 -07:00
8d1ca4bd0d Fix typo in sysprof-greeter.ui 2023-08-28 13:51:33 +00:00
0a12163f6e sysprof: use flatpak-spawn when inside of flatpak
Unless the argv already is calling flatpak-spawn, try to run the process
through the host using flatpak-spawn.
2023-08-27 14:27:00 -07:00
5c9c20621e sysprof: add support for left-heavy sorting of flamegraph
Related #93
2023-08-27 13:45:09 -07:00
9f0a214a69 sysprof: include file/category in tooltips 2023-08-25 17:41:47 -07:00
fd3e5af1fa libsysprof: add category name private helper 2023-08-25 17:41:34 -07:00
d1b228bf28 sysprof: add menu button for callgraph options
This is useful for when we are viewing things like flamegraphs which can
take advantage of options in the callgraph.

Also add some labels for the header bar buttons.
2023-08-25 16:49:27 -07:00
75c7a99339 sysprof: dive into flamegraph node upon click
This makes the graphs interactive finally where you can select a node and
see the children of it directly. Click down the stack to return to a
larger view.
2023-08-25 15:44:27 -07:00
cd06a025a4 sysprof: render from alternate root to real root
This helps with the situation where we are going to render the parents
of the selected root first, and want them to take the whole width. Next
step is to support invalidation of the rendering.
2023-08-25 15:29:23 -07:00
35b75aa25b sysprof: rely on count from root node
We have a valid count on root now so no need to deal with the 0 counts.
2023-08-25 14:11:55 -07:00
4a283a79c5 sysprof: use hand cursor to indicate flamegraph interactivity
You can click on flamegraph items (and soon) we will update the graph to
show you that node. Set the hand cursor when doing that so the user knows
that is an option.
2023-08-25 13:36:19 -07:00
22fe863230 sysprof: add description for process items 2023-08-25 13:13:34 -07:00
174d5f2cd4 sysprof: add tooltips to chart layer
Now that we do some filtering on these to not show too many items per row,
this can be enabled. Previously it could *really* slow things down due to
all the app<->compositor traffic it causes.
2023-08-25 12:56:24 -07:00
8a43440f6a sysprof: fix double accounting in recursion
We don't want to cost-account the same summary multiple times while walking
up to the root. Otherwise, you can get items which come out to a percentage
of > 100% which is not exactly what you're expecting to see as a normalized
value.
2023-08-25 12:43:57 -07:00
a28353eb76 sysprof: sort callgraph models incrementally
This represented a large stall when loading the window, and also results
in doing a bunch of work twice as we set the model (then again the time
range).

So instead, just do it incrementally and let the functions list backfill in
a bit.
2023-08-25 12:42:59 -07:00
00554090d8 libsysprof: check for null node before setting toplevel 2023-08-25 12:42:07 -07:00
3de88108ce libsysprof: ensure we update count for root node 2023-08-25 12:41:52 -07:00
677c6a19a7 libsysprof: fix kernel (Linux) categorization 2023-08-25 11:37:17 -07:00