Commit Graph

23 Commits

Author SHA1 Message Date
Lennart Poettering
7167bee6c6 analyze: tab fix 2024-12-11 10:32:38 +01:00
hugo303
f172dfddde analyze: Add times in seconds for Activating and Activated in tooltip
Print the times in seconds in the tooltip to remove the need to count
and trying to follow the lines in the svg diagram in order to see at
what times these events happen.
2024-10-30 11:16:28 +01:00
Zbigniew Jędrzejewski-Szmek
23441a3d88 sd-json,tree-wide: add sd_json_format_enabled() and use it everwhere
We often used a pattern like if (!FLAGS_SET(flags, SD_JSON_FORMAT_OFF)),
which is rather verbose and also contains a double negative, which we try
to avoid. Add a little helper to avoid an explicit bit check.

This change clarifies an aditional thing: in some cases we treated
SD_JSON_FORMAT_OFF as a flag (flags & SD_JSON_FORMAT_OFF), while in other cases
we treated it as an independent enum value (flags == SD_JSON_FORMAT_OFF).
In the first form, flags like SD_JSON_FORMAT_SSE do _not_ turn the json
output on, while in the second form they do. Let's use the first form
everywhere.

No functional change intended.

Initially I wasn't sure if this helper should be made public or just internal,
but it seems such a common pattern that if we expose the flags, we might just
as well expose it too, to make life easier for any consumers.
2024-10-28 09:23:07 +01:00
Daan De Meyer
61808636a7 Merge pull request #34679 from DaanDeMeyer/bus-log
Various logging improvements
2024-10-09 11:42:26 +02:00
Daan De Meyer
d8a77d55e6 bus-util: Log more information when connecting to a bus socket fails
Let's log about which bus we're trying to connect to and what transport
we're using to do it.
2024-10-09 10:27:53 +02:00
Yu Watanabe
f769518c9a tree-wide: drop doubled empty lines 2024-10-07 09:51:37 +02:00
rajmohan r
1592d2f900 systemd-analyze: Add svg scaling options
+ Scale the x-axis of the resulting plot by a factor (default 1.0)
+ Add activation timestamps to each bar

Signed-off-by: rajmohan r <rajmohan.r@kpit.com>
2024-08-05 15:23:44 +02:00
Lennart Poettering
309a747fa6 libsystemd: turn json.[ch] into a public API
This is preparation for making our Varlink API a public API. Since our
Varlink API is built on top of our JSON API we need to make that public
first (it's a nice API, but JSON APIs there are already enough, this is
purely about the Varlink angle).

I made most of the json.h APIs public, and just placed them in
sd-json.h. Sometimes I wasn't so sure however, since the underlying data
structures would have to be made public too. If in doubt I didn#t risk
it, and moved the relevant API to src/libsystemd/sd-json/json-util.h
instead (without any sd_* symbol prefixes).

This is mostly a giant search/replace patch.
2024-06-12 18:42:22 +02:00
Luca Boccassi
b3f548615f core: rename SoftRebootStartTimestamp -> ShutdownStartTimestamp and generalize
Follow-up for 54f86b86ba
2024-04-17 18:19:27 +01:00
Luca Boccassi
e6bd341e7d analyze: fix plot with soft-reboot
Clamp times and start counting from when soft-reboot is started
to avoid creating a huge graph, like it's done for the user
instance.
2024-03-27 22:25:45 +00:00
Mike Yuan
e9a46668c3 macro: rename VA_ARGS_FOREACH to FOREACH_ARGUMENT
"VA_ARGS" is kinda confusing, as the macro just iterates through
all arguments passed and has nothing to do with va_arg.
2024-01-24 21:21:57 +08:00
Mike Yuan
2413a0fab4 format-table: introduce table_isempty and use it where appropriate 2023-12-25 17:47:18 +08:00
Jade Lovelace
ebaf55499f analyze: add tooltips with dependency information to "plot"
This helps a lot with figuring out why units were started when they
were, rather than guessing there is a dependency relation. We could
perhaps also do fun JavaScript things in the future to highlight
dependencies on mouse-over.
2023-10-03 22:50:25 -07:00
David Tardon
7bbfcf64b3 tree-wide: use timestamp_is_set() at more places 2023-05-24 16:41:37 +02:00
Yu Watanabe
63d7632d87 analyze: make blame command work even the default target not reached 2023-04-10 03:41:15 +09:00
Frantisek Sumsal
1da3cb8141 tree-wide: simplify x ? x : y to x ?: y where applicable 2023-03-18 14:23:11 +01:00
Lennart Poettering
4870133bfa basic: add RuntimeScope enum
In various tools and services we have a per-system and per-user concept.
So far we sometimes used a boolean indicating whether we are in system
mode, or a reversed boolean indicating whether we are in user mode, or
the LookupScope enum used by the lookup path logic.

Let's address that, in introduce a common enum for this, we can use all
across the board.

This is mostly just search/replace, no actual code changes.
2023-03-10 09:47:39 +01:00
Lennart Poettering
02b7005e38 tree-wide: unify how we pick OS pretty name to display 2023-01-24 15:32:42 +01:00
Joshua Zivkovic
ff46b2f97c systemd-analyze: Add table and JSON output implementation to plot 2023-01-18 14:33:08 +00:00
Zbigniew Jędrzejewski-Szmek
fddad5f4a6 analyze: allow verbs to return positive failure
No functional change is intended. The verbs where it wasn't immediately
clear if the success exit status is 0 or >= 0 are changed to explicitly
return 0. (I think it's better to be explicit than to rely on some call
stack always returning 0 on success.)

Some other functions are cleaned up to be more idiomatic.
2022-05-19 08:02:29 +02:00
Zbigniew Jędrzejewski-Szmek
b380b64383 Rename UnitFileScope to LookupScope
As suggested in
8b3ad3983f (r837345892)

The define is generalized and moved to path-lookup.h, where it seems to fit
better. This allows a recursive include to be removed and in general makes
things simpler.
2022-03-29 16:17:57 +02:00
Lennart Poettering
ef38bedbf9 analyze: systematically name verb entry point functions verb_xyz()
Some of the functions so far were named do_xyz(), others dump_xyz() and
even others test_xyz(). let's instead name them exactly like the verb
exposed in the command line, just prefixed with verb_
2022-02-21 17:22:23 +01:00
Lennart Poettering
ba474dada8 analyze: split out "plot" verb 2022-02-21 17:22:23 +01:00