<div dir="ltr">Hi,<div><br></div><div>Attached is a screen shot of the new legend area. It is placed on exactly where the previous text based legend was.</div><div style><br></div><div class="gmail_extra"><br>On Tue, May 14, 2013 at 8:52 AM, Thomas H.P. Andersen <span dir="ltr"><<a href="mailto:phomes@gmail.com" target="_blank">phomes@gmail.com</a>></span> wrote:<br>
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">On Wed, May 8, 2013 at 6:03 PM, Umut Tezduyar <<a href="mailto:umut@tezduyar.com">umut@tezduyar.com</a>> wrote:<br>
</div><div><div class="h5">> ---<br>
> src/analyze/systemd-analyze.c | 42 ++++++++++++++++++++++++++++----<br>
> src/core/dbus-manager.c | 8 ++++++<br>
> src/core/manager.c | 2 +<br>
> src/core/manager.h | 2 +<br>
> 4 files changed, 48 insertions(+), 6 deletions(-)<br>
><br>
> diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c<br>
> index bb86ec7..df3d307 100644<br>
> --- a/src/analyze/systemd-analyze.c<br>
> +++ b/src/analyze/systemd-analyze.c<br>
> @@ -78,6 +78,8 @@ struct boot_times {<br>
> usec_t initrd_time;<br>
> usec_t userspace_time;<br>
> usec_t finish_time;<br>
> + usec_t generators_start_time;<br>
> + usec_t generators_finish_time;<br>
> };<br>
> struct unit_times {<br>
> char *name;<br>
> @@ -303,7 +305,17 @@ static int acquire_boot_times(DBusConnection *bus, struct boot_times **bt) {<br>
> "/org/freedesktop/systemd1",<br>
> "org.freedesktop.systemd1.Manager",<br>
> "FinishTimestampMonotonic",<br>
> - ×.finish_time) < 0)<br>
> + ×.finish_time) < 0 ||<br>
> + bus_get_uint64_property(bus,<br>
> + "/org/freedesktop/systemd1",<br>
> + "org.freedesktop.systemd1.Manager",<br>
> + "GeneratorsStartTimestampMonotonic",<br>
> + ×.generators_start_time) < 0 ||<br>
> + bus_get_uint64_property(bus,<br>
> + "/org/freedesktop/systemd1",<br>
> + "org.freedesktop.systemd1.Manager",<br>
> + "GeneratorsFinishTimestampMonotonic",<br>
> + ×.generators_finish_time) < 0)<br>
> return -EIO;<br>
><br>
> if (times.finish_time <= 0) {<br>
> @@ -459,7 +471,8 @@ static int analyze_plot(DBusConnection *bus) {<br>
><br>
> svg("<svg width=\"%.0fpx\" height=\"%.0fpx\" version=\"1.1\" "<br>
> "xmlns=\"<a href="http://www.w3.org/2000/svg\" target="_blank">http://www.w3.org/2000/svg\</a>">\n\n",<br>
> - 80.0 + width, 150.0 + (m * SCALE_Y));<br>
> + 80.0 + width, 150.0 + (m * SCALE_Y) +<br>
> + 4 * SCALE_Y /* legend */);<br>
><br>
> /* write some basic info as a comment, including some help */<br>
> svg("<!-- This file is a systemd-analyze SVG file. It is best rendered in a -->\n"<br>
> @@ -480,6 +493,7 @@ static int analyze_plot(DBusConnection *bus) {<br>
> " rect.firmware { fill: rgb(150,150,150); fill-opacity: 0.7; }\n"<br>
> " rect.loader { fill: rgb(150,150,150); fill-opacity: 0.7; }\n"<br>
> " rect.userspace { fill: rgb(150,150,150); fill-opacity: 0.7; }\n"<br>
> + " rect.generators { fill: rgb(102,204,255); fill-opacity: 0.7; }\n"<br>
> " rect.box { fill: rgb(240,240,240); stroke: rgb(192,192,192); }\n"<br>
> " line { stroke: rgb(64,64,64); stroke-width: 1; }\n"<br>
> "// line.sec1 { }\n"<br>
> @@ -495,8 +509,6 @@ static int analyze_plot(DBusConnection *bus) {<br>
> svg("<text x=\"20\" y=\"30\">%s %s (%s %s) %s</text>",<br>
> isempty(osname) ? "Linux" : osname,<br>
> name.nodename, name.release, name.version, name.machine);<br>
> - svg("<text x=\"20\" y=\"%.0f\">Legend: Red = Activating; Pink = Active; Dark Pink = Deactivating</text>",<br>
> - 120.0 + (m *SCALE_Y));<br>
><br>
> svg("<g transform=\"translate(%.3f,100)\">\n", 20.0 + (SCALE_X * boot->firmware_time));<br>
> svg_graph_box(m, -boot->firmware_time, boot->finish_time);<br>
> @@ -521,8 +533,9 @@ static int analyze_plot(DBusConnection *bus) {<br>
> svg_text(true, boot->initrd_time, y, "initrd");<br>
> y++;<br>
> }<br>
> - svg_bar("userspace", boot->userspace_time, boot->finish_time, y);<br>
> - svg_text("left", boot->userspace_time, y, "userspace");<br>
> + svg_bar("active", boot->userspace_time, boot->finish_time, y);<br>
> + svg_bar("generators", boot->generators_start_time, boot->generators_finish_time, y);<br>
> + svg_text("left", boot->userspace_time, y, "systemd");<br>
> y++;<br>
><br>
> for (u = times; u < times + n; u++) {<br>
> @@ -544,6 +557,23 @@ static int analyze_plot(DBusConnection *bus) {<br>
> svg_text(b, u->ixt, y, "%s", u->name);<br>
> y++;<br>
> }<br>
> +<br>
> + /* Legend */<br>
> + y++;<br>
> + svg_bar("activating", 0, 300000, y);<br>
> + svg_text("right", 400000, y, "Activating");<br>
> + y++;<br>
> + svg_bar("active", 0, 300000, y);<br>
> + svg_text("right", 400000, y, "Active");<br>
> + y++;<br>
> + svg_bar("deactivating", 0, 300000, y);<br>
> + svg_text("right", 400000, y, "Deactivating");<br>
> + y++;<br>
> + svg_bar("generators", 0, 300000, y);<br>
> + svg_text("right", 400000, y, "Generators");<br>
> + y++;<br>
> +<br>
> +<br>
</div></div>It would be nice to see a full screenshot that includes the new legend area.<br>
<div><div class="h5"><br>
> svg("</g>\n\n");<br>
><br>
> svg("</svg>");<br>
> diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c<br>
> index 56b02a1..c932437 100644<br>
> --- a/src/core/dbus-manager.c<br>
> +++ b/src/core/dbus-manager.c<br>
> @@ -275,6 +275,10 @@<br>
> " <property name=\"UserspaceTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \<br>
> " <property name=\"FinishTimestamp\" type=\"t\" access=\"read\"/>\n" \<br>
> " <property name=\"FinishTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \<br>
> + " <property name=\"GeneratorsStartTimestamp\" type=\"t\" access=\"read\"/>\n" \<br>
> + " <property name=\"GeneratorsStartTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \<br>
> + " <property name=\"GeneratorsFinishTimestamp\" type=\"t\" access=\"read\"/>\n" \<br>
> + " <property name=\"GeneratorsFinishTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \<br>
> " <property name=\"LogLevel\" type=\"s\" access=\"readwrite\"/>\n" \<br>
> " <property name=\"LogTarget\" type=\"s\" access=\"readwrite\"/>\n" \<br>
> " <property name=\"NNames\" type=\"u\" access=\"read\"/>\n" \<br>
> @@ -580,6 +584,10 @@ static const BusProperty bus_manager_properties[] = {<br>
> { "UserspaceTimestampMonotonic", bus_property_append_uint64, "t", offsetof(Manager, userspace_timestamp.monotonic) },<br>
> { "FinishTimestamp", bus_property_append_uint64, "t", offsetof(Manager, finish_timestamp.realtime) },<br>
> { "FinishTimestampMonotonic", bus_property_append_uint64, "t", offsetof(Manager, finish_timestamp.monotonic) },<br>
> + { "GeneratorsStartTimestamp", bus_property_append_uint64, "t", offsetof(Manager, generators_start_timestamp.realtime) },<br>
> + { "GeneratorsStartTimestampMonotonic", bus_property_append_uint64, "t", offsetof(Manager, generators_start_timestamp.monotonic) },<br>
> + { "GeneratorsFinishTimestamp", bus_property_append_uint64, "t", offsetof(Manager, generators_finish_timestamp.realtime) },<br>
> + { "GeneratorsFinishTimestampMonotonic", bus_property_append_uint64, "t", offsetof(Manager, generators_finish_timestamp.monotonic) },<br>
> { "LogLevel", bus_manager_append_log_level, "s", 0, false, bus_manager_set_log_level },<br>
> { "LogTarget", bus_manager_append_log_target, "s", 0, false, bus_manager_set_log_target },<br>
> { "NNames", bus_manager_append_n_names, "u", 0 },<br>
> diff --git a/src/core/manager.c b/src/core/manager.c<br>
> index c7f8f20..7b7ace6 100644<br>
> --- a/src/core/manager.c<br>
> +++ b/src/core/manager.c<br>
> @@ -2525,7 +2525,9 @@ void manager_run_generators(Manager *m) {<br>
> argv[4] = NULL;<br>
><br>
> RUN_WITH_UMASK(0022) {<br>
> + dual_timestamp_get(&m->generators_start_timestamp);<br>
> execute_directory(generator_path, d, (char**) argv);<br>
> + dual_timestamp_get(&m->generators_finish_timestamp);<br>
> }<br>
</div></div>The timestamps can be overwritten later as this is also called from<br>
manager_reload. You cancheck with dual_timestamp_is_set to avoid that.<br>
<br>
Or simply move the timestamps out into manager_startup. This will make<br>
them also include the create/trim of the generator directories. This<br>
might make sense if we are trying to find the total time cost of the<br>
generators.<br></blockquote><div style>Umut: I think it makes more sense to save the time before and after manager_run_generators in manager_startup. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im"><img src="cid:ii_13ea20984204ab94" alt="Inline image 1"><br>
> trim_generator_dir(m, &m->generator_unit_path);<br>
> diff --git a/src/core/manager.h b/src/core/manager.h<br>
> index bf83354..5d777e6 100644<br>
> --- a/src/core/manager.h<br>
> +++ b/src/core/manager.h<br>
> @@ -150,6 +150,8 @@ struct Manager {<br>
> dual_timestamp initrd_timestamp;<br>
> dual_timestamp userspace_timestamp;<br>
> dual_timestamp finish_timestamp;<br>
> + dual_timestamp generators_start_timestamp;<br>
> + dual_timestamp generators_finish_timestamp;<br>
><br>
> char *generator_unit_path;<br>
> char *generator_unit_path_early;<br>
> --<br>
> 1.7.2.5<br>
><br>
</div>> _______________________________________________<br>
> systemd-devel mailing list<br>
> <a href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/systemd-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
</blockquote></div><br></div></div>