Commit Graph

2001 Commits

Author SHA1 Message Date
e26eae5bcf libsysprof-capture: Use libc string functions rather than GLib ones
Use `strcmp()` and `strdup()` rather than `g_strcmp0()` and
`g_strdup()`. In the latter case, this makes no difference. In the
former case it means we potentially need to do some additional `NULL`
checks before calling it; although most of the call sites use
fixed-length arrays, so no `NULL` check is needed.

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

Helps: #40
2020-07-03 22:00:34 +01:00
1d865c5c8e libsysprof-capture: Use sysprof_{steal,clear}_pointer() instead of GLib
They work exactly the same way as the GLib functions.

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

Helps: #40
2020-07-03 22:00:34 +01:00
e96e35b6f1 libsysprof-capture: Stop using GArray in SysprofCaptureCondition
The code is well-suited to directly using `calloc()` instead, since the
arrays never grow dynamically.

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

Helps: #40
2020-07-03 22:00:34 +01:00
0e4b3f52b1 libsysprof-capture: Handle OOM conditions in SysprofCaptureCondition
This doesn’t change any of the sites which call
`sysprof_capture_condition_*()` in other files, but does change
`SysprofCaptureCondition` internally to handle OOM and return an error
code.

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

Helps: #40
2020-07-03 22:00:34 +01:00
b0a5c4f700 libsysprof-capture: Use malloc() rather than g_new0() and friends
Another step away from GLib. This changes the OOM behaviour of the
library — previously it would immediately `abort()` on OOM. However, it
seems likely that given the small number of allocations
libsysprof-capture does, it should be able to recover from an OOM
situation more gracefully than larger libraries can — so the new
implementation tries to do that.

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

Helps: #40
2020-07-03 22:00:34 +01:00
6e281dca1f libsysprof-capture: Use strlcpy() instead of g_strlcpy()
If the system doesn’t provide `strlcpy()` (FreeBSD does, Linux doesn’t),
use an inbuilt copy instead.

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

Helps: #40
2020-07-03 22:00:34 +01:00
951b46fddf libsysprof-capture: Use intrinsic atomics rather than g_atomic_*()
Use the intrinsic atomics provided by the compiler, instead of GLib’s
wrapper around them. This should work for all modern compilers.

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

Helps: #40
2020-07-03 22:00:34 +01:00
b6fb272865 libsysprof-capture: Use fprintf() instead of g_printerr()
This removes one more dependency on GLib.

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

Helps: #40
2020-07-03 22:00:34 +01:00
f925fab564 libsysprof-capture: Replace G_{UN,}LIKELY with SYSPROF_{UN,}LIKELY
This does the same thing for modern compilers, but without the GLib
dependency.

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

Helps: #40
2020-07-03 22:00:34 +01:00
c9f54fcc68 libsysprof-capture: Replace G_GNUC_INTERNAL with SYSPROF_INTERNAL
It does the same thing for modern compilers.

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

Helps: #40
2020-07-03 22:00:34 +01:00
41ec04ea99 libsysprof-capture: Replace G_BEGIN_DECLS with SYSPROF_BEGIN_DECLS
It does the same job, but doesn’t require GLib.

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

Helps: #40
2020-07-03 22:00:34 +01:00
8e28ac6e81 libsysprof-capture: Use assert() instead of g_assert()
Also use it instead of `g_return_if_fail()`.

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
2c2cbf6343 libsysprof-capture: Use C11 types instead of GLib types
This is an almost entirely mechanical* conversion from (for example)
`gint` → `int`, `guint8` → `uint8_t`, etc.

It is not entirely complete, as many GLib functions are still used in
libsysprof-capture, which necessitate some use of GLib types.

It also avoids renaming `gboolean` → `bool` as that’s a slightly more
controversial change which will happen in the following commit.

*Code was manually realigned afterwards.

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

Helps: #40
2020-07-02 21:07:11 +01:00
b449baa205 libsysprof-capture: Move MappedRingBufferSource to libsysprof
As preparation for dropping the GLib dependency from libsysprof-capture,
move the `GSource` which links a `MappedRingBuffer` to a `GMainContext`
from libsysprof-capture to libsysprof.

This requires adding one new piece of API to libsysprof-capture to check
whether the `MappedRingBuffer` is empty.

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
16bf945d34 libsysprof-capture: Drop unnecessary #include
Signed-off-by: Philip Withnall <withnall@endlessm.com>

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

Correspondingly, add some missing `glib.h` includes.

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

Helps: #40
2020-07-02 21:07:11 +01:00
d1a8dc40f5 tests: 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
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
dbcf318096 examples: 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
2cc79dd444 build: bump ABI to 4 2020-07-02 21:07:11 +01:00
5f4c7c43d1 Update Ukrainian translation 2020-07-02 09:56:17 +00:00
fb581dd0d2 sysprof: add tooltip-text for open button 2020-07-01 17:50:50 -07:00
51021ece1a libsysprof-ui: use "Recording" instead of "Capture" 2020-07-01 17:50:36 -07:00
88df2711e3 Add Open button
Add a button to open capture files in headerbar. This caters to the
suggested usage of 'sysprof-cli' by exposing the funcitonality in a
prominent place.
2020-07-01 15:57:56 -07:00
03f32fe718 display: show message dialog when there is an error opening file
Fixes #42
2020-07-01 13:21:25 -07:00
71fa41248e app: present window before opening captures
This is necessary to ensure that message dialogs that are shown when a
capture fails to open can be displayed above the window.
2020-07-01 13:20:48 -07:00
fc474fb54b Merge branch 'more-misc-fixes' into 'master'
Misc fixes

See merge request GNOME/sysprof!28
2020-06-25 20:57:11 +00:00
1bfdcca9d1 build: Update bug report define in meson.build
GitLab!

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-06-25 14:58:42 +01:00
96ac1ae586 examples: Clarify that envvar isn’t unset after being used
Perhaps that was how sysprof used to behave, but it doesn’t seem to
behave like that now.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-06-25 14:58:01 +01:00
2be8cf7b2f Merge branch 'misc-fixes' into 'master'
Small fixes to the examples

See merge request GNOME/sysprof!27
2020-06-23 16:50:38 +00:00
2c216fcff9 examples: Fix a typo in a string
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-06-23 12:41:25 +01:00
af6308971d examples: Drop sysprof_clock_init() call from example
It’s implicitly called when setting up the `SysprofCaptureWriter`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-06-23 12:41:25 +01:00
7e103342be Merge branch 'wip/nielsdg/update-readme-for-mailing-list' into 'master'
README: Add links to GitLab and Discourse

See merge request GNOME/sysprof!26
2020-06-22 18:14:46 +00:00
e0cbb1c539 Add Ukrainian translation
(cherry picked from commit 5148ffbb9f25f5b65b42cca9ead630c73f963f5b)
2020-06-20 16:50:37 +00:00
7dc7f5d405 README: Add links to GitLab and Discourse 2020-06-14 09:44:17 +02:00
32185d873d Update Indonesian translation 2020-04-06 13:30:02 +00:00
cc6087db00 Updated Spanish translation 2020-04-06 08:31:31 +02:00
f0cc56f762 Update Ukrainian translation 2020-03-29 15:05:52 +00:00
6b7db886db Add Ukrainian translation
(cherry picked from commit 51ea8f355293d30c56265187258baa97f3652b6d)
2020-03-29 15:00:49 +00:00
187a6b0a0c Update Polish translation 2020-03-29 13:10:21 +02:00
f0207c159e Update Brazilian Portuguese translation 2020-03-28 11:24:02 +00:00
ee4926e0fd Updated Spanish translation 2020-03-26 15:52:26 +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
01d196abe4 libsysprof-collector: avoid formatting unless recording
We can avoid the process of creating the log message altogether if we are
not actively recording messages.
2020-03-16 12:28:04 -07:00
3d546eb6d1 libsysprof-capture: add sysprof_collector_log_printf()
This is a convenience function to call sysprof_collector_log() while also
formatting the message.

Ideally we'd be able to avoid the string format if we are not currently
collecting data, but that can be left for a future commit. We don't have
recursive locks so we need to duplicate the structure setup.
2020-03-16 12:28:04 -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