Commit Graph

65 Commits

Author SHA1 Message Date
bd73d534d0 tools: feature test various sources behind __linux__ 2020-11-16 14:58:09 -08:00
04eacbcfe2 build: make polkit optional again for sysprof-cli 2020-11-16 14:57:04 -08:00
9405c960cc tools: load proper speedtrack library
Fixes #51
2020-10-15 13:38:37 -07:00
620f1f0ff0 build: fix build warnigns with Clang 2020-08-14 12:57:50 -07:00
5311f9d80a sysprof-dump: include <errno.h> where appropriate 2020-08-08 10:52:16 -04:00
e8790bc3d6 build: Add more Meson options for disabling parts of the build
This is all aimed at making it so that sysprof can be built as a
subproject within GLib, with only `libsysprof-capture-4.a` being
produced as output.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-03 22:01:33 +01:00
e03b54fca5 build: Only run gdbus-codegen if building components which need it
This is to avoid running `gdbus-codegen` when building sysprof as a
subproject underneath libglib, as by that point in the GLib build
process, `gdbus-codegen` is not yet available.

The interfaces generated by these `gdbus-codegen` invocations are only
needed for `sysprofd` and libsysprof, not for the libraries like
`libsysprof-capture`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-03 22:01:33 +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
45c8c95706 libsysprof-capture: Drop GError usage from SysprofCaptureWriter
Use `errno` instead, which is icky, but given that all of the failure
modes are from POSIX I/O functions, it’s at least in keeping with them.

This is a major API break.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
2020-07-03 22:00:34 +01:00
e19d70bca0 libsysprof-capture: Drop GError usage from SysprofCaptureReader
Use `errno` instead, which is icky, but given that all of the failure
modes are from POSIX I/O functions, it’s at least in keeping with them.

This is a major API break.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
2020-07-03 22:00:34 +01:00
6a45f020f7 libsysprof-capture: Add SysprofCaptureJitmapIter to replace GHashTable
Change `sysprof_capture_reader_read_jitmap()` to return a `const
SysprofCaptureJitmap *` (like the other `read` functions), and add a new
`SysprofCaptureJitmapIter` type to allow easy iteration over the jitmap.

This allows a use of `GHashTable` to be removed from the API. It breaks
the libsysprof-capture API and ABI.

All the callers iterate over the jitmap rather than looking up elements
by key. If that functionality is needed in future, additional API can be
added to allow it on `SysprofCaptureJitmap`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
2020-07-03 22:00:34 +01:00
75b69d0a89 libsysprof-capture: Rewrite list_files() to avoid GHashTable/GPtrArray
This changes its API and ABI: it now returns an allocated array of const
strings, rather than an allocated array of allocated strings.

The call sites in the source tree have been adjusted accordingly.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
2020-07-03 22:00:34 +01:00
5636bbf4f0 libsysprof-capture: Use stdbool instead of gboolean
Another step towards dropping GLib as a dependency of
libsysprof-capture.

Unlike the previous commit which replaced GLib integer types with the
bitwise equivalent C standard types, `stdbool` is potentially a different
width from `gboolean`, so this is an ABI break.

It therefore involves some changes to callback functions in the tests
and tools, and in libsysprof.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
2020-07-02 21:07:11 +01:00
d2047fb557 libsysprof-capture: Move autocleanup definitions to libsysprof
In preparation for dropping the GLib dependency from libsysprof-capture,
move the autocleanup definitions up to libsysprof. Add a new header for
them.

This is slightly awkward in the tools, which depend on
libsysprof-capture but not libsysprof. Rather than make them depend on
libsysprof (which might be disabled at configure time), include the
`sysprof-capture-autocleanups.h` file between source directories.
`SYSPROF_COMPILATION` needs to be defined for this to work.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
2020-07-02 21:07:11 +01:00
3eb0f3e964 sysprof-dump: Move error handling up to avoid a NULL pointer dereference
`reader` can be `NULL`, but the `NULL` check was done after potentially
dereferencing it.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
2020-07-02 21:07:11 +01:00
30e5685655 tools: Add missing dependency on glib-2.0
It has previously been implicitly pulled in by libsysprof-capture, but
that will change in future.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
2020-07-02 21:07:11 +01:00
03906a84c6 tools: add --no-throttle sysprof-cli option
This allows disabling the CPU governer by switching to "performance".
2020-03-18 11:16:00 -07:00
014b696dc0 Merge branch 'wip/jojnar/litsuf' into 'master'
Fix -Werror=literal-suffix

See merge request GNOME/sysprof!25
2020-03-16 03:33:18 +00:00
89f656013a tools: add --speedtrack command line option 2020-03-15 16:00:22 -07:00
9393078d7b Fix -Werror=literal-suffix
When trying to build gjs with --werror, I get the following error:

	In file included from /nix/store/snc19nr462570ssx03v455p164vyz15s-sysprof-3.36.0-dev/include/sysprof-3/sysprof-capture-condition.h:59,
	                 from /nix/store/snc19nr462570ssx03v455p164vyz15s-sysprof-3.36.0-dev/include/sysprof-3/sysprof-capture.h:66,
	                 from ../gjs/profiler.cpp:53:
	/nix/store/snc19nr462570ssx03v455p164vyz15s-sysprof-3.36.0-dev/include/sysprof-3/sysprof-capture-types.h:76:40: error: invalid suffix on literal; C++11 requires a space between literal and string macro [-Werror=literal-suffix]
	   76 | #define SYSPROF_CAPTURE_ADDRESS_FORMAT "0x%016"G_GINT64_MODIFIER"x"
	      |                                        ^
	cc1plus: all warnings being treated as errors
2020-03-15 22:07:49 +01:00
98f6dc6642 tools: add --env=VAR=VALUE command line option 2020-02-21 12:40:55 -08:00
c39cf46776 tools: perform cleanup/supplementals when stopping profiler 2020-02-11 18:39:20 -08:00
33c81a3a9c memprof: add memory profiling using LD_PRELOAD
This brings over some of the techniques from the old memprof design.
Sysprof and memprof shared a lot of code, so it is pretty natural to
bring back the same callgraph view based on memory allocations.

This reuses the StackStash just like it did in memprof. While it
would be nice to reuse some existing tools out there, the fit of
memprof with sysprof is so naturally aligned, it's not really a
big deal to bring back the LD_PRELOAD. The value really comes
from seeing all this stuff together instead of multiple apps.

There are plenty of things we can implement on top of this that
we are not doing yet such as temporary allocations, cross-thread
frees, graphing the heap, and graphing differences between the
heap at to points in time. I'd like all of these things, given
enough time to make them useful.

This is still a bit slow though due to the global lock we take
to access the writer. To improve the speed here we need to get
rid of that lock and head towards a design that allows a thread
to request a new writer from Sysprof and save it in TLS (to be
destroyed when the thread exits).
2020-02-07 19:00:33 -08:00
981873af75 cli: add --merge command line option
This allows the caller to merge multiple syscap files into one such as:

  sysprof-cli --merge a.syscap b.syscap > c.syscap

Fixes #26
2020-01-29 08:17:36 -08:00
753a698563 tools: add --rapl to sysprof-cli command
This allows recording energy statistics using turbostat if supported by
the host system.
2019-08-08 16:12:26 -07:00
1cb182d1df tools: fix local usage for no_battery 2019-08-02 11:01:13 -07:00
41f8565a25 tools: fix type for profiler-ctl 2019-07-30 15:17:47 -07:00
8c72bafff8 tools: set cwd when spawning with sysprof-cli 2019-07-28 12:32:49 -07:00
745f4c4168 tools: add --gtk option for GTK_TRACE_FD= envvar 2019-07-20 18:38:24 -07:00
c2728b8ada cleanup: remove duplicated NSEC_PER_SEC macros
This switches everything to using a single 64-bit constant for NSEC_PER_SEC
that ensure we're doing 64-bit math everywhere.
2019-07-18 10:22:46 -07:00
6987888349 sysprof: include locale.h
setlocale and LC_ALL requires this
2019-07-17 14:59:42 +05:30
bb5261bc32 tools: setup translations for sysprof-cli 2019-07-13 15:01:59 -07:00
6a331f44f4 tools: add -- option instead of -c
This adds the common convention for applications that receive command
line arguments to use [-- COMMAND ARGS] instead of "-c" which is rather
limiting for shell expansion.

Fixes #10
2019-07-13 15:01:47 -07:00
f89d5830f2 cli: add diskstat data source recording 2019-07-01 14:46:43 -07:00
d44fdb48d9 tools: record battery from sysprof-cli 2019-06-26 14:26:15 -07:00
a951f1a240 tools: record network stats from sysprof-cli 2019-06-26 14:22:09 -07:00
84850218ed sysprof-cli: allow disabling perf stacktraces 2019-06-05 16:55:50 -07:00
5402074c53 tools: add --gnome-shell option to sysprof-cli
This can be used to connect to newer GNOME Shell versions that have
profiling integrated.
2019-06-04 15:10:51 -07:00
af2a17daa5 polkit: try harder to make polkit optional on non-Linux
We want the viewer to be usable on Mac/Windows/FreeBSD, even if our
profiler tooling isn't (yet).

Another option could be to do a simplified viewer window for those
platforms, but I think that is more work to maintain than abstracting
some of the stuff better in libsysprof.
2019-06-04 14:28:06 -07:00
af32235541 gjs: add gjs source back
This sets various environment variables we need.
2019-06-03 18:01:53 -07:00
7df9221f8b tools: check result of write
and also use the platform helpers
2019-06-03 12:40:48 -07:00
ac1d9e4694 build: disable cli tool when no libsysprof is present 2019-06-03 12:29:48 -07:00
cb4aed73bc build: don't install sysprof-cat and sysprof-dump
At least for now
2019-05-29 16:56:57 -07:00
30524ab3d0 sysprof-cli: exit main loop on failure 2019-05-29 15:13:01 -07:00
c670cdd82a sysprof-cli: add symbol rollup unless --no-decode 2019-05-29 15:13:01 -07:00
f57bc57461 sysprof-cli: remove -g option
We might want to save this for gtk
2019-05-29 15:13:01 -07:00
318e9e300c tools: add option to list files in capture 2019-05-29 15:13:01 -07:00
7650d6e7c6 libsysprof-capture: add file chunk frame type 2019-05-29 15:13:01 -07:00
cc415c9140 libsysprof-capture: add log frame type
This is useful to interleave logs with the capture so that we can have
correlation without interjecting them into mark fields.
2019-05-29 15:13:01 -07:00
d77c305779 tools: use writer-cat from libsysprof-capture 2019-05-29 15:13:01 -07:00