[systemd-commits] 3 commits - src/analyze src/core
Thomas H.P. Andersen
phomes at kemper.freedesktop.org
Sun Jun 2 11:31:18 PDT 2013
src/analyze/systemd-analyze.c | 67 +++++++++++++++++++++++++++++++++++-------
src/core/dbus-manager.c | 16 ++++++++++
src/core/manager.c | 4 ++
src/core/manager.h | 4 ++
4 files changed, 81 insertions(+), 10 deletions(-)
New commits:
commit 2b7d6965be9a06dadfc971d0d37fc9b2ef0cad7a
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date: Wed May 15 21:52:07 2013 +0200
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.
diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
index 6d97256..fe1abdc 100644
--- a/src/analyze/systemd-analyze.c
+++ b/src/analyze/systemd-analyze.c
@@ -512,10 +512,10 @@ static int analyze_plot(DBusConnection *bus) {
"// line.sec1 { }\n"
" line.sec5 { stroke-width: 2; }\n"
" line.sec01 { stroke: rgb(224,224,224); stroke-width: 1; }\n"
- " text { font-family: Verdana, Helvetica; font-size: 10; }\n"
- " text.left { font-family: Verdana, Helvetica; font-size: 10; text-anchor: start; }\n"
- " text.right { font-family: Verdana, Helvetica; font-size: 10; text-anchor: end; }\n"
- " text.sec { font-size: 8; }\n"
+ " text { font-family: Verdana, Helvetica; font-size: 14px; }\n"
+ " text.left { font-family: Verdana, Helvetica; font-size: 14px; text-anchor: start; }\n"
+ " text.right { font-family: Verdana, Helvetica; font-size: 14px; text-anchor: end; }\n"
+ " text.sec { font-size: 10px; }\n"
" ]]>\n </style>\n</defs>\n\n");
svg("<text x=\"20\" y=\"50\">%s</text>", pretty_times);
commit d9acfb71dbfb6e916b9752593158698b8021b28c
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date: Wed May 15 21:18:26 2013 +0200
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.
diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
index df3d307..6d97256 100644
--- a/src/analyze/systemd-analyze.c
+++ b/src/analyze/systemd-analyze.c
@@ -80,6 +80,8 @@ struct boot_times {
usec_t finish_time;
usec_t generators_start_time;
usec_t generators_finish_time;
+ usec_t unitsload_start_time;
+ usec_t unitsload_finish_time;
};
struct unit_times {
char *name;
@@ -315,7 +317,17 @@ static int acquire_boot_times(DBusConnection *bus, struct boot_times **bt) {
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"GeneratorsFinishTimestampMonotonic",
- ×.generators_finish_time) < 0)
+ ×.generators_finish_time) < 0 ||
+ bus_get_uint64_property(bus,
+ "/org/freedesktop/systemd1",
+ "org.freedesktop.systemd1.Manager",
+ "UnitsLoadStartTimestampMonotonic",
+ ×.unitsload_start_time) < 0 ||
+ bus_get_uint64_property(bus,
+ "/org/freedesktop/systemd1",
+ "org.freedesktop.systemd1.Manager",
+ "UnitsLoadFinishTimestampMonotonic",
+ ×.unitsload_finish_time) < 0)
return -EIO;
if (times.finish_time <= 0) {
@@ -472,7 +484,7 @@ static int analyze_plot(DBusConnection *bus) {
svg("<svg width=\"%.0fpx\" height=\"%.0fpx\" version=\"1.1\" "
"xmlns=\"http://www.w3.org/2000/svg\">\n\n",
80.0 + width, 150.0 + (m * SCALE_Y) +
- 4 * SCALE_Y /* legend */);
+ 5 * SCALE_Y /* legend */);
/* write some basic info as a comment, including some help */
svg("<!-- This file is a systemd-analyze SVG file. It is best rendered in a -->\n"
@@ -494,6 +506,7 @@ static int analyze_plot(DBusConnection *bus) {
" rect.loader { fill: rgb(150,150,150); fill-opacity: 0.7; }\n"
" rect.userspace { fill: rgb(150,150,150); fill-opacity: 0.7; }\n"
" rect.generators { fill: rgb(102,204,255); fill-opacity: 0.7; }\n"
+ " rect.unitsload { fill: rgb( 82,184,255); fill-opacity: 0.7; }\n"
" rect.box { fill: rgb(240,240,240); stroke: rgb(192,192,192); }\n"
" line { stroke: rgb(64,64,64); stroke-width: 1; }\n"
"// line.sec1 { }\n"
@@ -535,6 +548,7 @@ static int analyze_plot(DBusConnection *bus) {
}
svg_bar("active", boot->userspace_time, boot->finish_time, y);
svg_bar("generators", boot->generators_start_time, boot->generators_finish_time, y);
+ svg_bar("unitsload", boot->unitsload_start_time, boot->unitsload_finish_time, y);
svg_text("left", boot->userspace_time, y, "systemd");
y++;
@@ -572,6 +586,9 @@ static int analyze_plot(DBusConnection *bus) {
svg_bar("generators", 0, 300000, y);
svg_text("right", 400000, y, "Generators");
y++;
+ svg_bar("unitsload", 0, 300000, y);
+ svg_text("right", 400000, y, "Loading unit files");
+ y++;
svg("</g>\n\n");
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 988c06a..25d38cc 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -286,6 +286,10 @@
" <property name=\"GeneratorsStartTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"GeneratorsFinishTimestamp\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"GeneratorsFinishTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"UnitsLoadStartTimestamp\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"UnitsLoadStartTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"UnitsLoadFinishTimestamp\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"UnitsLoadFinishTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"LogLevel\" type=\"s\" access=\"readwrite\"/>\n" \
" <property name=\"LogTarget\" type=\"s\" access=\"readwrite\"/>\n" \
" <property name=\"NNames\" type=\"u\" access=\"read\"/>\n" \
@@ -595,6 +599,10 @@ static const BusProperty bus_manager_properties[] = {
{ "GeneratorsStartTimestampMonotonic", bus_property_append_uint64, "t", offsetof(Manager, generators_start_timestamp.monotonic) },
{ "GeneratorsFinishTimestamp", bus_property_append_uint64, "t", offsetof(Manager, generators_finish_timestamp.realtime) },
{ "GeneratorsFinishTimestampMonotonic", bus_property_append_uint64, "t", offsetof(Manager, generators_finish_timestamp.monotonic) },
+ { "UnitsLoadStartTimestamp", bus_property_append_uint64, "t", offsetof(Manager, unitsload_start_timestamp.realtime) },
+ { "UnitsLoadStartTimestampMonotonic", bus_property_append_uint64, "t", offsetof(Manager, unitsload_start_timestamp.monotonic) },
+ { "UnitsLoadFinishTimestamp", bus_property_append_uint64, "t", offsetof(Manager, unitsload_finish_timestamp.realtime) },
+ { "UnitsLoadFinishTimestampMonotonic", bus_property_append_uint64, "t", offsetof(Manager, unitsload_finish_timestamp.monotonic) },
{ "LogLevel", bus_manager_append_log_level, "s", 0, false, bus_manager_set_log_level },
{ "LogTarget", bus_manager_append_log_target, "s", 0, false, bus_manager_set_log_target },
{ "NNames", bus_manager_append_n_names, "u", 0 },
diff --git a/src/core/manager.c b/src/core/manager.c
index 73f4c10..f16621a 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -847,7 +847,9 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
m->n_reloading ++;
/* First, enumerate what we can from all config files */
+ dual_timestamp_get(&m->unitsload_start_timestamp);
r = manager_enumerate(m);
+ dual_timestamp_get(&m->unitsload_finish_timestamp);
/* Second, deserialize if there is something to deserialize */
if (serialization) {
diff --git a/src/core/manager.h b/src/core/manager.h
index 5d777e6..dcc4ebe 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -152,6 +152,8 @@ struct Manager {
dual_timestamp finish_timestamp;
dual_timestamp generators_start_timestamp;
dual_timestamp generators_finish_timestamp;
+ dual_timestamp unitsload_start_timestamp;
+ dual_timestamp unitsload_finish_timestamp;
char *generator_unit_path;
char *generator_unit_path_early;
commit 518d10e98508ec8181e864924484a2ca994c5d43
Author: Umut Tezduyar <umut at tezduyar.com>
Date: Wed May 8 14:29:12 2013 +0200
analyze: show generators on plot
diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
index bb86ec7..df3d307 100644
--- a/src/analyze/systemd-analyze.c
+++ b/src/analyze/systemd-analyze.c
@@ -78,6 +78,8 @@ struct boot_times {
usec_t initrd_time;
usec_t userspace_time;
usec_t finish_time;
+ usec_t generators_start_time;
+ usec_t generators_finish_time;
};
struct unit_times {
char *name;
@@ -303,7 +305,17 @@ static int acquire_boot_times(DBusConnection *bus, struct boot_times **bt) {
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"FinishTimestampMonotonic",
- ×.finish_time) < 0)
+ ×.finish_time) < 0 ||
+ bus_get_uint64_property(bus,
+ "/org/freedesktop/systemd1",
+ "org.freedesktop.systemd1.Manager",
+ "GeneratorsStartTimestampMonotonic",
+ ×.generators_start_time) < 0 ||
+ bus_get_uint64_property(bus,
+ "/org/freedesktop/systemd1",
+ "org.freedesktop.systemd1.Manager",
+ "GeneratorsFinishTimestampMonotonic",
+ ×.generators_finish_time) < 0)
return -EIO;
if (times.finish_time <= 0) {
@@ -459,7 +471,8 @@ static int analyze_plot(DBusConnection *bus) {
svg("<svg width=\"%.0fpx\" height=\"%.0fpx\" version=\"1.1\" "
"xmlns=\"http://www.w3.org/2000/svg\">\n\n",
- 80.0 + width, 150.0 + (m * SCALE_Y));
+ 80.0 + width, 150.0 + (m * SCALE_Y) +
+ 4 * SCALE_Y /* legend */);
/* write some basic info as a comment, including some help */
svg("<!-- This file is a systemd-analyze SVG file. It is best rendered in a -->\n"
@@ -480,6 +493,7 @@ static int analyze_plot(DBusConnection *bus) {
" rect.firmware { fill: rgb(150,150,150); fill-opacity: 0.7; }\n"
" rect.loader { fill: rgb(150,150,150); fill-opacity: 0.7; }\n"
" rect.userspace { fill: rgb(150,150,150); fill-opacity: 0.7; }\n"
+ " rect.generators { fill: rgb(102,204,255); fill-opacity: 0.7; }\n"
" rect.box { fill: rgb(240,240,240); stroke: rgb(192,192,192); }\n"
" line { stroke: rgb(64,64,64); stroke-width: 1; }\n"
"// line.sec1 { }\n"
@@ -495,8 +509,6 @@ static int analyze_plot(DBusConnection *bus) {
svg("<text x=\"20\" y=\"30\">%s %s (%s %s) %s</text>",
isempty(osname) ? "Linux" : osname,
name.nodename, name.release, name.version, name.machine);
- svg("<text x=\"20\" y=\"%.0f\">Legend: Red = Activating; Pink = Active; Dark Pink = Deactivating</text>",
- 120.0 + (m *SCALE_Y));
svg("<g transform=\"translate(%.3f,100)\">\n", 20.0 + (SCALE_X * boot->firmware_time));
svg_graph_box(m, -boot->firmware_time, boot->finish_time);
@@ -521,8 +533,9 @@ static int analyze_plot(DBusConnection *bus) {
svg_text(true, boot->initrd_time, y, "initrd");
y++;
}
- svg_bar("userspace", boot->userspace_time, boot->finish_time, y);
- svg_text("left", boot->userspace_time, y, "userspace");
+ svg_bar("active", boot->userspace_time, boot->finish_time, y);
+ svg_bar("generators", boot->generators_start_time, boot->generators_finish_time, y);
+ svg_text("left", boot->userspace_time, y, "systemd");
y++;
for (u = times; u < times + n; u++) {
@@ -544,6 +557,23 @@ static int analyze_plot(DBusConnection *bus) {
svg_text(b, u->ixt, y, "%s", u->name);
y++;
}
+
+ /* Legend */
+ y++;
+ svg_bar("activating", 0, 300000, y);
+ svg_text("right", 400000, y, "Activating");
+ y++;
+ svg_bar("active", 0, 300000, y);
+ svg_text("right", 400000, y, "Active");
+ y++;
+ svg_bar("deactivating", 0, 300000, y);
+ svg_text("right", 400000, y, "Deactivating");
+ y++;
+ svg_bar("generators", 0, 300000, y);
+ svg_text("right", 400000, y, "Generators");
+ y++;
+
+
svg("</g>\n\n");
svg("</svg>");
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index f3ddfc9..988c06a 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -282,6 +282,10 @@
" <property name=\"UserspaceTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"FinishTimestamp\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"FinishTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"GeneratorsStartTimestamp\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"GeneratorsStartTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"GeneratorsFinishTimestamp\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"GeneratorsFinishTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"LogLevel\" type=\"s\" access=\"readwrite\"/>\n" \
" <property name=\"LogTarget\" type=\"s\" access=\"readwrite\"/>\n" \
" <property name=\"NNames\" type=\"u\" access=\"read\"/>\n" \
@@ -587,6 +591,10 @@ static const BusProperty bus_manager_properties[] = {
{ "UserspaceTimestampMonotonic", bus_property_append_uint64, "t", offsetof(Manager, userspace_timestamp.monotonic) },
{ "FinishTimestamp", bus_property_append_uint64, "t", offsetof(Manager, finish_timestamp.realtime) },
{ "FinishTimestampMonotonic", bus_property_append_uint64, "t", offsetof(Manager, finish_timestamp.monotonic) },
+ { "GeneratorsStartTimestamp", bus_property_append_uint64, "t", offsetof(Manager, generators_start_timestamp.realtime) },
+ { "GeneratorsStartTimestampMonotonic", bus_property_append_uint64, "t", offsetof(Manager, generators_start_timestamp.monotonic) },
+ { "GeneratorsFinishTimestamp", bus_property_append_uint64, "t", offsetof(Manager, generators_finish_timestamp.realtime) },
+ { "GeneratorsFinishTimestampMonotonic", bus_property_append_uint64, "t", offsetof(Manager, generators_finish_timestamp.monotonic) },
{ "LogLevel", bus_manager_append_log_level, "s", 0, false, bus_manager_set_log_level },
{ "LogTarget", bus_manager_append_log_target, "s", 0, false, bus_manager_set_log_target },
{ "NNames", bus_manager_append_n_names, "u", 0 },
diff --git a/src/core/manager.c b/src/core/manager.c
index 6b0f567..73f4c10 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -826,7 +826,9 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
assert(m);
+ dual_timestamp_get(&m->generators_start_timestamp);
manager_run_generators(m);
+ dual_timestamp_get(&m->generators_finish_timestamp);
r = lookup_paths_init(
&m->lookup_paths, m->running_as, true,
diff --git a/src/core/manager.h b/src/core/manager.h
index bf83354..5d777e6 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -150,6 +150,8 @@ struct Manager {
dual_timestamp initrd_timestamp;
dual_timestamp userspace_timestamp;
dual_timestamp finish_timestamp;
+ dual_timestamp generators_start_timestamp;
+ dual_timestamp generators_finish_timestamp;
char *generator_unit_path;
char *generator_unit_path_early;
More information about the systemd-commits
mailing list