Commit Graph

465 Commits

Author SHA1 Message Date
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
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
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
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
5c9c20621e sysprof: add support for left-heavy sorting of flamegraph
Related #93
2023-08-27 13:45:09 -07:00
fd3e5af1fa libsysprof: add category name private helper 2023-08-25 17:41:34 -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
507c0e79c2 libsysprof: move callgraph sorting to thread worker 2023-08-24 14:13:17 -07:00
b80c8b8b5b libsysprof: always increment count for callgraph nodes
This shouldn't affect categorizing because that only uses the value if
is_toplevel. But with this added, we can use the count for weights in
other tooling w/o needing augmentation.
2023-08-23 14:32:04 -07:00
fd618ccb4b callgraph: track max height of callgraph 2023-08-23 14:31:10 -07:00
340e92403f libsysprof: stop streams at end of recording
Don't wait for disposal to stop this recording.
2023-08-21 16:01:35 -07:00
82020e86be libsysprof: add instrument to record scheduler switching
This is to allow us to look at what processes were running when as a way
to get a high-level overview of usage.
2023-08-21 15:05:48 -07:00
bf73d142dc libsysprof: sort frames with timsort
These are largely pre-sorted, but not fully when you have merged data. This
uses timsort to speed that up a bit.

In particular, the comparison of various sorts break down to (for a
~32,000,000 record capture.

  g_array_sort_with_data() => 3.9 seconds
  qsort_r() = > 3.7 seconds
  gtk_tim_sort() => .79 seconds
2023-08-18 16:46:28 -07:00
bdf9a55969 libsysprof: be defensive against null traceable 2023-08-17 13:36:39 -07:00
9f00d904b0 Revert "libsysprof: add rwlock for symbol cache"
This reverts commit d1b4308af7.
2023-08-16 15:43:50 -07:00
48dc402c3b Revert "libsysprof: parallelize capture symbolizing"
This reverts commit a7a0c782d1.
2023-08-16 15:43:49 -07:00
3b97252a8e Revert "libsysprof: be defensive against null traceable"
This reverts commit c75022c257.
2023-08-16 15:43:46 -07:00
c75022c257 libsysprof: be defensive against null traceable 2023-08-16 14:06:40 -07:00
a7a0c782d1 libsysprof: parallelize capture symbolizing 2023-08-15 22:17:34 -07:00
d1b4308af7 libsysprof: add rwlock for symbol cache
This is necessary so we can start looking at threading symbolizers.
2023-08-15 19:21:31 -07:00
3598755963 libsysprof: flush incoming events when finalizing ring source
This just helps ensure we've not lost anything during the shutdown of the
profiler here.
2023-08-15 15:38:02 -07:00
b96bf5c969 libsysprof: increase priority of mapped ring buffer source
We want to reduce the chances we've lost anything in these, which is
pretty important for memory tracing.
2023-08-15 14:41:23 -07:00
c576df92db libsysprof: allow specifying type in index model 2023-08-14 21:48:51 -07:00
4967d5faeb libsysprof: add test for leak detection 2023-08-14 16:02:46 -07:00
f7a32750e2 libsysprof: add leak detector helper
This is a leak detector by finding allocations which do not have a
corresponding free record.
2023-08-14 16:02:46 -07:00
a27eee8087 libsysprof: give internal access to allocations bitset 2023-08-14 16:02:46 -07:00
45f08e07c9 libsysprof: externalize access to frames array
This can be useful to optimize some walking paths in other layers.
2023-08-14 16:02:46 -07:00
fd705063bf libsysprof: defend against empty symbol lists 2023-08-08 14:15:51 -07:00
a1211ec298 libsysprof: add some memory counters
We will probably add a bunch more here too.
2023-08-07 18:02:05 -07:00
fba4642451 build: fix static dep race in enums 2023-08-07 15:41:43 -07:00
7ec7cb9b84 libsysprof: add a subtitle property
To make things easier to bind from the window.
2023-08-07 14:47:13 -07:00
c38c1fb4b0 libsysprof: allow specifying phase for subprocess output
This is helpful in that you can specify which phase of the capture the
process should be run so that it's less likely to show up on profiles.
2023-08-07 12:54:46 -07:00
4250abf81e libsysprof: setup perf streams in prepare
This starts the perf streams from prepare instead of from record so that
we can do the linux instrument work in prepare. The samples are dropped
until our start-time is set.

Doing it this way removes sysprof-cli and sysprofd greatly from the
overhead in the callgraph which is useful so that the user gets to see
what they really care about.

It has the added benefit that we're less likely to see the pkla processes
showing up from authorizing our D-Bus connection for creating per streams.
2023-08-07 12:14:32 -07:00
053271f946 sysprof: implement document saving 2023-08-06 17:59:50 -07:00
d9932de4ff libsysprof: remove unused code 2023-08-06 16:32:37 -07:00
56332e0071 libsysprof: remove lsusb from linux instrument
This is done more generically now with the graphical recorder.
2023-08-06 15:59:41 -07:00
fd6e9c964e libsysprof: remove glxinfo/eglinfo from linux device
This is a separate instrument now.
2023-08-06 15:43:22 -07:00
15d9cbc28f libsysprof: add test for subprocess output 2023-08-06 14:51:42 -07:00
433dff95ce libsysprof: add helper instrument for subprocess output 2023-08-06 14:51:42 -07:00
fe4995cf1f libsysprof: synchronize access to tid symbols hashtable
This can get mutated after the document is loaded, so we need to
synchronize access to it.
2023-08-06 02:18:43 -07:00
c5517c0ead libsysprof: try to break cycles at end of recording 2023-08-05 23:42:57 -07:00
3ddf806f92 libsysprof: avoid fork amplification from recording 2023-08-04 16:00:01 -07:00