chiark / gitweb /
test-path-util: add tests for path_make_relative()
[elogind.git] / src / bootchart / svg.c
index 5eee2d198795dc90b8c54c879483ed477ce4c389..a53f98a941fea55d7fe980e144dde85ceb6d9623 100644 (file)
@@ -68,20 +68,20 @@ static double idletime = -1.0;
 static int pfiltered = 0;
 static int pcount = 0;
 static int kcount = 0;
-static float psize = 0;
-static float ksize = 0;
-static float esize = 0;
+static double psize = 0;
+static double ksize = 0;
+static double esize = 0;
 static struct list_sample_data *sampledata;
 static struct list_sample_data *prev_sampledata;
 extern struct list_sample_data *head;
 
 static void svg_header(void) {
-        float w;
-        float h;
+        double w;
+        double h;
         struct list_sample_data *sampledata_last;
 
         sampledata = head;
-        LIST_FIND_TAIL(struct list_sample_data, link, sampledata, head);
+        LIST_FIND_TAIL(link, sampledata, head);
         sampledata_last = head;
         LIST_FOREACH_BEFORE(link, sampledata, head) {
                 sampledata_last = sampledata;
@@ -420,13 +420,10 @@ static void svg_pss_graph(void) {
         i = 1;
         LIST_FOREACH_BEFORE(link, sampledata, head) {
                 int bottom;
-                int top;
+                int top = 0;
                 struct ps_sched_struct *prev_sample;
                 struct ps_sched_struct *cross_place;
 
-                bottom = 0;
-                top = 0;
-
                 /* put all the small pss blocks into the bottom */
                 ps = ps_first->next_ps;
                 while (ps->next_ps) {
@@ -512,7 +509,7 @@ static void svg_pss_graph(void) {
                         continue;
 
                 enc_name = xml_comment_encode(ps->name);
-                if(!enc_name)
+                if (!enc_name)
                         continue;
 
                 svg("<!-- %s [%d] pss=", enc_name, ps->pid);
@@ -533,8 +530,8 @@ static void svg_io_bi_bar(void) {
         int max_here = 0;
         int i;
         int k;
-        struct list_sample_data *start_sampledata = sampledata;
-        struct list_sample_data *stop_sampledata = sampledata;
+        struct list_sample_data *start_sampledata;
+        struct list_sample_data *stop_sampledata;
 
         svg("<!-- IO utilization graph - In -->\n");
 
@@ -599,10 +596,7 @@ static void svg_io_bi_bar(void) {
                 int stop;
                 int diff;
                 double tot;
-                double pbi;
-
-                tot = 0;
-                pbi = 0;
+                double pbi = 0;
 
                 start = MAX(i - ((range / 2) - 1), 0);
                 stop = MIN(i + (range / 2), samples);
@@ -647,8 +641,8 @@ static void svg_io_bo_bar(void) {
         int max_here = 0;
         int i;
         int k;
-        struct list_sample_data *start_sampledata = sampledata;
-        struct list_sample_data *stop_sampledata = sampledata;
+        struct list_sample_data *start_sampledata;
+        struct list_sample_data *stop_sampledata;
 
         svg("<!-- IO utilization graph - out -->\n");
 
@@ -711,7 +705,6 @@ static void svg_io_bo_bar(void) {
                 double tot;
                 double pbo;
 
-                tot = 0;
                 pbo = 0;
 
                 start = MAX(i - ((range / 2) - 1), 0);
@@ -1015,7 +1008,7 @@ static void svg_ps_bars(void) {
                 int t;
 
                 enc_name = xml_comment_encode(ps->name);
-                if(!enc_name)
+                if (!enc_name)
                         continue;
 
                 /* leave some trace of what we actually filtered etc. */
@@ -1100,12 +1093,13 @@ static void svg_ps_bars(void) {
                         w = starttime;
 
                 /* text label of process name */
-                svg("  <text x=\"%.03f\" y=\"%.03f\"><![CDATA[%s]]> [%i]<tspan class=\"run\">%.03fs</tspan></text>\n",
+                svg("  <text x=\"%.03f\" y=\"%.03f\"><![CDATA[%s]]> [%i]<tspan class=\"run\">%.03fs</tspan> %s</text>\n",
                     time_to_graph(w - graph_start) + 5.0,
                     ps_to_graph(j) + 14.0,
                     ps->name,
                     ps->pid,
-                    (ps->last->runtime - ps->first->runtime) / 1000000000.0);
+                    (ps->last->runtime - ps->first->runtime) / 1000000000.0,
+                    arg_show_cgroup ? ps->cgroup : "");
                 /* paint lines to the parent process */
                 if (ps->parent) {
                         /* horizontal part */
@@ -1255,7 +1249,7 @@ static void svg_top_ten_pss(void) {
 void svg_do(const char *build) {
         struct ps_struct *ps;
 
-        memset(&str, 0, sizeof(str));
+        memzero(&str, sizeof(str));
 
         ps = ps_first;