X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fanalyze%2Fsystemd-analyze.c;h=01bf55eda59971f9bf905b7a4b73433cad498323;hb=b8beb2781682738f3a59aab993bf2869447a77c9;hp=762016d61686e4eace30a415dc6f6b2fedde5439;hpb=c170f3a41bc69ad1eab2dba40cede865f2532bbc;p=elogind.git
diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
index 762016d61..01bf55eda 100644
--- a/src/analyze/systemd-analyze.c
+++ b/src/analyze/systemd-analyze.c
@@ -3,7 +3,8 @@
/***
This file is part of systemd.
- Copyright 2010 Lennart Poettering
+ Copyright 2010-2013 Lennart Poettering
+ Copyright 2013 Simon Peeters
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
@@ -33,6 +34,9 @@
#include "strxcpyx.h"
#include "fileio.h"
+#define SCALE_X (0.1 / 1000.0) /* pixels per us */
+#define SCALE_Y 20.0
+
#define compare(a, b) (((a) > (b))? 1 : (((b) > (a))? -1 : 0))
#define svg(...) printf(__VA_ARGS__)
@@ -40,12 +44,12 @@
#define svg_bar(class, x1, x2, y) \
svg(" \n", \
(class), \
- scale_x * (x1), scale_y * (y), \
- scale_x * ((x2) - (x1)), scale_y - 1.0)
+ SCALE_X * (x1), SCALE_Y * (y), \
+ SCALE_X * ((x2) - (x1)), SCALE_Y - 1.0)
#define svg_text(b, x, y, format, ...) \
do { \
- svg(" ", (b) ? "left" : "right", scale_x * (x) + (b ? 5.0 : -5.0), scale_y * (y) + 14.0); \
+ svg(" ", (b) ? "left" : "right", SCALE_X * (x) + (b ? 5.0 : -5.0), SCALE_Y * (y) + 14.0); \
svg(format, ## __VA_ARGS__); \
svg("\n"); \
} while(false)
@@ -57,9 +61,6 @@ static enum dot {
DEP_REQUIRE
} arg_dot = DEP_ALL;
-static double scale_x = 0.1 / 1000.0; /* pixels per us */
-static double scale_y = 20.0;
-
struct boot_times {
usec_t firmware_time;
usec_t loader_time;
@@ -357,21 +358,21 @@ static void svg_graph_box(double height, double begin, double end) {
/* outside box, fill */
svg("\n",
- scale_x * (end - begin), scale_y * height);
+ SCALE_X * (end - begin), SCALE_Y * height);
for (i = ((long long) (begin / 100000)) * 100000; i <= end; i+=100000) {
/* lines for each second */
if (i % 5000000 == 0)
svg(" \n"
" %.01fs\n",
- scale_x * i, scale_x * i, scale_y * height, scale_x * i, -5.0, 0.000001 * i);
+ SCALE_X * i, SCALE_X * i, SCALE_Y * height, SCALE_X * i, -5.0, 0.000001 * i);
else if (i % 1000000 == 0)
svg(" \n"
" %.01fs\n",
- scale_x * i, scale_x * i, scale_y * height, scale_x * i, -5.0, 0.000001 * i);
+ SCALE_X * i, SCALE_X * i, SCALE_Y * height, SCALE_X * i, -5.0, 0.000001 * i);
else
svg(" \n",
- scale_x * i, scale_x * i, scale_y * height);
+ SCALE_X * i, SCALE_X * i, SCALE_Y * height);
}
}
@@ -401,7 +402,7 @@ static int analyze_plot(DBusConnection *bus) {
qsort(times, n, sizeof(struct unit_times), compare_unit_start);
- width = scale_x * (boot->firmware_time + boot->finish_time);
+ width = SCALE_X * (boot->firmware_time + boot->finish_time);
if (width < 800.0)
width = 800.0;
@@ -426,7 +427,7 @@ static int analyze_plot(DBusConnection *bus) {
u->name = NULL;
continue;
}
- len = ((boot->firmware_time + u->ixt) * scale_x)
+ len = ((boot->firmware_time + u->ixt) * SCALE_X)
+ (10.0 * strlen(u->name));
if (len > width)
width = len;
@@ -449,7 +450,7 @@ static int analyze_plot(DBusConnection *bus) {
svg("