Commit Graph

2844 Commits

Author SHA1 Message Date
b4e6f7c915 libsysprof-profile: add recording session fiber
Setup instrument policy, preparation, etc.
2023-05-26 15:05:29 -07:00
fac12d657a libsysprof-profile: implement polkit checking with libdex
Also, I no longer wish to try to maintain support for no-polkit. If there
is truly a system where that is something we want to support, we can bring
back the shims as a compile time alternative.
2023-05-26 13:48:16 -07:00
d1bcf93922 build: add libdex-1 requirement for libsysprof-profile
Being able to manage asynchronous operations with libdex will drastically
simplify how we implement the profiler and instruments. We may eventually
do the same with libsysprof-analyze to parallelize some operations.
2023-05-26 12:21:36 -07:00
11aa39f151 libsysprof-profile: add scaffolding for controlfd source
This is internal to the profile and will always be active when running
subprocesses with Sysprof.
2023-05-26 12:18:59 -07:00
97128b4185 libsysprof-profile: transfer instrument ownership 2023-05-26 12:18:26 -07:00
731841a523 libsysprof-profile: wait for recording and seutp ctrl+c 2023-05-25 17:25:13 -07:00
ce4a4200f8 libsysprof-profile: create recording and start it 2023-05-25 17:24:54 -07:00
07dc728bfe libsysprof-profile: change state on stop
We will need some more checks in here later on once we're doing things
with the instruments, but this gets the job done for now.
2023-05-25 17:24:33 -07:00
7fb77ee01d libsysprof-profile: create writer and test record 2023-05-25 17:17:25 -07:00
a8fbb645d0 libsysprof-profile: add writer as record parameter 2023-05-25 17:17:04 -07:00
9498d15170 libsysprof-profile: fix copy-paste typo 2023-05-25 17:16:47 -07:00
d3fe382954 libsysprof-profile: add test-profiler 2023-05-25 17:10:37 -07:00
7b83ff3f34 libsysprof-profile: fix includes for profiler 2023-05-25 17:10:23 -07:00
08aa970c7c libsysprof-analyze: add instruments to recording and list policy
We need to know all the policy that must be acquired upfront so that we
don't have to do individual queries on policy.
2023-05-25 17:05:16 -07:00
ccdc1b8cff libsysprof-profile: add API to list required policy
The idea here is that we stop having instruments do their own policy
checking and instead do the policy checking as a set from the recording
as part of prepare/etc.
2023-05-25 16:43:56 -07:00
2ae33917b2 libsysprof-profile: add writer to recording object 2023-05-25 16:26:18 -07:00
93153d1943 libsysprof-profile: add scaffolding for base objects
The goal here is to have a fairly small exposed API surface for profiling
similar to libsysprof-analyze where implementation details are hidden.

 SysprofProfiler - Where you setup your recording
 SysprofInstrument - What you add to a profiler to extract data
 SysprofRecording - Represents an active recording w/ instruments
2023-05-25 16:21:40 -07:00
24b876f437 libsysprof-profile: stub out libsysprof-profile library
This does the same thing as we did for libsysprof-analyze, but to contain
the profiler bits that will be used from applications/etc.
2023-05-25 15:43:53 -07:00
a4b5ea6160 build: various meson.build cleanup
We have a lot of twisted options, and could really use some cleanup to
make that all more manageable. I don't know anywhere we care about not
checking for a C++ compiler, so just always check for that so we can use
the demangler.
2023-05-25 15:30:42 -07:00
19b957f4ff build: remove unnecessary warning ignore
This shouldn't be needed anymore.
2023-05-25 15:17:46 -07:00
ff41633abc libsysprof-analyze: use EggBitset instead of GTK
This uses the newly brought in EggBitset instead of GtkBitset so that we
can drop our GTK dependency in the libsysprof-analyze library.
2023-05-25 15:16:13 -07:00
375aaf7086 contrib: import GtkBitset as EggBitset
This imports GTK's GtkBitset and the underlying roaring bitmaps so that
we will have it without having to use GTK from libsysprof-analyze.
2023-05-25 15:15:38 -07:00
92b3b77dd2 contrib: create static library for elfparser
I want to move a bunch of this "contrib" style sources into their own
area so we can statically link them but keep them separate from main
sysprof code.
2023-05-25 15:15:20 -07:00
7ec74308b5 build: update required compiler versions 2023-05-25 15:15:20 -07:00
503d3decca libsysprof-analyze: track nodes that were toplevel
That way when we want to get a list of stack traces, we could know to
yield a trace stopping at this node.
2023-05-25 14:33:08 -07:00
eaee76e49f tools: use data-table class 2023-05-25 13:36:40 -07:00
a9e14be37e tools: column sorting by default 2023-05-25 13:18:26 -07:00
ed0fefc721 libsysprof-analyze: apply text_offset for elfparser
We need to do what binfile was doing and make the address relative to the
text_offset. We also need to ignore the text offset of the debuglink files
and pass it the text_offset of the original ELF.

This fixes a bunch of symbolization in the callgraph.
2023-05-25 12:54:02 -07:00
c5f4d64a4c libsysprof-analyze: use old style relative address generation
Copy this from the old decoder so it's not something to worry about.
2023-05-25 12:53:13 -07:00
b5ce671e23 tools: start on callgraph example using columnview
This just serves as a prototyping ground so that we can have a callgraph
view widget in the future based on these principles. It also shows some
areas that still need work, such as sorting within the tree and fixing the
text offset calculation for ELF symbols.
2023-05-25 12:16:18 -07:00
8353b1eb9c libsysprof-analyze: account kernel stacks to the kernel
If our entire stack was in kernel address context, inject the
"- - Kernel - -" symbol at the top of the stack trace so that accounting
gets properly assigned to the kernel. This is typical with kernel processes
such as kworker.
2023-05-25 11:16:08 -07:00
6f90a552e7 libsysprof-analyze: include final address context
We may need to know the final address context so we can inject symbols as
necessary into the top of the callgraph. We know it when generating the
symbols, so just yield it to the caller too.
2023-05-25 11:15:07 -07:00
1b0434c854 libsysprof-analyze: add private API to get the kernel symbol
We may need to inject "- - Kernel - -" in some stack traces.
2023-05-25 11:13:57 -07:00
f6ec119899 libsysprof-analyze: move definition to private header
So we can access it from other sources.
2023-05-25 11:13:32 -07:00
f79a3c6d2e libsysprof-context: skip context switches at head of trace
We can get stack traces which have a USER at the end, or KERNEL at the
end, and nothing after it. Not really useful to us.
2023-05-25 11:13:10 -07:00
81672f191b libsysprof-analyze: fix symbol name for context switch
We want the last context as we're working backwards in the stack trace.
2023-05-25 11:12:23 -07:00
9c8b3b9c25 libsysprof-analyze: add bit for context switch symbols 2023-05-25 11:11:52 -07:00
007b42a80f libsysprof-analyze: allow setting kallsyms file 2023-05-24 23:31:28 -07:00
7f192958ae libsysprof-analyze: free callgraph node tree on finalize 2023-05-24 17:29:32 -07:00
3ae108464d libsysprof-analyze: implement augmented callgraph
This creates a SysprofCallgraph object which is a GListModel of
SysprofCallgraphFrame. The SysprofCallgraphFrame is also a GListModel of
SysprofCallgraphFrame so that we can map this all into a GtkListView in
the future for tree-like visibility.

The augmentation allows for the same callgraph code to be used for multiple
scenarios such as CPU sampling as well as memory allocation tracking.

If your augmentation size is <=sizeof(void*) then you do not occur an extra
allocation and you can use the inline augmentation space.

The test-callgraph clearly shows that we still need to do the shuffling
of -- Kernel -- and -- User -- like the old callgraph code did. But that
will come soon enough.
2023-05-24 17:11:30 -07:00
5e9f745f38 libsysprof-analyze: pre-hash symbols for faster comparisons 2023-05-24 17:08:48 -07:00
ca2b008547 libsysprof-analyze: skip symbols we failed to symbolize 2023-05-24 17:08:09 -07:00
d723e41683 libsysprof-analyze: wrap processes in [] like previously 2023-05-24 17:07:52 -07:00
f12f2b760c libsysprof-analyze: add API to get symbol to represent process
And include a fallback in case we never got an actual Process frame which
will contain the cmdline for the process. We need to hold onto the fallback
too so that we can keep symbols lightweight by not having to reference them
so long as the document is alive.
2023-05-24 15:19:44 -07:00
5b00127d7d libsysprof-analyze: add API to get only samples
We'll probably want this for allocations too at some point.
2023-05-24 14:30:13 -07:00
8348f7fe2c libsysprof-analyze: start on scaffolding for callgraph API 2023-05-24 13:00:47 -07:00
b68d8225ec libsysprof-analyze: print the counter ids that were set 2023-05-24 12:53:34 -07:00
f7882d5c5f libsysprof-analyze: add vfunc for getting stack addresses
This allows us to avoid the function call overhead for each of the
instruction pointers in the stack trace. Instead let the interface handle
the decoding of the whole set.
2023-05-24 12:44:26 -07:00
059aec5a1e libsysprof-analyze: try to load .build-id debug paths
If we have a build-id, we might find it in a path like the following:

 /usr/lib/debug/.build-id/aa/aa123456789012345678901234567890

so do that lookup before we try to resolve the debuglink name.
2023-05-24 11:50:14 -07:00
4926723228 libsysprof-analyze: process lower/upper dir from overlay
In modern podman, we will get lowerdir= and upperdir= in the superblock
options which we can parse to find where things are on the host. Use that
instead of relying on overlay mounts.
2023-05-23 19:49:21 -07:00