summaryrefslogtreecommitdiff
path: root/src/analyze/analyze.c
AgeCommit message (Collapse)AuthorFilesLines
2019-07-16tree-wide: use lowercase table headersZbigniew Jędrzejewski-Szmek1-4/+4
https://github.com/systemd/systemd/pull/13062#discussion_r303847484 > the formatter uppercases them anyway, and this way the JSON output of the > formatter is nicer as it uses the table header fields 1:1 for the json > output.
2019-07-15analyze: fix formatting of timestamps with 0 µsZbigniew Jędrzejewski-Szmek1-5/+7
There is a rule that "%.0d" formats 0 as "". There is no such rule for "%0d" and 0 :(. The output had an extra 0 if usec was 0.
2019-07-16analyze: format output of 'systemd-analyze timestamp' by using TableYu Watanabe1-15/+69
2019-07-16analyze: format output of 'systemd-analyze timespan' by using TableYu Watanabe1-8/+54
2019-07-16analyze: format output of 'systemd-analyze calendar' by using TableYu Watanabe1-20/+93
2019-07-16analyze: format output of 'systemd-analyze blame' by using TableYu Watanabe1-10/+41
2019-07-04basic/time-util: add helper function to check if timestamp is setZbigniew Jędrzejewski-Szmek1-1/+1
No functional change.
2019-06-27analyze: add 'condition' verbZbigniew Jędrzejewski-Szmek1-0/+7
We didn't have a straightforward way to parse and evaluate those strings. Prompted by #12881.
2019-05-21analyze: also print unix time in "timestamp"Zbigniew Jędrzejewski-Szmek1-0/+6
2019-05-21analyze: give a hint about calendar/timestamp/timespan useZbigniew Jędrzejewski-Szmek1-6/+27
This should help clear up the confusion in https://bugzilla.redhat.com/show_bug.cgi?id=1711065.
2019-05-17analyze: add 'timestamp' verbZbigniew Jędrzejewski-Szmek1-3/+47
We had 'calendar' and 'timespan', but the third one was missing. Also consistently order the verbs as calendar/timestamp/timespan in help. The output from 'timespan' is highlighted more. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1711065.
2019-05-16analyze: drop redundant call to calendar_spec_normalize()Zbigniew Jędrzejewski-Szmek1-4/+0
calendar_spec_from_string() already does that.
2019-05-15analyze: fix help messageYu Watanabe1-2/+2
2019-05-08Enable log colors for most of tools in /usr/binZbigniew Jędrzejewski-Szmek1-0/+1
When emitting the calendarspec warning we want to see some color. Follow-up for 04220fda5c. Exceptions: - systemctl, because it has a lot hand-crafted coloring - tmpfiles, sysusers, stdio-bridge, etc, because they are also used in services and I'm not sure if this wouldn't mess up something.
2019-04-12code style format: clang-format applied to src/a*/*Sebastian Jennen1-71/+88
[zj: this is a subset of changes generated by clang-format, just the ones I think improve readability or consistency.] This is a part of https://github.com/systemd/systemd/pull/11811.
2019-03-29analyze: check both possible mount points of tracefsLennart Poettering1-3/+9
Let's try the new one first, the old one second.
2019-03-27headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek1-0/+1
This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
2019-03-15analyze: reword explanation in critical-chain headerZbigniew Jędrzejewski-Szmek1-2/+2
Let's try to make it a bit clearer.
2019-03-14util: split out nulstr related stuff to nulstr-util.[ch]Lennart Poettering1-0/+1
2019-03-13util: split out sorting related calls to new sort-util.[ch]Lennart Poettering1-1/+2
2019-02-22analyze: add color highlighting when printing calendar elapsesZbigniew Jędrzejewski-Szmek1-3/+7
With multiple iterations, I found it hard to pick out the interesting bits in the column of text. I tried plain highlighting first, but it doesn't seem enough. But blue/yellow makes it easy to jump to the right iteration.
2019-02-22analyze: split out loop innards into a separate functionZbigniew Jędrzejewski-Szmek1-56/+54
This was intended to be just a refactoring, but it also fixes a minor bug: after printing "never", we would skip subsequent expressions: $ systemd-analyze calendar --iterations=20 @0 @1 systemd-analyze calendar --iterations=20 @0 @1 Original form: @0 Normalized form: 1970-01-01 00:00:00 UTC Next elapse: never (the second expression was skipped).
2019-02-22analyze: optionally, show more than one elapse time for calendar expressionsLennart Poettering1-9/+41
2019-02-18analyze: generalize cat-config to apply to tmpfiles, presets, hwdb.d, etc.Zbigniew Jędrzejewski-Szmek1-0/+4
Fixes #10256. What works: systemd-analyze cat-config systemd/system-preset systemd-analyze cat-config systemd/user-preset systemd-analyze cat-config tmpfiles.d systemd-analyze cat-config sysusers.d systemd-analyze cat-config systemd/sleep.conf systemd-analyze cat-config systemd/user.conf systemd-analyze cat-config systemd/system.conf systemd-analyze cat-config udev/udev.conf (and other .conf files) systemd-analyze cat-config udev/rules.d systemd-analyze cat-config environment.d systemd-analyze cat-config environment Directories may be specified with the trailing dash or not. The caveat is that for user configuration, systemd and other tools also look at ~/.config/. It would be nice to support this, but this patch doesn't. "cat-config --user" is rejected, and we may allow it in the future and then extend the search path with directories under ~/.config. What doesn't work (and probably shouldn't because those files cannot be meaningfully concatenated): systemd-analyze cat-config systemd/system (.service, .slice, .socket, ...) systemd-analyze cat-config systemd/user systemd-analyze cat-config systemd/network (.network, .link, and .dnssd) The hardcoding of information about paths in this manner is a bit ugly, but OTOH, it is not too onerous, and at least we have one place where all the schemes are "documented" through code. It'll make us think twice before adding yet another slightly different scheme.
2019-02-18analyze: use SYNTHETIC_ERRNOZbigniew Jędrzejewski-Szmek1-18/+18
2018-12-21meson: generate version tag from gitZbigniew Jędrzejewski-Szmek1-1/+2
$ build/systemctl --version systemd 239-3555-g6178cbb5b5 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid $ git tag v240 -m 'v240' $ ninja -C build ninja: Entering directory `build' [76/76] Linking target fuzz-unit-file. $ build/systemctl --version systemd 240 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid This is very useful during development, because a precise version string is embedded in the build product and displayed during boot, so we don't have to guess answers for questions like "did I just boot the latest version or the one from before?". This change creates an overhead for "noop" builds. On my laptop, 'ninja -C build' that does nothing goes from 0.1 to 0.5 s. It would be nice to avoid this, but I think that <1 s is still acceptable. Fixes #7183. PACKAGE_VERSION is renamed to GIT_VERSION, to make it obvious that this is the more dynamically changing version string. Why save to a file? It would be easy to generate the version tag using run_command(), but we want to go through a file so that stuff gets rebuilt when this file changes. If we just defined an variable in meson, ninja wouldn't know it needs to rebuild things.
2018-12-14locale-util: prefix special glyph enum values with SPECIAL_GLYPH_Lennart Poettering1-3/+3
This has been irritating me for quite a while: let's prefix these enum values with a common prefix, like we do for almost all other enums. No change in behaviour, just some renaming.
2018-11-30analyze: add new security verbLennart Poettering1-0/+16
2018-11-30analyze: use strv_skip() where appropriateLennart Poettering1-3/+4
2018-11-30analyze: remove unnecessary negation of bus_error_message() error number ↵Lennart Poettering1-5/+5
parameter
2018-11-30analyze: fix include orderLennart Poettering1-1/+1
2018-11-24analyze: Fix build without seccomp (#10899)Michal Koutný1-1/+2
2018-11-22coccinelle: make use of SYNTHETIC_ERRNOZbigniew Jędrzejewski-Szmek1-24/+19
Ideally, coccinelle would strip unnecessary braces too. But I do not see any option in coccinelle for this, so instead, I edited the patch text using search&replace to remove the braces. Unfortunately this is not fully automatic, in particular it didn't deal well with if-else-if-else blocks and ifdefs, so there is an increased likelikehood be some bugs in such spots. I also removed part of the patch that coccinelle generated for udev, where we returns -1 for failure. This should be fixed independently.
2018-11-20Split out pretty-print.c and move pager.c and main-func.h to shared/Zbigniew Jędrzejewski-Szmek1-1/+2
This is high-level functionality, and fits better in shared/ (which is for our executables), than in basic/ (which is also for libraries).
2018-11-20analyze: use static destructorsYu Watanabe1-11/+9
2018-11-16analyze: add some minimal ANSI highlighting of syscall-filter outputLennart Poettering1-4/+13
2018-11-16analyze: show list of syscalls the kernel supports but not included in any ↵Lennart Poettering1-2/+79
group in the output This is quite useful for making sure our list is complete.
2018-11-14Merge pull request #10753 from keszybz/pager-no-interruptLennart Poettering1-8/+8
Add mode in journalctl where ^C is handled by the pager
2018-11-14basic/pager: convert the pager options to a flags argumentZbigniew Jędrzejewski-Szmek1-8/+8
Pretty much everything uses just the first argument, and this doesn't make this common pattern more complicated, but makes it simpler to pass multiple options.
2018-11-10id128,analyze: fix layout of help messageYu Watanabe1-3/+3
2018-10-23analyze: Add "timespan" command to dump time span in usecChris Down1-0/+27
This is useful for a couple of cases, I'm mostly interested in case #1: 1. Verifying "reasonable" values in a trivially scriptable way 2. Debugging unexpected time span parsing directly Test Plan: ``` % build/systemd-analyze timespan 20 Original: 20 μs: 20 Human: 20us % build/systemd-analyze timespan 20ms Original: 20ms μs: 20000 Human: 20ms % build/systemd-analyze timespan 20z Failed to parse time span '20z': Invalid argument ```
2018-10-19Merge pull request #10470 from yuwata/log-message-updatesLennart Poettering1-1/+1
Log message updates
2018-10-19tree-wide: replace 'unsigned int' with 'unsigned'Yu Watanabe1-4/+4
2018-10-20analyze: include error cause in the log messageYu Watanabe1-1/+1
2018-09-19tree-wide: use typesafe_qsort()Yu Watanabe1-14/+9
2018-08-23analyze: use temporary var to simplify codeZbigniew Jędrzejewski-Szmek1-4/+4
2018-08-20Merge pull request #9801 from yuwata/analyze-cleanupsZbigniew Jędrzejewski-Szmek1-130/+79
analyze: several improvements
2018-08-20tree-wide: add clickable man page link to all --help textsLennart Poettering1-3/+11
This is a bit like the info link in most of GNU's --help texts, but we don't do info but man pages, and we make them properly clickable on terminal supporting that, because awesome. I think it's generally advisable to link up our (brief) --help texts and our (more comprehensive) man pages a bit, so this should be an easy and straight-forward way to do it.
2018-08-07tree-wide: shorten error logging a bitYu Watanabe1-20/+10
Continuation of 4027f96aa08c73f109aa46b89842ca0e25c9c0e9.
2018-08-06analyze: fix condition for pretty printing kernel timeKirill Marinushkin1-4/+4
On target boards without RTC, `t->kernel_time` is 0 or 1 usec. `systemd-analyze` reads this value over D-Bus from `org.freedesktop.systemd1.Manager`, property `KernelTimestamp`. The issue is: if `t->kernel_time` is 0, `systemd-analyze` does not print the kernel time: ~~~~ $ systemd-analyze Startup finished in 1.860s (userspace) = 5.957s ~~~~ This commit fixes the misbehaviour: ~~~~ $ systemd-analyze Startup finished in 3.866s (kernel) + 2.015s (userspace) = 5.881s ~~~~ Fixes #7721. v2: fixes one more condition (by Yu Watanabe <watanabe.yu+github@gmail.com>) v3: fixes one more condition (by Kirill Marinushkin <kmarinushkin@de.adit-jv.com>)