On Mon, Feb 04, 2013 at 09:32:33PM +0100, Simon Peeters wrote:
> Written by Peeters Simon <peeters.si...@gmail.com>. Makefile stuff
> and cleaned up a bit by Auke Kok <auke-jan.h....@intel.com>.
> ---
> 
> Fixed some stuff and dit some more cleanup.
> 
> This should just cover the same usage as the old systemd-analyze, but we can
> add more functionality afterwards (systemctl dot, other output formats,...)
> 
> This is the rebased version as asked by William.
Thanks! It applied cleanly. Just a comment in the analyze_plot fucntion.
Previously I mentioned that really short boot times make plots that are
too small to really read anything, and I kept getting graphs that were
trunctated and short, basically telling me how long the kernel took to
get ready and maybe the initrd. I thought this was fixed seeing this
patch[1], but then I realized that width is not even used in the svg, it
re-calculates the width for some reason here[2]. Just changing that line
to `width,` and everything works as expected. (Otherwise the 800.0 width
or 1000.0 width isn't actually used in the svg)

<-SNIP->
> +static int analyze_plot(DBusConnection *bus)
> +{
> +        struct unit_times *times;
> +        struct boot_times boot;
> +        int n, m = 1;
> +        double width;
> +
> +        n = get_boot_times(bus, &boot);
> +        if (n)
> +                return n;
> +
> +        n = acquire_time_data(bus, &times);
> +        if (n<=0)
> +                return n;
> +
> +        qsort(times, n, sizeof(struct unit_times), compare_unit_start);
> +
> +        width = 80 + (scale_x * (boot.firmware_time + boot.finish_time) * 
> 0.000001);
[1]
> +        if (width < 800.0)
> +                width = 800.0;
> +
> +        if (boot.firmware_time > boot.loader_time)
> +                m++;
> +        if (boot.loader_time) {
> +                m++;
> +                if (width < 1000.0)
> +                        width = 1000.0;
> +        }
> +        if (boot.initrd_time)
> +                m++;
> +        if (boot.kernel_time)
> +                m++;
> +
> +        for (int i=0; i < n; i++)
> +                if (times[i].ixt >= boot.userspace_time && times[i].ixt <= 
> boot.finish_time)
> +                        m++;
> +
> +        svg("<?xml version=\"1.0\" standalone=\"no\"?>\n");
> +        svg("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" ");
> +        svg("\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\";>\n");
> +
> +        svg("<svg width=\"%.0fpx\" height=\"%.0fpx\" version=\"1.1\" ",
[2]
> +                        80.0 + (scale_x * (boot.firmware_time + 
> boot.finish_time) * 0.000001),
> +                        150.0 + (m *scale_y));
> +        svg("xmlns=\"http://www.w3.org/2000/svg\";>\n\n");
> +
> +        /* 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"
> +            "<!-- browser such as Chrome/Chromium, firefox. Other 
> applications that   -->\n"
> +            "<!-- render these files properly but much more slow are 
> ImageMagick,     -->\n"
> +            "<!-- gimp, inkscape, etc.. To display the files on your system, 
> just     -->\n"
> +            "<!-- point your browser to file:///var/log/ and click.          
>          -->\n\n"
> +            "<!-- this plot was generated by systemd-analyze version 
> %-16.16s -->\n\n", VERSION);

Also, this could use a few fixes:
 * Chrome/Chromium, firefox -> Chrome, Chromium or Firefox
 * much more slow -> much slower
 * this plot was generated -> This plot was generated
 * etc.. -> etc.

<-SNIP->

Thanks,
-- 
William Giokas | KaiSforza
GnuPG Key: 0xE99A7F0F
Fingerprint: F078 CFF2 45E8 1E72 6D5A  8653 CDF5 E7A5 E99A 7F0F

Attachment: pgpIcMIEvqfiu.pgp
Description: PGP signature

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to