Commit Graph

269 Commits

Author SHA1 Message Date
c8c307cb96 libsysprof-analyze: rename ctor for node
That way we can have an alternate way of creating these that does not
require using a SysprofCallgraphNode.
2023-06-12 12:12:53 -07:00
fbe0b99314 libsysprof-analyze: use symbol to get callers list
That keeps the API clear of the indirection Frame object so we can use it
elsewhere like in the functions column view to select callees.
2023-06-12 11:35:01 -07:00
b873ee1f37 libsysprof-analyze: cleanup symbols array in finalize 2023-06-12 11:34:22 -07:00
2c9c41dedc libsysprof-analyze: allow specifying ptr array for symbols
This will allow us to use the same model with a different list of symbols.
2023-06-12 11:34:04 -07:00
643aa374cb libsysprof-analyze: add GListModel of callgraph symbols
This has an indirect object (SysprofCallgraphSymbol) so that we can provide
plumbing to get the callgraph as well as the augmented data from the
indirection object.

This allows for callgraphs to show overview in the functions list which
contains the same augmentation that the descendants view does.
2023-06-12 11:15:50 -07:00
d2a38bf1a6 libsysprof-analyze: introduce [Unwindable] callgraph node
This interjects a node for unwindable traces so that cost gets accounted
to the process, but is not just at the [process] graph item as that makes
it very hard to subtract to figure out what it was.

Instead just insert an [Unwindable] node and cost-account to that.
2023-06-09 15:58:57 -07:00
3f34c4625b libsysprof-analyze: cleanup walking to root 2023-06-09 15:57:52 -07:00
2511e79cae libsysprof-analyze: allow getting root augments with NULL 2023-06-09 15:57:34 -07:00
12f32e8838 libsysprof-analyze: add getter for callgraph from frame 2023-06-09 15:57:16 -07:00
a7443e05f0 libsysprof-analyze: add missing header for summary augment 2023-06-09 15:16:44 -07:00
c35f8d083d libsysprof-analyze: give frame access to callgraph via property 2023-06-09 15:16:04 -07:00
814c25d45a libsysprof-analyze: add summary augmentation capabilities
This allows us to have augmentation at the summary level so that things
like the weighted callgraph or memprof callgraph can add their respective
summary data up the chain of function calls.
2023-06-09 11:19:40 -07:00
900c39c0d8 libsysprof-analyze: use summary struct for symbol information
We still need to figure out the right way to plumb in the augmentation data
so that things that need to walk up the chain are possible, but this first
gets things in order to do that.
2023-06-09 10:50:39 -07:00
ca0cff6446 libsysprof-analyze: fix binary-nick usage 2023-06-08 17:29:27 -07:00
2c46d6a4c1 libsysprof-analyze: add listmodel of stacktraces containing symbol 2023-06-08 14:22:18 -07:00
6fc1049e63 libsysprof-analyze: don't duplicate callers 2023-06-06 17:33:42 -07:00
275869b198 libsysprof-analyze: implement basic callers listing
This doesn't give us augmentation data like we would have from the
existing callgraphs, but we can deal with that later.
2023-06-06 17:30:13 -07:00
663ae8746a libsysprof-analyze: add list model index for allocation records 2023-06-06 16:45:27 -07:00
44e9da2692 callgraph: be more graceful with unwind failures 2023-06-06 16:44:50 -07:00
9cba99d894 libsysprof-analyze: handle pid == -1
This can happen from Perf sometimes so be explicit about remapping it to
process 0, which is our sort of catchall for kernel stuff.
2023-06-05 16:45:07 -07:00
03c6c57fab contrib: move line reader to contrib
This came from Builder, and it's nice to be able to use it statically from
multiple libsysprof libraries.
2023-05-30 21:29:24 -07:00
957cec9843 libsysprof-analyze: decompress if necessary in dup_bytes()
If we are trying to get the file bytes and they are compressed, we may need
to transparently decompress those bytes. That way if the API requested
"/proc/cpuinfo" but really got "/proc/cpuinfo.gz" it still gets the same
bytes to consume.
2023-05-30 13:19:57 -07:00
1e8e1adb73 libsysprof-analyze: automatically handle compressed streams
If we want /proc/kallsyms and we discover /proc/kallsyms.gz, then use the
/proc/kallsyms.gz instead and transparently decompress it. Also, list the
file in sysprof_document_list_files() as /proc/kallsyms instead of
/proc/kallsyms.gz as that is really the intention (but mark the compressed
bit for decoding the chunks).
2023-05-30 12:46:42 -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
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
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
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
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
5bf178e07b libsysprof-analyze: include mount root when translating
Additionally, if we're on a subvolume, and that subvolume matches the
prefix of the root, then skip past that. I have no idea if this is the
right thing to do, but it's what we were doing before and seems to be
able to help us get proper path resolving on Silverblue.
2023-05-23 15:39:27 -07:00
5ef6911d65 libsysprof-analyze: ignore /sysroot devices
I highly doubt this is foolproof, but this makes Silverblue more likely to
resolve the proper fstab entry when translating to paths we can access
from the host system.
2023-05-23 15:37:57 -07:00