Commit Graph

285 Commits

Author SHA1 Message Date
11ae2fa395 build: fix write length 2021-09-21 13:12:02 -07:00
4c6912e804 elf: add helpers for test utilities to verify decoding 2021-09-21 11:50:03 -07:00
fb33d382cc extract instance data from .flatpak-info 2021-09-17 17:16:44 -07:00
728c5081d1 more work on resolver kinds 2021-09-17 17:11:06 -07:00
5f352abc86 do delayed path resolving of files containing symbols
we still need to teach this to locate debug dirs relative to the
process paths.
2021-09-15 17:52:58 -07:00
3e7e677419 start cleaning up proc source for delayed maps 2021-09-14 22:20:03 -07:00
e02785ba23 start on new resolver for paths 2021-09-14 19:53:46 -07:00
5f255403aa libsysprof: remove /sysroot/ workaround
This isnt really need anymore now that we have other ways of resolving this.
It fixes an issue with resolving some symbols on systems like GNOME OS.
2021-08-26 17:12:37 -07:00
bcda9694c6 profiler: fix typo in mutable calculation
Fixes #65
2021-06-03 13:57:38 -07:00
2c0ea406fd elf: use strncmp for comparison
We expect strncmp available on systems we build ELF parsers.
2021-03-17 13:01:02 -07:00
605cdfc3f1 elf: skip past /sysroot/ when symbol resolving
The /sysroot/ convention is something we see on OSTree-based systems
such as Silverblue or CoreOS which contains the running image. We can
skip that part of the path so that symbol resolving continues as normal.

We are starting to come into a situation where we need more advanced
path translations because we keep having to do things like this. Until
Linux figures out file-system namespaces at a higher level at least.
2021-03-17 12:56:38 -07:00
7e92b3e14b elf: use overlays to resolve library paths 2021-02-25 14:09:15 -08:00
43d2b0b019 proc: track overlays for flatpak /app and /usr 2021-02-25 13:44:58 -08:00
14139232d5 capture: rename PidRoot to Overlay and add src/dst
Really what we want to deal with here is tracking an overlay that we may
need to be able to decode after the fact (in case processes exit or we
need to do post-processing symbol resolution).

For the podman case, that is $some_path mapped to root (/), generally
speaking. For flatpak though, that would have two mappings, one for
/app and another for /usr (possibly more).
2021-02-25 13:43:09 -08:00
8b0f3f4682 proc: fix capture of application id 2021-02-25 13:03:46 -08:00
7a8f1d9d2e flatpak: add stubs to extra flatpak cgroup information
The goal here is to discover the app and runtime paths so that we can
create a path mapping when resolving addresses.
2021-02-25 12:15:15 -08:00
9e823c57ce elf: use discovered root when decoding symbols 2021-02-24 19:05:43 -08:00
bd8a8ada26 elf: track pid root when building lookaside buffers
We want to know the location of our root if it was specified in the
capture file. Such is useful for decoding symbols that may not be
reported right from perf tooling.

This allows us to try to translate maps for processes in containers.
2021-02-24 18:59:35 -08:00
b22899474d proc: discover filesystem root for podman containers
For processes we find in a podman container, we can sniff the libpod
cgroup scope. Using that we can translate into the podman layer that
contains the files.

With that, future work could find the proper .so when resolving based on
alternate roots for the process.
2021-02-24 18:40:41 -08:00
61934a1c02 libsysprof: make perf_event_paranoid failure softer
We can survive this being at 2, but we can keep it a debug info bit for
now to be less annoying on the console.
2021-02-24 14:03:51 -08:00
143554c68e profiler: preroll authorization before starting
This helps some annoying cases where we keep checking over and over for
each CPU, procfile, etc during startup.

It makes the tool less useful on systems without D-Bus, but let's be
honest, profiling is a Linux only game for Sysprof.
2021-02-24 14:01:01 -08:00
86fb061899 governor: always disable paranoid status
This allows us to always attempt to disable the perf_event_paranoid
setting to -1 while we profile.
2021-02-24 12:19:36 -08:00
53d3c0afc9 governor: default to not disabling governor 2021-02-24 11:58:40 -08:00
52e04cf346 governor: disable paranoid setting in governor source
This could be it's own source, but it's nice to have it in one place
with our performance tooling.
2021-02-24 11:56:22 -08:00
0abba0949d libsysprof: add client access to paranoid API 2021-02-24 11:54:19 -08:00
5a82ce21f2 libsysprof: fix typos 2021-02-24 11:34:01 -08:00
b77523eb3d use g_memdup2() 2021-02-23 15:39:25 -08:00
f41212680a podman: add various possible debug dirs 2021-02-19 16:58:58 -08:00
17b09387ee src/libsysprof/elfparser.h: define NT_GNU_BUILD_ID
On uclibc elf.h does not have GNU extentions but we need this define
so we define it locally if its not getting it from elf.h

It should be noted that uclibc-ng defines NT_GNU_BUILD_ID since its
version 1.0.28 and
df350133f2

As a result, this patch is still needed with uclibc-ng < 1.0.28

Signed-off-by: Khem Raj <raj.khem@gmail.com>
[Retrieved (and slightly updated) from:
https://git.buildroot.net/buildroot/tree/package/sysprof/0001-define-NT_GNU_BUILD_ID.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-11-24 20:26:31 +01:00
c570f9650e kernel: fix use of address array 2020-11-16 14:57:38 -08:00
04eacbcfe2 build: make polkit optional again for sysprof-cli 2020-11-16 14:57:04 -08:00
6e4413d3aa binfile: fix warning on non-Linux platforms 2020-11-16 14:17:09 -08:00
a8f61d013b libsysprof: use private helper for getpagesize() 2020-11-16 14:14:16 -08:00
f18fbe5ae8 build: various fixes for compiling on macOS 2020-11-16 14:01:02 -08:00
eec5bb944b mountinfo: fix parsing of mount and mountinfo for btrfs
When dealing with Btrfs subvolumes, we might need to translate the src
directory to the proper subvolume. This isn't exactly perfect, as I could
imagine some scenarios that might break things here, but it seems to be
good enough to get decoding working on Fedora 33 with a default btrfs
installation.

If you have more creative setups, I'd be happy to see some testing there.

You can use ./src/tests/test-mountinfo /proc/self/mountinfo /some/path.so
to get information on what was resolved.

Fixes #34
2020-10-15 14:23:16 -07:00
f0303f4b68 meson: Fix pkgconfig generation
This fix error when gio is a subproject, when there is pc file
assotiated for objects in libraries_private meson automatically promote
them to requires.

Also remove some values that are already the default.
2020-10-01 10:15:38 -04:00
04b6fdfcbe libsysprof, libsysprof-ui: Generate pkg-config dependencies
Otherwise, using libsysprof-ui will usually fail because <dazzle.h>
is not added to the search path.

Resolves: https://gitlab.gnome.org/GNOME/sysprof/-/issues/49
Signed-off-by: Simon McVittie <smcv@debian.org>
2020-09-16 10:48:04 +01:00
68c50ba869 build: Pass libraries to pkgconfig.generate as a positional argument
This allows Meson to associate the pkg-config module with the "main"
library that it represents, in an unambiguous way.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-09-16 10:47:22 +01:00
0a529b7670 proc: authorize before starting source 2020-08-21 13:15:38 -07:00
2850858d24 profiler: dont authorize during profiler startup
This should be done by sources, as there are configurations that will not
require polkit communication and that can be frustrating when it happens.
2020-08-21 13:15:38 -07:00
e968518083 perf: authorize polkit as part of source startup 2020-08-21 13:15:34 -07:00
bbe62d83b8 helpers: avoid concurrent requests to authorize
We don't want to spam users with polkit requests, so try to only do one
at a time and ensure that if we suceeded, we skip it until later.
2020-08-21 13:01:39 -07:00
620f1f0ff0 build: fix build warnigns with Clang 2020-08-14 12:57:50 -07:00
51a5b20de3 libsysprof: include <errno.h> where appropriate 2020-08-08 10:51:26 -04:00
eae4eb4ad7 build: Drop redundant _GNU_SOURCE definitions
It’s defined in `meson.build` now. See the previous commit.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-06 11:27:28 +01:00
3c7b76c6ba build: Move Meson dependency() calls to where they’re used
This avoids making the project depend on all its dependencies, some of
which are optional, when being built as a Meson subproject.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-03 22:01:33 +01:00
760805c8b9 memory-collector: avoid tracking scratch memory free 2020-07-03 22:00:34 +01:00
03326e82fa memory-collector: drop unused branch 2020-07-03 22:00:34 +01:00
a9f136550b build: ensure libsysprof-memory-4.so is placed in libdir
This makes it consistent with other preloads.
2020-07-03 22:00:34 +01:00
97ddf5a0cc libsysprof: port UI to new ABI
Some minor changes were necessary so that we could change the ABI in
libsysprof-capture to be free from GLib (and therefore used by GLib).

This also adds some wrappers for capture API in libsysprof so that we
can continue to use GError from UI code.
2020-07-03 22:00:34 +01:00