Commit graph

346 commits

Author SHA1 Message Date
Thomas Hindoe Paaboel Andersen 95168f7d55 analyze: plot: place the text on the side with most space
Set the width of the svg to always fit the longest string
while taking its starting position into consideration.

Place the text on the right while the starting point is
in the first half of the screen. After that we put it on
the left to save the svg from being wider that it has to.
2013-11-01 23:14:11 +01:00
Thomas Hindoe Paaboel Andersen 6e6ca4a5cc analyze: share code to read a string array from sd-bus 2013-10-31 23:15:32 +01:00
Thomas Hindoe Paaboel Andersen a936124f7a analyze: use sd_bus_get_propery_trivial and indentation 2013-10-31 23:08:16 +01:00
Lennart Poettering 5220a6f3a1 general: various cleanups 2013-10-30 16:13:43 +01:00
Thomas Hindoe Paaboel Andersen 048ecf5b84 analyze: port to sd-bus 2013-10-25 20:59:01 +02:00
Kay Sievers b0770377ab analyze: systemd-analyze.c -> analyze.c 2013-10-22 13:55:50 +02:00
Thomas Hindoe Paaboel Andersen 418e37506e analyze: set white backgound
In programs like eog and gimp the transparant background did not
look very good.

https://bugs.freedesktop.org/show_bug.cgi?id=70720
2013-10-21 21:36:15 +02:00
Zbigniew Jędrzejewski-Szmek 872c8faaf2 Fix write-only use of a few variables
Since the invention of read-only memory, write-only memory has been
considered deprecated. Where appropriate, either make use of the
value, or avoid writing it, to make it clear that it is not used.
2013-10-13 17:56:54 -04:00
Zbigniew Jędrzejewski-Szmek 7ff7394d9e Never call qsort on potentially NULL arrays
This extends 62678ded 'efi: never call qsort on potentially
NULL arrays' to all other places where qsort is used and it
is not obvious that the count is non-zero.
2013-10-13 17:56:54 -04:00
Lennart Poettering a65615ca5d systemctl: move set-log-level to systemd-analyze
"systemctl set-log-level" is a command for analysis and tracing hence
"systemd-analyze" should be the better home for it, thus allowing us to
make the overly large "systemctl" a bit smaller.
2013-07-26 16:59:55 +02:00
Lennart Poettering 9ea9d4cf16 systemctl: move "dump" command from systemctl to systemd-analyze
It's an analysis command and its format is explicitly not covered by any
stability guarantees, hence move away from systemctl and into
systemd-analyze, minimizing the already large interface of systemctl a
bit.

This patch also adds auto-paging to the various systemd-analyze commands
where that makes sense
2013-07-26 16:36:25 +02:00
Gabriel de Perthuis 805bf39ce7 systemd-analyze: Show critical chains for listed units 2013-06-14 16:21:41 -04:00
Thomas Hindoe Paaboel Andersen 2b7d6965be analyze: fix font size on plot
The font-size was missing a unit so they were ignored. This patch sets
the unit to 'px' and adjusts the sizes a bit as the text got very small.
2013-06-02 22:29:31 +02:00
Thomas Hindoe Paaboel Andersen d9acfb71db analyze: show unit file loading on plot
This will add another color to the legend called "Loading unit files"
Like the generators it will mark a part of the systemd bar indicating
the time spent while loading unit files.
2013-06-02 22:26:13 +02:00
Umut Tezduyar 518d10e985 analyze: show generators on plot 2013-06-02 22:26:05 +02:00
Zbigniew Jędrzejewski-Szmek 38158b920e cgls: add --machine/-M
cg_get_machine_path is modified to include the escaped machine name
+ ".nspawn" if the machine argument is nonnull.
2013-05-01 10:15:25 -04:00
Zbigniew Jędrzejewski-Szmek 96de7c047f zsh-completion: add s-a critical-chain 2013-05-01 09:59:24 -04:00
Harald Hoyer bb150966c0 systemd-analyse: add "critical-chain" command
"critical-chain" prints a tree of the critical chain of units

$ ./systemd-analyze critical-chain
graphical.target @1.226s
└─multi-user.target @1.226s
  └─nfs-lock.service @961ms +265ms
    └─rpcbind.service @958ms +1ms
      └─network.target @957ms
        └─NetworkManager.service @434ms +522ms
          └─basic.target @428ms
            └─sockets.target @428ms
              └─dbus.socket @428ms
                └─sysinit.target @427ms
                  └─systemd-tmpfiles-setup.service @411ms +15ms
                    └─local-fs.target @410ms
                      └─boot-efi.automount @410ms
                        └─boot.mount @397ms +9ms
                          └─local-fs-pre.target @192ms
                            └─systemd-udevd.service @187ms +5ms
                              └─systemd-udevd-control.socket @140ms
                                └─-.mount

With the "--fuzz=<ms>" parameter one can display more units around
the critical units.

$ ./systemd-analyze --fuzz=10ms critical-chain
└─multi-user.target @1.226s
  └─nfs-lock.service @961ms +265ms
    ├─rpcbind.service @958ms +1ms
    │ └─network.target @957ms
    │   └─NetworkManager.service @434ms +522ms
    │     ├─basic.target @428ms
    │     │ ├─sockets.target @428ms
    │     │ │ ├─dbus.socket @428ms
    │     │ │ │ └─sysinit.target @427ms
    │     │ │ │   ├─systemd-tmpfiles-setup.service @411ms +15ms
    │     │ │ │   │ └─local-fs.target @410ms
    │     │ │ │   │   └─boot-efi.automount @410ms
    │     │ │ │   │     └─boot.mount @397ms +9ms
    │     │ │ │   │       └─local-fs-pre.target @192ms
    │     │ │ │   │         └─systemd-udevd.service @187ms +5ms
    │     │ │ │   │           ├─systemd-udevd-control.socket @140ms
    │     │ │ │   │           │ └─-.mount
    │     │ │ │   │           └─systemd-udevd-kernel.socket @140ms
    │     │ │ │   └─swap.target @421ms
    │     │ │ │     └─dev-disk-by\x2duuid-....swap @414ms +6ms
    │     │ │ │       └─systemd-journald.socket
    │     │ │ ├─rpcbind.socket @428ms
    │     │ │ └─cups.socket @428ms
    │     │ ├─paths.target @428ms
    │     │ │ └─cups.path @428ms
    │     │ ├─timers.target @427ms
    │     │ │ └─systemd-tmpfiles-clean.timer @427ms
    │     │ └─sysinit.target @427ms
    │     │   └─...
    │     └─dbus.socket @428ms
    │       └─...
    └─network.target @957ms
      └─...
2013-04-26 13:34:22 +02:00
Lennart Poettering 816f25e86a analyze: various cleanups 2013-04-08 20:35:25 +02:00
Lennart Poettering 903a0b07e0 analyze: fix OOM handling + fix memory leak 2013-04-08 20:35:25 +02:00
Lennart Poettering f5b7a3fb53 analyze: add missing --help text entries 2013-04-08 20:35:25 +02:00
Łukasz Stelmach e55933db18 systemd-analyze: filter dot output
Make "systemd-analyze dot" output only lines with units matching
given glob(7) patterns. Add --from-pattern and --to-pattern options.
Without any patterns all relationships are printed as before.

A relationship must match the follwing expression:

    (isempty(from) || from[0] || from[1] || .. || from[n]) &&
    (isempty(to) || to[0] || to[1] || .. || to[n]) &&
    (isempty(P) || P[0] || P[1] || ... || P[n])

where from[] and to[] are lists of patterns provided with subsequent
--from-pattern and --to-pattern respectively. P[] is a list of  additional
patterns provided after the "dot" subcommand.
2013-04-08 20:35:25 +02:00
Lennart Poettering 2fa4092c28 util: make time formatting a bit smarter
Instead of outputting "5h 55s 50ms 3us" we'll now output "5h
55.050003s". Also, while outputting the accuracy is configurable.

Basically we now try use "dot notation" for all time values > 1min. For
>= 1s we use 's' as unit, otherwise for >= 1ms we use 'ms' as unit, and
finally 'us'.

This should give reasonably values in most cases.
2013-04-04 02:56:56 +02:00
Zbigniew Jędrzejewski-Szmek fd4a5ec6fa systemd-analyze: do not format timestamp when not printing it
../src/analyze/systemd-analyze.c:530:88: warning: data argument not used by format string [-Wformat-extra-args]
  ...svg_text(false, u->ixt, y, u->time? "%s (%s)" : "%s", u->name, format_timespan(ts, sizeof(ts), u->time));
                                                     ~~~~           ^
2013-03-20 19:16:01 -04:00
Lennart Poettering 2f6eb835ca analyze: use defines where we don't need static variables 2013-03-08 19:10:24 +01:00
Lennart Poettering ffaa0e2503 analyze: by now, systemd-analyze is hardly all my work 2013-03-08 19:03:50 +01:00
Lennart Poettering c170f3a41b analyze: various cleanups
Update systemd-analyze to follow the coding style of the other tools
more closely. Also, update the CODING_STYLE to document this for future
additions.

Changes:

- Always use usec_t for time units, so that we always use the same types
  everywhere, and format times the same way as everywhere else.

- Add "static" to global variables

- Make sure we can always distuingish OOM and other errors: ensure we
  always return useful error codes from all functions.

- Always free unit_times array
2013-03-08 18:58:08 +01:00
Lukas Nykryn 4534824035 systemd-analyze: free unit_times only if it is not NULL 2013-03-01 16:43:57 -05:00
Harald Hoyer a5c32cff1f honor SELinux labels, when creating and writing config files
Also split out some fileio functions to fileio.c and provide a SELinux
aware pendant in fileio-label.c

see https://bugzilla.redhat.com/show_bug.cgi?id=881577
2013-02-14 16:19:38 +01:00
Simon Peeters 1700761b06 Move systemctl dot to systemd-analyze dot 2013-02-13 14:47:05 -08:00
Simon Peeters 2265fbf7e5 systemd-analyze: rewrite in C.
Written by Peeters Simon <peeters.simon@gmail.com>.
Makefile stuff and cleaned up a bit by Auke Kok <auke-jan.h.kok@intel.com>.
Some code inspired by Marc-Antoine Perennou <Marc-Antoine@Perennou.com>.
2013-02-13 14:46:50 -08:00
Thomas Hindoe Paaboel Andersen b929bf049d tabs to spaces
Skipped bootchart and various files that looked like they should be
kept in sync with external sources.
2013-01-09 21:20:43 +01:00
Lennart Poettering 6ee667aeeb analyze: add emacs mode header 2013-01-08 01:27:18 +01:00
Kay Sievers a0169f00e5 analyze: add .gitignore 2013-01-06 16:18:48 +01:00
Zbigniew Jędrzejewski-Szmek 2f4da3e6c2 systemd-analyze: use specified binary, add --version
Python binary used in the she-bang line in installed
scripts can be set with ./configure PYTHON_BINARY=...
Defaults to the same path as python used during compilation.

Adding --version makes systemd-analyze behave consistently with the
rest of installed programs.

The lines in ./configure output are reordered to keep all yes/no lines
separate.  I think that this makes the output clearer.
2013-01-04 22:20:35 -05:00
Zbigniew Jędrzejewski-Szmek bbed6c0d4b systemd-analyze: pipe through SED_PROCESS
To be able to add --version and change python binary.
2013-01-04 21:57:55 -05:00
Zbigniew Jędrzejewski-Szmek 0250d95659 systemd-analyze: reword comments 2013-01-04 21:57:55 -05:00
Lennart Poettering 3ec90c0300 analyze: properly parse firmware/loader time and handle times for container boots correctly 2012-12-31 21:24:26 +01:00
Zbigniew Jędrzejewski-Szmek 0c0271841a systemd-analyze: use argparse instead of getopt
Makes the output way nicer with shorter code. Also brings
systemd-analyze behaviour more in line with other systemd-programs.

Argparse is in Python since 2.6, and is available as a package for
previous versions, if someone is stuck with very old Python.
2012-11-13 02:23:02 +01:00
Cosimo Cecchi 4940c64240 analyze: use GDBus instead of dbus-python 2012-11-02 16:54:28 +01:00
Lennart Poettering 915b375388 manager: extend performance measurement interface to include firmware/loader times
This only adds the fields to the D-Bus interfaces but doesn't fill them
in with anything useful yet. Gummiboot exposes the necessary bits of
information to use however and as soon as I get my fingers on a proper
UEFI laptop I'll hook up the remaining bits.

Since we want to stabilize the D-Bus interface soon and include it in
the stability promise we should get the last fixes in, hence this change
now.
2012-09-13 18:54:32 +02:00
Shawn Landden e23637b649 analyze: Python 3 compatibility
Plot verb doesn't currently work b/c Cairo bug sending to stdout in python 3.
2012-06-19 19:47:43 +02:00
Shawn Landden 927735238d systemd-analyze: switch to python getopt for argument parsing
this uses gnu style getopt, so you can put the opts at the end: (e.g.)
systemd-analyze blame --user

v4
2012-05-22 01:34:19 +02:00
Patrick McCarty 6fc08fc789 systemd-analyze: add a --user option to support user instances 2012-05-04 00:57:26 +02:00
Lennart Poettering b562f5a57d build-sys: add stub makefiles to all subdirs to ease development with emacs 2012-04-13 21:37:59 +02:00
Lennart Poettering 64695e53a0 build-sys: drop systemd- prefix from analyze dir 2012-04-13 13:34:09 +02:00