]> granicus.if.org Git - sysstat/blobdiff - svg_stats.c
Merge branch 'scop-grep-E'
[sysstat] / svg_stats.c
index 837e6404bd1cb01af496eca3b17a6a7c7b1cda66..aea9bda0cd862e86a2c2ba037b343b13a991dda3 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * svg_stats.c: Funtions used by sadf to display statistics in SVG format.
- * (C) 2016-2019 by Sebastien GODARD (sysstat <at> orange.fr)
+ * svg_stats.c: Functions used by sadf to display statistics in SVG format.
+ * (C) 2016-2021 by Sebastien GODARD (sysstat <at> orange.fr)
  *
  ***************************************************************************
  * This program is free software; you can redistribute it and/or modify it *
@@ -37,7 +37,7 @@
 #define _(string) (string)
 #endif
 
-extern unsigned int flags;
+extern uint64_t flags;
 extern int palette;
 
 unsigned int svg_colors[SVG_COL_PALETTE_NR][SVG_COL_PALETTE_SIZE] =
@@ -86,8 +86,8 @@ unsigned int svg_colors[SVG_COL_PALETTE_NR][SVG_COL_PALETTE_SIZE] =
  *             the fields in the statistics structure.
  *
  * OUT:
- * @spmin      Array containg the possible new min values for current activity.
- * @spmax      Array containg the possible new max values for current activity.
+ * @spmin      Array containing the possible new min values for current activity.
+ * @spmax      Array containing the possible new max values for current activity.
  ***************************************************************************
  */
 void save_extrema(unsigned int types_nr[], void *cs, void *ps, unsigned long long itv,
@@ -605,6 +605,11 @@ void display_hgrid(double ypos, double yfactor, double lmax, int dp)
        int j = 0;
        char stmp[32];
 
+       /* Print marker in debug mode */
+       if (DISPLAY_DEBUG_MODE(flags)) {
+               printf("<!-- Hgrid -->\n");
+       }
+
        do {
                /* Display horizontal lines (except on X axis) */
                if (j > 0) {
@@ -652,6 +657,11 @@ void display_vgrid(long int xpos, double xfactor, int v_gridnr, struct svg_parm
 
        stamp.ust_time = svg_p->ust_time_ref; /* Only ust_time field needs to be set. TRUE_TIME not allowed */
 
+       /* Print marker in debug mode */
+       if (DISPLAY_DEBUG_MODE(flags)) {
+               printf("<!-- Vgrid -->\n");
+       }
+
        /*
         * What really matters to know when we should stop drawing vertical lines
         * is the time end. v_gridnr is only informative and used to calculate
@@ -660,7 +670,12 @@ void display_vgrid(long int xpos, double xfactor, int v_gridnr, struct svg_parm
        for (j = 0; (j <= (2 * v_gridnr)) && (stamp.ust_time <= svg_p->ust_time_end); j++) {
 
                /* Display vertical lines */
-               sa_get_record_timestamp_struct(flags, &stamp, &rectime);
+               if (sa_get_record_timestamp_struct(flags, &stamp, &rectime)) {
+#ifdef DEBUG
+                       fprintf(stderr, "%s: ust_time: %llu\n", __FUNCTION__, stamp.ust_time);
+#endif
+                       exit(1);
+               }
                set_record_timestamp_string(flags, &stamp, NULL, cur_time, TIMESTAMP_LEN, &rectime);
                printf("<polyline points=\"%ld,0 %ld,%d\" style=\"vector-effect: non-scaling-stroke; "
                       "stroke: #%06x\" transform=\"scale(%f,1)\"/>\n",
@@ -841,7 +856,7 @@ void skip_current_view(char **out, int *pos, int group)
  * @skip_void  Set to <> 0 if graphs with no data should be skipped.
  *             This is typicallly used to not display CPU offline on the
  *             whole period.
- * @id         Current activity id.
+ * @a          Current activity structure.
  * @xid                Current activity extra id number.
  *
  * RETURNS:
@@ -851,7 +866,7 @@ void skip_current_view(char **out, int *pos, int group)
 int draw_activity_graphs(int g_nr, int g_type[], char *title[], char *g_title[], char *item_name,
                         int group[], double *spmin, double *spmax, char **out, int *outsize,
                         struct svg_parm *svg_p, struct record_header *record_hdr, int skip_void,
-                        unsigned int id, unsigned int xid)
+                        struct activity *a, unsigned int xid)
 {
        char *out_p;
        int i, j, dp, pos = 0, views_nr = 0, displayed = FALSE, palpos;
@@ -862,9 +877,19 @@ int draw_activity_graphs(int g_nr, int g_type[], char *title[], char *g_title[],
        char val[32], cur_date[TIMESTAMP_LEN];
        struct tm rectime;
 
+       /* Print activity name in debug mode */
+       if (DISPLAY_DEBUG_MODE(flags)) {
+               printf("<!-- Name: %s -->\n", a->name);
+       }
+
        /* For each view which is part of current activity */
        for (i = 0; i < g_nr; i++) {
 
+               /* Print view number in debug mode */
+               if (DISPLAY_DEBUG_MODE(flags)) {
+                       printf("<!-- View %d -->\n", i + 1);
+               }
+
                /* Used as index in color palette */
                palpos = (palette == SVG_BW_COL_PALETTE ? 0 : pos);
 
@@ -883,7 +908,7 @@ int draw_activity_graphs(int g_nr, int g_type[], char *title[], char *g_title[],
                if (!displayed) {
                        /* Translate to proper position for current activity */
                        printf("<g id=\"g%d-%d\" transform=\"translate(0,%d)\">\n",
-                              id, xid,
+                              a->id, xid,
                               SVG_H_YSIZE +
                               SVG_C_YSIZE * (DISPLAY_TOC(flags) ? svg_p->nr_act_dispd : 0) +
                               SVG_T_YSIZE * svg_p->graph_no);
@@ -1028,6 +1053,11 @@ int draw_activity_graphs(int g_nr, int g_type[], char *title[], char *g_title[],
                /* Display vertical lines and graduations */
                display_vgrid(xpos, xfactor, v_gridnr, svg_p);
 
+               /* Print marker in debug mode */
+               if (DISPLAY_DEBUG_MODE(flags)) {
+                       printf("<!-- Graphs -->\n");
+               }
+
                /* Draw current graphs set */
                for (j = 0; j < group[i]; j++) {
                        out_p = *(out + pos + j);
@@ -1081,6 +1111,7 @@ int draw_activity_graphs(int g_nr, int g_type[], char *title[], char *g_title[],
  * @record_hdr Pointer on record header of current stats sample.
  ***************************************************************************
  */
+#define CPU_ARRAY_SZ   10
 __print_funct_t svg_print_cpu_stats(struct activity *a, int curr, int action, struct svg_parm *svg_p,
                                    unsigned long long itv, struct record_header *record_hdr)
 {
@@ -1105,7 +1136,7 @@ __print_funct_t svg_print_cpu_stats(struct activity *a, int curr, int action, st
                 * Allocate arrays that will contain the graphs data
                 * and the min/max values.
                 */
-               out = allocate_graph_lines(10 * a->item_list_sz, &outsize, &spmin, &spmax);
+               out = allocate_graph_lines(CPU_ARRAY_SZ * a->item_list_sz, &outsize, &spmin, &spmax);
        }
 
        if (action & F_MAIN) {
@@ -1136,7 +1167,7 @@ __print_funct_t svg_print_cpu_stats(struct activity *a, int curr, int action, st
                        scc = (struct stats_cpu *) ((char *) a->buf[curr]  + i * a->msize);
                        scp = (struct stats_cpu *) ((char *) a->buf[!curr] + i * a->msize);
 
-                       pos = i * 10;
+                       pos = i * CPU_ARRAY_SZ;
                        offset = 0.0;
 
                        if (i == 0) {
@@ -1311,7 +1342,7 @@ __print_funct_t svg_print_cpu_stats(struct activity *a, int curr, int action, st
                                /* No */
                                continue;
 
-                       pos = i * 10;
+                       pos = i * CPU_ARRAY_SZ;
                        if (!i) {
                                /* This is CPU "all" */
                                strcpy(item_name, "all");
@@ -1324,13 +1355,13 @@ __print_funct_t svg_print_cpu_stats(struct activity *a, int curr, int action, st
                                displayed = draw_activity_graphs(a->g_nr, g_type,
                                                                 title, g_title1, item_name, group1,
                                                                 spmin + pos, spmax + pos, out + pos, outsize + pos,
-                                                                svg_p, record_hdr, i, a->id, xid);
+                                                                svg_p, record_hdr, i, a, xid);
                        }
                        else {
                                displayed = draw_activity_graphs(a->g_nr, g_type,
                                                                 title, g_title2, item_name, group2,
                                                                 spmin + pos, spmax + pos, out + pos, outsize + pos,
-                                                                svg_p, record_hdr, i, a->id, xid);
+                                                                svg_p, record_hdr, i, a, xid);
                        }
                        if (displayed) {
                                xid++;
@@ -1398,7 +1429,7 @@ __print_funct_t svg_print_pcsw_stats(struct activity *a, int curr, int action, s
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -1460,7 +1491,7 @@ __print_funct_t svg_print_swap_stats(struct activity *a, int curr, int action, s
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -1548,7 +1579,7 @@ __print_funct_t svg_print_paging_stats(struct activity *a, int curr, int action,
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -1656,7 +1687,7 @@ __print_funct_t svg_print_io_stats(struct activity *a, int curr, int action, str
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -1883,7 +1914,7 @@ __print_funct_t svg_print_memory_stats(struct activity *a, int curr, int action,
                        if (draw_activity_graphs(DISPLAY_MEM_ALL(a->opt_flags) ? 6 : 5,
                                                 g_type1, title1, g_title1, NULL, group1,
                                                 spmin, spmax, out, outsize, svg_p, record_hdr,
-                                                FALSE, a->id, xid)) {
+                                                FALSE, a, xid)) {
                                xid++;
                        }
                }
@@ -1891,7 +1922,7 @@ __print_funct_t svg_print_memory_stats(struct activity *a, int curr, int action,
                if (DISPLAY_SWAP(a->opt_flags)) {
                        draw_activity_graphs(3, g_type2, title2, g_title2, NULL, group2,
                                             spmin + 16, spmax + 16, out + 16, outsize + 16,
-                                            svg_p, record_hdr, FALSE, a->id, xid);
+                                            svg_p, record_hdr, FALSE, a, xid);
                }
 
                /* Free remaining structures */
@@ -1962,7 +1993,7 @@ __print_funct_t svg_print_ktables_stats(struct activity *a, int curr, int action
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -2046,7 +2077,7 @@ __print_funct_t svg_print_queue_stats(struct activity *a, int curr, int action,
                *(spmin + 5) /= 100; *(spmax + 5) /= 100;
 
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -2069,6 +2100,7 @@ __print_funct_t svg_print_queue_stats(struct activity *a, int curr, int action,
  * @record_hdr Pointer on record header of current stats sample.
  ***************************************************************************
  */
+#define DISK_ARRAY_SZ  9
 __print_funct_t svg_print_disk_stats(struct activity *a, int curr, int action, struct svg_parm *svg_p,
                                     unsigned long long itv, struct record_header *record_hdr)
 {
@@ -2086,7 +2118,6 @@ __print_funct_t svg_print_disk_stats(struct activity *a, int curr, int action, s
                           "await",
                           "%util"};
        int g_fields[] = {0, 1, 2};
-       int nr_arrays = 9;
        unsigned int local_types_nr[] = {1, 0, 0};
        static double *spmin, *spmax;
        static char **out;
@@ -2104,18 +2135,17 @@ __print_funct_t svg_print_disk_stats(struct activity *a, int curr, int action, s
                 * outsize + 8 will contain a positive value (TRUE) if the device
                 * has either still not been registered, or has been unregistered.
                 */
-               out = allocate_graph_lines(nr_arrays * a->item_list_sz, &outsize, &spmin, &spmax);
+               out = allocate_graph_lines(DISK_ARRAY_SZ * a->item_list_sz, &outsize, &spmin, &spmax);
        }
 
        if (action & F_MAIN) {
                memset(&sdpzero, 0, STATS_DISK_SIZE);
-               restart = svg_p->restart;
                /*
                 * Mark previously registered devices as now
                 * possibly unregistered for all graphs.
                 */
                for (k = 0; k < a->item_list_sz; k++) {
-                       unregistered = outsize + k * nr_arrays + 8;
+                       unregistered = outsize + k * DISK_ARRAY_SZ + 8;
                        if (*unregistered == FALSE) {
                                *unregistered = MAYBE;
                        }
@@ -2124,10 +2154,12 @@ __print_funct_t svg_print_disk_stats(struct activity *a, int curr, int action, s
                /* For each device structure */
                for (i = 0; i < a->nr[curr]; i++) {
                        sdc = (struct stats_disk *) ((char *) a->buf[curr] + i * a->msize);
+                       restart = svg_p->restart;
 
                        /* Get device name  */
-                       dev_name = get_sa_devname(sdc->major, sdc->minor,
-                                                 sdc->wwn, sdc->part_nr, flags);
+                       dev_name = get_device_name(sdc->major, sdc->minor, sdc->wwn, sdc->part_nr,
+                                                  DISPLAY_PRETTY(flags), DISPLAY_PERSIST_NAME_S(flags),
+                                                  USE_STABLE_ID(flags), NULL);
 
                        if (a->item_list != NULL) {
                                /* A list of devices has been entered on the command line */
@@ -2138,7 +2170,7 @@ __print_funct_t svg_print_disk_stats(struct activity *a, int curr, int action, s
 
                        /* Look for corresponding graph */
                        for (k = 0; k < a->item_list_sz; k++) {
-                               item_name = *(out + k * nr_arrays + 8);
+                               item_name = *(out + k * DISK_ARRAY_SZ + 8);
                                if (!strcmp(dev_name, item_name))
                                        /* Graph found! */
                                        break;
@@ -2146,7 +2178,7 @@ __print_funct_t svg_print_disk_stats(struct activity *a, int curr, int action, s
                        if (k == a->item_list_sz) {
                                /* Graph not found: Look for first free entry */
                                for (k = 0; k < a->item_list_sz; k++) {
-                                       item_name = *(out + k * nr_arrays + 8);
+                                       item_name = *(out + k * DISK_ARRAY_SZ + 8);
                                        if (!strcmp(item_name, ""))
                                                break;
                                }
@@ -2159,7 +2191,7 @@ __print_funct_t svg_print_disk_stats(struct activity *a, int curr, int action, s
                                        continue;
                                }
                        }
-                       pos = k * nr_arrays;
+                       pos = k * DISK_ARRAY_SZ;
                        unregistered = outsize + pos + 8;
 
                        /*
@@ -2183,6 +2215,7 @@ __print_funct_t svg_print_disk_stats(struct activity *a, int curr, int action, s
                        if (j < 0) {
                                /* This is a newly registered interface. Previous stats are zero */
                                sdp = &sdpzero;
+                               restart = TRUE;
                        }
                        else {
                                sdp = (struct stats_disk *) ((char *) a->buf[!curr] + j * a->msize);
@@ -2277,7 +2310,7 @@ __print_funct_t svg_print_disk_stats(struct activity *a, int curr, int action, s
 
                /* Mark devices not seen here as now unregistered */
                for (k = 0; k < a->item_list_sz; k++) {
-                       unregistered = outsize + k * nr_arrays + 8;
+                       unregistered = outsize + k * DISK_ARRAY_SZ + 8;
                        if (*unregistered != FALSE) {
                                *unregistered = TRUE;
                        }
@@ -2289,7 +2322,7 @@ __print_funct_t svg_print_disk_stats(struct activity *a, int curr, int action, s
 
                for (i = 0; i < a->item_list_sz; i++) {
                        /* Check if there is something to display */
-                       pos = i * nr_arrays;
+                       pos = i * DISK_ARRAY_SZ;
                        if (!**(out + pos))
                                continue;
 
@@ -2297,7 +2330,7 @@ __print_funct_t svg_print_disk_stats(struct activity *a, int curr, int action, s
                        if (draw_activity_graphs(a->g_nr, g_type,
                                                 title, g_title, item_name, group,
                                                 spmin + pos, spmax + pos, out + pos, outsize + pos,
-                                                svg_p, record_hdr, FALSE, a->id, xid)) {
+                                                svg_p, record_hdr, FALSE, a, xid)) {
                                xid++;
                        }
                }
@@ -2323,6 +2356,7 @@ __print_funct_t svg_print_disk_stats(struct activity *a, int curr, int action, s
  * @record_hdr Pointer on record header of current stats sample.
  ***************************************************************************
  */
+#define NET_DEV_ARRAY_SZ       9
 __print_funct_t svg_print_net_dev_stats(struct activity *a, int curr, int action, struct svg_parm *svg_p,
                                        unsigned long long itv, struct record_header *record_hdr)
 {
@@ -2354,18 +2388,17 @@ __print_funct_t svg_print_net_dev_stats(struct activity *a, int curr, int action
                 * outsize + 8 will contain a positive value (TRUE) if the interface
                 * has either still not been registered, or has been unregistered.
                 */
-               out = allocate_graph_lines(9 * a->item_list_sz, &outsize, &spmin, &spmax);
+               out = allocate_graph_lines(NET_DEV_ARRAY_SZ * a->item_list_sz, &outsize, &spmin, &spmax);
        }
 
        if (action & F_MAIN) {
                memset(&sndzero, 0, STATS_NET_DEV_SIZE);
-               restart = svg_p->restart;
                /*
                 * Mark previously registered interfaces as now
                 * possibly unregistered for all graphs.
                 */
                for (k = 0; k < a->item_list_sz; k++) {
-                       unregistered = outsize + k * 9 + 8;
+                       unregistered = outsize + k * NET_DEV_ARRAY_SZ + 8;
                        if (*unregistered == FALSE) {
                                *unregistered = MAYBE;
                        }
@@ -2374,6 +2407,7 @@ __print_funct_t svg_print_net_dev_stats(struct activity *a, int curr, int action
                /* For each network interfaces structure */
                for (i = 0; i < a->nr[curr]; i++) {
                        sndc = (struct stats_net_dev *) ((char *) a->buf[curr] + i * a->msize);
+                       restart = svg_p->restart;
 
                        if (a->item_list != NULL) {
                                /* A list of devices has been entered on the command line */
@@ -2384,7 +2418,7 @@ __print_funct_t svg_print_net_dev_stats(struct activity *a, int curr, int action
 
                        /* Look for corresponding graph */
                        for (k = 0; k < a->item_list_sz; k++) {
-                               item_name = *(out + k * 9 + 8);
+                               item_name = *(out + k * NET_DEV_ARRAY_SZ + 8);
                                if (!strcmp(sndc->interface, item_name))
                                        /* Graph found! */
                                        break;
@@ -2392,7 +2426,7 @@ __print_funct_t svg_print_net_dev_stats(struct activity *a, int curr, int action
                        if (k == a->item_list_sz) {
                                /* Graph not found: Look for first free entry */
                                for (k = 0; k < a->item_list_sz; k++) {
-                                       item_name = *(out + k * 9 + 8);
+                                       item_name = *(out + k * NET_DEV_ARRAY_SZ + 8);
                                        if (!strcmp(item_name, ""))
                                                break;
                                }
@@ -2405,13 +2439,14 @@ __print_funct_t svg_print_net_dev_stats(struct activity *a, int curr, int action
                                        continue;
                                }
                        }
-                       pos = k * 9;
+                       pos = k * NET_DEV_ARRAY_SZ;
                        unregistered = outsize + pos + 8;
 
                        j = check_net_dev_reg(a, curr, !curr, i);
                        if (j < 0) {
                                /* This is a newly registered interface. Previous stats are zero */
                                sndp = &sndzero;
+                               restart = TRUE;
                        }
                        else {
                                sndp = (struct stats_net_dev *) ((char *) a->buf[!curr] + j * a->msize);
@@ -2484,7 +2519,7 @@ __print_funct_t svg_print_net_dev_stats(struct activity *a, int curr, int action
 
                /* Mark interfaces not seen here as now unregistered */
                for (k = 0; k < a->item_list_sz; k++) {
-                       unregistered = outsize + k * 9 + 8;
+                       unregistered = outsize + k * NET_DEV_ARRAY_SZ + 8;
                        if (*unregistered != FALSE) {
                                *unregistered = TRUE;
                        }
@@ -2500,7 +2535,7 @@ __print_funct_t svg_print_net_dev_stats(struct activity *a, int curr, int action
                         * Don't test sndc->interface because maybe the network
                         * interface has been registered later.
                         */
-                       pos = i * 9;
+                       pos = i * NET_DEV_ARRAY_SZ;
                        if (!**(out + pos))
                                continue;
 
@@ -2514,7 +2549,7 @@ __print_funct_t svg_print_net_dev_stats(struct activity *a, int curr, int action
                        if (draw_activity_graphs(a->g_nr, g_type,
                                                 title, g_title, item_name, group,
                                                 spmin + pos, spmax + pos, out + pos, outsize + pos,
-                                                svg_p, record_hdr, FALSE, a->id, xid)) {
+                                                svg_p, record_hdr, FALSE, a, xid)) {
                                xid++;
                        }
                }
@@ -2540,6 +2575,7 @@ __print_funct_t svg_print_net_dev_stats(struct activity *a, int curr, int action
  * @record_hdr Pointer on record header of current stats sample.
  ***************************************************************************
  */
+#define NET_EDEV_ARRAY_SZ      10
 __print_funct_t svg_print_net_edev_stats(struct activity *a, int curr, int action, struct svg_parm *svg_p,
                                         unsigned long long itv, struct record_header *record_hdr)
 {
@@ -2569,18 +2605,17 @@ __print_funct_t svg_print_net_edev_stats(struct activity *a, int curr, int actio
                 * outsize + 9 will contain a positive value (TRUE) if the interface
                 * has either still not been registered, or has been unregistered.
                 */
-               out = allocate_graph_lines(10 * a->item_list_sz, &outsize, &spmin, &spmax);
+               out = allocate_graph_lines(NET_EDEV_ARRAY_SZ * a->item_list_sz, &outsize, &spmin, &spmax);
        }
 
        if (action & F_MAIN) {
                memset(&snedzero, 0, STATS_NET_EDEV_SIZE);
-               restart = svg_p->restart;
                /*
                 * Mark previously registered interfaces as now
                 * possibly unregistered for all graphs.
                 */
                for (k = 0; k < a->item_list_sz; k++) {
-                       unregistered = outsize + k * 10 + 9;
+                       unregistered = outsize + k * NET_EDEV_ARRAY_SZ + 9;
                        if (*unregistered == FALSE) {
                                *unregistered = MAYBE;
                        }
@@ -2589,9 +2624,7 @@ __print_funct_t svg_print_net_edev_stats(struct activity *a, int curr, int actio
                /* For each network interfaces structure */
                for (i = 0; i < a->nr[curr]; i++) {
                        snedc = (struct stats_net_edev *) ((char *) a->buf[curr] + i * a->msize);
-                       if (!strcmp(snedc->interface, ""))
-                               /* Empty structure: This is the end of the list */
-                               break;
+                       restart = svg_p->restart;
 
                        if (a->item_list != NULL) {
                                /* A list of devices has been entered on the command line */
@@ -2602,7 +2635,7 @@ __print_funct_t svg_print_net_edev_stats(struct activity *a, int curr, int actio
 
                        /* Look for corresponding graph */
                        for (k = 0; k < a->item_list_sz; k++) {
-                               item_name = *(out + k * 10 + 9);
+                               item_name = *(out + k * NET_EDEV_ARRAY_SZ + 9);
                                if (!strcmp(snedc->interface, item_name))
                                        /* Graph found! */
                                        break;
@@ -2610,7 +2643,7 @@ __print_funct_t svg_print_net_edev_stats(struct activity *a, int curr, int actio
                        if (k == a->item_list_sz) {
                                /* Graph not found: Look for first free entry */
                                for (k = 0; k < a->item_list_sz; k++) {
-                                       item_name = *(out + k * 10 + 9);
+                                       item_name = *(out + k * NET_EDEV_ARRAY_SZ + 9);
                                        if (!strcmp(item_name, ""))
                                                break;
                                }
@@ -2624,13 +2657,14 @@ __print_funct_t svg_print_net_edev_stats(struct activity *a, int curr, int actio
                                }
                        }
 
-                       pos = k * 10;
+                       pos = k * NET_EDEV_ARRAY_SZ;
                        unregistered = outsize + pos + 9;
 
                        j = check_net_edev_reg(a, curr, !curr, i);
                        if (j < 0) {
                                /* This is a newly registered interface. Previous stats are zero */
                                snedp = &snedzero;
+                               restart = TRUE;
                        }
                        else {
                                snedp = (struct stats_net_edev *) ((char *) a->buf[!curr] + j * a->msize);
@@ -2697,7 +2731,7 @@ __print_funct_t svg_print_net_edev_stats(struct activity *a, int curr, int actio
 
                /* Mark interfaces not seen here as now unregistered */
                for (k = 0; k < a->item_list_sz; k++) {
-                       unregistered = outsize + k * 10 + 9;
+                       unregistered = outsize + k * NET_EDEV_ARRAY_SZ + 9;
                        if (*unregistered != FALSE) {
                                *unregistered = TRUE;
                        }
@@ -2713,7 +2747,7 @@ __print_funct_t svg_print_net_edev_stats(struct activity *a, int curr, int actio
                         * Don't test snedc->interface because maybe the network
                         * interface has been registered later.
                         */
-                       pos = i * 10;
+                       pos = i * NET_EDEV_ARRAY_SZ;
                        if (!**(out + pos))
                                continue;
 
@@ -2721,7 +2755,7 @@ __print_funct_t svg_print_net_edev_stats(struct activity *a, int curr, int actio
                        if (draw_activity_graphs(a->g_nr, g_type,
                                                 title, g_title, item_name, group,
                                                 spmin + pos, spmax + pos, out + pos, outsize + pos,
-                                                svg_p, record_hdr, FALSE, a->id, xid)) {
+                                                svg_p, record_hdr, FALSE, a, xid)) {
                                xid++;
                        }
                }
@@ -2806,7 +2840,7 @@ __print_funct_t svg_print_net_nfs_stats(struct activity *a, int curr, int action
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -2912,7 +2946,7 @@ __print_funct_t svg_print_net_nfsd_stats(struct activity *a, int curr, int actio
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -2990,7 +3024,7 @@ __print_funct_t svg_print_net_sock_stats(struct activity *a, int curr, int actio
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -3079,7 +3113,7 @@ __print_funct_t svg_print_net_ip_stats(struct activity *a, int curr, int action,
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -3169,7 +3203,7 @@ __print_funct_t svg_print_net_eip_stats(struct activity *a, int curr, int action
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -3285,7 +3319,7 @@ __print_funct_t svg_print_net_icmp_stats(struct activity *a, int curr, int actio
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -3396,7 +3430,7 @@ __print_funct_t svg_print_net_eicmp_stats(struct activity *a, int curr, int acti
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -3468,7 +3502,7 @@ __print_funct_t svg_print_net_tcp_stats(struct activity *a, int curr, int action
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -3544,7 +3578,7 @@ __print_funct_t svg_print_net_etcp_stats(struct activity *a, int curr, int actio
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -3616,7 +3650,7 @@ __print_funct_t svg_print_net_udp_stats(struct activity *a, int curr, int action
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -3685,7 +3719,7 @@ __print_funct_t svg_print_net_sock6_stats(struct activity *a, int curr, int acti
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -3785,7 +3819,7 @@ __print_funct_t svg_print_net_ip6_stats(struct activity *a, int curr, int action
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -3890,7 +3924,7 @@ __print_funct_t svg_print_net_eip6_stats(struct activity *a, int curr, int actio
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -4020,7 +4054,7 @@ __print_funct_t svg_print_net_icmp6_stats(struct activity *a, int curr, int acti
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -4127,7 +4161,7 @@ __print_funct_t svg_print_net_eicmp6_stats(struct activity *a, int curr, int act
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -4199,7 +4233,7 @@ __print_funct_t svg_print_net_udp6_stats(struct activity *a, int curr, int actio
 
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -4233,7 +4267,7 @@ __print_funct_t svg_print_pwr_cpufreq_stats(struct activity *a, int curr, int ac
        static double *spmin, *spmax;
        static char **out;
        static int *outsize;
-       char item_name[8];
+       char item_name[16];
        int i;
 
        if (action & F_BEGIN) {
@@ -4299,7 +4333,7 @@ __print_funct_t svg_print_pwr_cpufreq_stats(struct activity *a, int curr, int ac
                        if (draw_activity_graphs(a->g_nr, g_type,
                                                 title, g_title, item_name, group,
                                                 spmin + i, spmax + i, out + i, outsize + i,
-                                                svg_p, record_hdr, i, a->id, xid)) {
+                                                svg_p, record_hdr, i, a, xid)) {
                                xid++;
                        }
                }
@@ -4336,7 +4370,7 @@ __print_funct_t svg_print_pwr_fan_stats(struct activity *a, int curr, int action
        static double *spmin, *spmax;
        static char **out;
        static int *outsize;
-       char item_name[MAX_SENSORS_DEV_LEN + 8];
+       char item_name[MAX_SENSORS_DEV_LEN + 16];
        int i;
 
        if (action & F_BEGIN) {
@@ -4370,13 +4404,13 @@ __print_funct_t svg_print_pwr_fan_stats(struct activity *a, int curr, int action
 
                        spc = (struct stats_pwr_fan *) ((char *) a->buf[curr] + i * a->msize);
 
-                       snprintf(item_name, MAX_SENSORS_DEV_LEN + 8, "%d: %s", i + 1, spc->device);
-                       item_name[MAX_SENSORS_DEV_LEN + 7] = '\0';
+                       snprintf(item_name, sizeof(item_name), "%d: %s", i + 1, spc->device);
+                       item_name[sizeof(item_name) - 1] = '\0';
 
                        if (draw_activity_graphs(a->g_nr, g_type,
                                                 title, g_title, item_name, group,
                                                 spmin + i, spmax + i, out + i, outsize + i,
-                                                svg_p, record_hdr, FALSE, a->id, xid)) {
+                                                svg_p, record_hdr, FALSE, a, xid)) {
                                xid++;
                        }
                }
@@ -4402,6 +4436,7 @@ __print_funct_t svg_print_pwr_fan_stats(struct activity *a, int curr, int action
  * @record_hdr Pointer on record header of current stats sample.
  ***************************************************************************
  */
+#define TEMP_ARRAY_SZ  2
 __print_funct_t svg_print_pwr_temp_stats(struct activity *a, int curr, int action, struct svg_parm *svg_p,
                                         unsigned long long itv, struct record_header *record_hdr)
 {
@@ -4415,7 +4450,7 @@ __print_funct_t svg_print_pwr_temp_stats(struct activity *a, int curr, int actio
        static double *spmin, *spmax;
        static char **out;
        static int *outsize;
-       char item_name[MAX_SENSORS_DEV_LEN + 8];
+       char item_name[MAX_SENSORS_DEV_LEN + 16];
        int i;
        double tval;
 
@@ -4424,7 +4459,7 @@ __print_funct_t svg_print_pwr_temp_stats(struct activity *a, int curr, int actio
                 * Allocate arrays that will contain the graphs data
                 * and the min/max values.
                 */
-               out = allocate_graph_lines(2 * a->item_list_sz, &outsize, &spmin, &spmax);
+               out = allocate_graph_lines(TEMP_ARRAY_SZ * a->item_list_sz, &outsize, &spmin, &spmax);
        }
 
        if (action & F_MAIN) {
@@ -4434,30 +4469,30 @@ __print_funct_t svg_print_pwr_temp_stats(struct activity *a, int curr, int actio
                        spc = (struct stats_pwr_temp *) ((char *) a->buf[curr] + i * a->msize);
 
                        /* Look for min/max values */
-                       if (spc->temp < *(spmin + 2 * i)) {
-                               *(spmin + 2 * i) = spc->temp;
+                       if (spc->temp < *(spmin + TEMP_ARRAY_SZ * i)) {
+                               *(spmin + TEMP_ARRAY_SZ * i) = spc->temp;
                        }
-                       if (spc->temp > *(spmax + 2 * i)) {
-                               *(spmax + 2 * i) = spc->temp;
+                       if (spc->temp > *(spmax + TEMP_ARRAY_SZ * i)) {
+                               *(spmax + TEMP_ARRAY_SZ * i) = spc->temp;
                        }
                        tval = (spc->temp_max - spc->temp_min) ?
                               (spc->temp - spc->temp_min) / (spc->temp_max - spc->temp_min) * 100 :
                               0.0;
-                       if (tval < *(spmin + 2 * i + 1)) {
-                               *(spmin + 2 * i + 1) = tval;
+                       if (tval < *(spmin + TEMP_ARRAY_SZ * i + 1)) {
+                               *(spmin + TEMP_ARRAY_SZ * i + 1) = tval;
                        }
-                       if (tval > *(spmax + 2 * i + 1)) {
-                               *(spmax + 2 * i + 1) = tval;
+                       if (tval > *(spmax + TEMP_ARRAY_SZ * i + 1)) {
+                               *(spmax + TEMP_ARRAY_SZ * i + 1) = tval;
                        }
 
                        /* degC */
                        lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                                 (double) spc->temp,
-                                out + 2 * i, outsize + 2 * i, svg_p->restart);
+                                out + TEMP_ARRAY_SZ * i, outsize + TEMP_ARRAY_SZ * i, svg_p->restart);
                        /* %temp */
                        brappend(record_hdr->ust_time - svg_p->ust_time_ref,
                                 0.0, tval,
-                                out + 2 * i + 1, outsize + 2 * i + 1, svg_p->dt);
+                                out + TEMP_ARRAY_SZ * i + 1, outsize + TEMP_ARRAY_SZ * i + 1, svg_p->dt);
                }
        }
 
@@ -4468,13 +4503,14 @@ __print_funct_t svg_print_pwr_temp_stats(struct activity *a, int curr, int actio
 
                        spc = (struct stats_pwr_temp *) ((char *) a->buf[curr] + i * a->msize);
 
-                       snprintf(item_name, MAX_SENSORS_DEV_LEN + 8, "%d: %s", i + 1, spc->device);
-                       item_name[MAX_SENSORS_DEV_LEN + 7] = '\0';
+                       snprintf(item_name, sizeof(item_name), "%d: %s", i + 1, spc->device);
+                       item_name[sizeof(item_name) - 1] = '\0';
 
                        if (draw_activity_graphs(a->g_nr, g_type,
                                                 title, g_title, item_name, group,
-                                                spmin + 2 * i, spmax + 2 * i, out + 2 * i, outsize + 2 * i,
-                                                svg_p, record_hdr, FALSE, a->id, xid)) {
+                                                spmin + TEMP_ARRAY_SZ * i, spmax + TEMP_ARRAY_SZ * i,
+                                                out + TEMP_ARRAY_SZ * i, outsize + TEMP_ARRAY_SZ * i,
+                                                svg_p, record_hdr, FALSE, a, xid)) {
                                xid++;
                        }
                }
@@ -4500,6 +4536,7 @@ __print_funct_t svg_print_pwr_temp_stats(struct activity *a, int curr, int actio
  * @record_hdr Pointer on record header of current stats sample.
  ***************************************************************************
  */
+#define IN_ARRAY_SZ    2
 __print_funct_t svg_print_pwr_in_stats(struct activity *a, int curr, int action, struct svg_parm *svg_p,
                                       unsigned long long itv, struct record_header *record_hdr)
 {
@@ -4513,7 +4550,7 @@ __print_funct_t svg_print_pwr_in_stats(struct activity *a, int curr, int action,
        static double *spmin, *spmax;
        static char **out;
        static int *outsize;
-       char item_name[MAX_SENSORS_DEV_LEN + 8];
+       char item_name[MAX_SENSORS_DEV_LEN + 16];
        int i;
        double tval;
 
@@ -4522,7 +4559,7 @@ __print_funct_t svg_print_pwr_in_stats(struct activity *a, int curr, int action,
                 * Allocate arrays that will contain the graphs data
                 * and the min/max values.
                 */
-               out = allocate_graph_lines(2 * a->item_list_sz, &outsize, &spmin, &spmax);
+               out = allocate_graph_lines(IN_ARRAY_SZ * a->item_list_sz, &outsize, &spmin, &spmax);
        }
 
        if (action & F_MAIN) {
@@ -4532,30 +4569,30 @@ __print_funct_t svg_print_pwr_in_stats(struct activity *a, int curr, int action,
                        spc = (struct stats_pwr_in *) ((char *) a->buf[curr] + i * a->msize);
 
                        /* Look for min/max values */
-                       if (spc->in < *(spmin + 2 * i)) {
-                               *(spmin + 2 * i) = spc->in;
+                       if (spc->in < *(spmin + IN_ARRAY_SZ * i)) {
+                               *(spmin + IN_ARRAY_SZ * i) = spc->in;
                        }
-                       if (spc->in > *(spmax + 2 * i)) {
-                               *(spmax + 2 * i) = spc->in;
+                       if (spc->in > *(spmax + IN_ARRAY_SZ * i)) {
+                               *(spmax + IN_ARRAY_SZ * i) = spc->in;
                        }
                        tval = (spc->in_max - spc->in_min) ?
                               (spc->in - spc->in_min) / (spc->in_max - spc->in_min) * 100 :
                               0.0;
-                       if (tval < *(spmin + 2 * i + 1)) {
-                               *(spmin + 2 * i + 1) = tval;
+                       if (tval < *(spmin + IN_ARRAY_SZ * i + 1)) {
+                               *(spmin + IN_ARRAY_SZ * i + 1) = tval;
                        }
-                       if (tval > *(spmax + 2 * i + 1)) {
-                               *(spmax + 2 * i + 1) = tval;
+                       if (tval > *(spmax + IN_ARRAY_SZ * i + 1)) {
+                               *(spmax + IN_ARRAY_SZ * i + 1) = tval;
                        }
 
                        /* inV */
                        lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                                 (double) spc->in,
-                                out + 2 * i, outsize + 2 * i, svg_p->restart);
+                                out + IN_ARRAY_SZ * i, outsize + IN_ARRAY_SZ * i, svg_p->restart);
                        /* %in */
                        brappend(record_hdr->ust_time - svg_p->ust_time_ref,
                                 0.0, tval,
-                                out + 2 * i + 1, outsize + 2 * i + 1, svg_p->dt);
+                                out + IN_ARRAY_SZ * i + 1, outsize + IN_ARRAY_SZ * i + 1, svg_p->dt);
                }
        }
 
@@ -4566,13 +4603,14 @@ __print_funct_t svg_print_pwr_in_stats(struct activity *a, int curr, int action,
 
                        spc = (struct stats_pwr_in *) ((char *) a->buf[curr]  + i * a->msize);
 
-                       snprintf(item_name, MAX_SENSORS_DEV_LEN + 8, "%d: %s", i + 1, spc->device);
-                       item_name[MAX_SENSORS_DEV_LEN + 7] = '\0';
+                       snprintf(item_name, sizeof(item_name), "%d: %s", i + 1, spc->device);
+                       item_name[sizeof(item_name) - 1] = '\0';
 
                        if (draw_activity_graphs(a->g_nr, g_type,
                                                 title, g_title, item_name, group,
-                                                spmin + 2 * i, spmax + 2 * i, out + 2 * i, outsize + 2 * i,
-                                                svg_p, record_hdr, FALSE, a->id, xid)) {
+                                                spmin + IN_ARRAY_SZ * i, spmax + IN_ARRAY_SZ * i,
+                                                out + IN_ARRAY_SZ * i, outsize + IN_ARRAY_SZ * i,
+                                                svg_p, record_hdr, FALSE, a, xid)) {
                                xid++;
                        }
                }
@@ -4669,7 +4707,7 @@ __print_funct_t svg_print_huge_stats(struct activity *a, int curr, int action, s
        if (action & F_END) {
                draw_activity_graphs(a->g_nr, g_type,
                                     title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -4692,6 +4730,7 @@ __print_funct_t svg_print_huge_stats(struct activity *a, int curr, int action, s
  * @record_hdr Pointer on record header of current stats sample.
  ***************************************************************************
  */
+#define FS_ARRAY_SZ    8
 __print_funct_t svg_print_filesystem_stats(struct activity *a, int curr, int action, struct svg_parm *svg_p,
                                           unsigned long long itv, struct record_header *record_hdr)
 {
@@ -4708,7 +4747,7 @@ __print_funct_t svg_print_filesystem_stats(struct activity *a, int curr, int act
        static double *spmin, *spmax;
        static char **out;
        static int *outsize;
-       char *item_name;
+       char *dev_name, *item_name;
        double tval;
        int i, k, pos, restart;
 
@@ -4716,11 +4755,10 @@ __print_funct_t svg_print_filesystem_stats(struct activity *a, int curr, int act
                /*
                 * Allocate arrays (#0..6) that will contain the graphs data
                 * and the min/max values.
-                * Also allocate two additional arrays (#7..8) for each filesystem:
-                 * out + 7 will contain the filesystem name,
-                * out + 8 will contain the mount point.
+                * Also allocate an additional arrays (#7) for each filesystem:
+                 * out + 7 will contain the persistent or standard fs name, or mount point.
                 */
-               out = allocate_graph_lines(9 * a->item_list_sz, &outsize, &spmin, &spmax);
+               out = allocate_graph_lines(FS_ARRAY_SZ * a->item_list_sz, &outsize, &spmin, &spmax);
        }
 
        if (action & F_MAIN) {
@@ -4728,18 +4766,20 @@ __print_funct_t svg_print_filesystem_stats(struct activity *a, int curr, int act
                for (i = 0; i < a->nr[curr]; i++) {
                        sfc = (struct stats_filesystem *) ((char *) a->buf[curr] + i * a->msize);
 
+                       /* Get name to display (persistent or standard fs name, or mount point) */
+                       dev_name = get_fs_name_to_display(a, flags, sfc);
+
                        if (a->item_list != NULL) {
                                /* A list of devices has been entered on the command line */
-                               if (!search_list_item(a->item_list,
-                                                     DISPLAY_MOUNT(a->opt_flags) ? sfc->mountp : sfc->fs_name))
+                               if (!search_list_item(a->item_list, dev_name))
                                        /* Device not found */
                                        continue;
                        }
 
                        /* Look for corresponding graph */
                        for (k = 0; k < a->item_list_sz; k++) {
-                               item_name = *(out + k * 9 + 7);
-                               if (!strcmp(sfc->fs_name, item_name))
+                               item_name = *(out + k * FS_ARRAY_SZ + 7);
+                               if (!strcmp(dev_name, item_name))
                                        /* Graph found! */
                                        break;
                        }
@@ -4747,7 +4787,7 @@ __print_funct_t svg_print_filesystem_stats(struct activity *a, int curr, int act
                        if (k == a->item_list_sz) {
                                /* Graph not found: Look for first free entry */
                                for (k = 0; k < a->item_list_sz; k++) {
-                                       item_name = *(out + k * 9 + 7);
+                                       item_name = *(out + k * FS_ARRAY_SZ + 7);
                                        if (!strcmp(item_name, ""))
                                                break;
                                }
@@ -4761,15 +4801,12 @@ __print_funct_t svg_print_filesystem_stats(struct activity *a, int curr, int act
                                }
                        }
 
-                       pos = k * 9;
+                       pos = k * FS_ARRAY_SZ;
 
                        item_name = *(out + pos + 7);
                        if (!item_name[0]) {
                                /* Save filesystem name and mount point (if not already done) */
-                               strncpy(item_name, sfc->fs_name, CHUNKSIZE);
-                               item_name[CHUNKSIZE - 1] = '\0';
-                               item_name = *(out + pos + 8);
-                               strncpy(item_name, sfc->mountp, CHUNKSIZE);
+                               strncpy(item_name, dev_name, CHUNKSIZE);
                                item_name[CHUNKSIZE - 1] = '\0';
                        }
 
@@ -4887,11 +4924,11 @@ __print_funct_t svg_print_filesystem_stats(struct activity *a, int curr, int act
                for (i = 0; i < a->item_list_sz; i++) {
 
                        /* Check if there is something to display */
-                       pos = i * 9;
+                       pos = i * FS_ARRAY_SZ;
                        if (!**(out + pos))
                                continue;
 
-                       /* Conversion B -> MB and inodes/1000 */
+                       /* Conversion B -> MiB and inodes/1000 */
                        for (k = 0; k < 2; k++) {
                                *(spmin + pos + k) /= (1024 * 1024);
                                *(spmax + pos + k) /= (1024 * 1024);
@@ -4899,16 +4936,11 @@ __print_funct_t svg_print_filesystem_stats(struct activity *a, int curr, int act
                                *(spmax + pos + 4 + k) /= 1000;
                        }
 
-                       if (DISPLAY_MOUNT(a->opt_flags)) {
-                               item_name = *(out + pos + 8);
-                       }
-                       else {
-                               item_name = *(out + pos + 7);
-                       }
+                       item_name = *(out + pos + 7);
 
                        if (draw_activity_graphs(a->g_nr, g_type, title, g_title, item_name, group,
                                                 spmin + pos, spmax + pos, out + pos, outsize + pos,
-                                                svg_p, record_hdr, FALSE, a->id, xid)) {
+                                                svg_p, record_hdr, FALSE, a, xid)) {
                                xid++;
                        }
                }
@@ -4934,6 +4966,7 @@ __print_funct_t svg_print_filesystem_stats(struct activity *a, int curr, int act
  * @record_hdr Pointer on record header of current stats sample.
  ***************************************************************************
  */
+#define FC_ARRAY_SZ    5
 __print_funct_t svg_print_fchost_stats(struct activity *a, int curr, int action, struct svg_parm *svg_p,
                                       unsigned long long itv, struct record_header *record_hdr)
 {
@@ -4959,18 +4992,17 @@ __print_funct_t svg_print_fchost_stats(struct activity *a, int curr, int action,
                 * has either still not been registered, or has been unregistered
                 * (outsize + 4).
                 */
-               out = allocate_graph_lines(5 * a->item_list_sz, &outsize, &spmin, &spmax);
+               out = allocate_graph_lines(FC_ARRAY_SZ * a->item_list_sz, &outsize, &spmin, &spmax);
        }
 
        if (action & F_MAIN) {
                memset(&sfczero, 0, sizeof(struct stats_fchost));
-               restart = svg_p->restart;
                /*
                 * Mark previously registered interfaces as now
                 * possibly unregistered for all graphs.
                 */
                for (k = 0; k < a->item_list_sz; k++) {
-                       unregistered = outsize + k * 5 + 4;
+                       unregistered = outsize + k * FC_ARRAY_SZ + 4;
                        if (*unregistered == FALSE) {
                                *unregistered = MAYBE;
                        }
@@ -4981,10 +5013,11 @@ __print_funct_t svg_print_fchost_stats(struct activity *a, int curr, int action,
 
                        found = FALSE;
                        sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize);
+                       restart = svg_p->restart;
 
                        /* Look for corresponding graph */
                        for (k = 0; k < a->item_list_sz; k++) {
-                               item_name = *(out + k * 5 + 4);
+                               item_name = *(out + k * FC_ARRAY_SZ + 4);
                                if (!strcmp(sfcc->fchost_name, item_name))
                                        /* Graph found! */
                                        break;
@@ -4992,7 +5025,7 @@ __print_funct_t svg_print_fchost_stats(struct activity *a, int curr, int action,
                        if (k == a->item_list_sz) {
                                /* Graph not found: Look for first free entry */
                                for (k = 0; k < a->item_list_sz; k++) {
-                                       item_name = *(out + k * 5 + 4);
+                                       item_name = *(out + k * FC_ARRAY_SZ + 4);
                                        if (!strcmp(item_name, ""))
                                                break;
                                }
@@ -5006,7 +5039,7 @@ __print_funct_t svg_print_fchost_stats(struct activity *a, int curr, int action,
                                }
                        }
 
-                       pos = k * 5;
+                       pos = k * FC_ARRAY_SZ;
                        unregistered = outsize + pos + 4;
 
                        if (a->nr[!curr] > 0) {
@@ -5035,6 +5068,7 @@ __print_funct_t svg_print_fchost_stats(struct activity *a, int curr, int action,
                        if (!found) {
                                /* This is a newly registered host */
                                sfcp = &sfczero;
+                               restart = TRUE;
                        }
 
                        /*
@@ -5078,7 +5112,7 @@ __print_funct_t svg_print_fchost_stats(struct activity *a, int curr, int action,
 
                /* Mark interfaces not seen here as now unregistered */
                for (k = 0; k < a->item_list_sz; k++) {
-                       unregistered = outsize + k * 5 + 4;
+                       unregistered = outsize + k * FC_ARRAY_SZ + 4;
                        if (*unregistered != FALSE) {
                                *unregistered = TRUE;
                        }
@@ -5089,7 +5123,7 @@ __print_funct_t svg_print_fchost_stats(struct activity *a, int curr, int action,
                for (i = 0; i < a->item_list_sz; i++) {
 
                        /* Check if there is something to display */
-                       pos = i * 5;
+                       pos = i * FC_ARRAY_SZ;
                        if (!**(out + pos))
                                continue;
 
@@ -5097,7 +5131,7 @@ __print_funct_t svg_print_fchost_stats(struct activity *a, int curr, int action,
                        draw_activity_graphs(a->g_nr, g_type,
                                             title, g_title, item_name, group,
                                             spmin + pos, spmax + pos, out + pos, outsize + pos,
-                                            svg_p, record_hdr, FALSE, a->id, i);
+                                            svg_p, record_hdr, FALSE, a, i);
                }
 
                /* Free remaining structures */
@@ -5121,6 +5155,7 @@ __print_funct_t svg_print_fchost_stats(struct activity *a, int curr, int action,
  * @record_hdr Pointer on record header of current stats sample.
  ***************************************************************************
  */
+#define SOFT_ARRAY_SZ  5
 __print_funct_t svg_print_softnet_stats(struct activity *a, int curr, int action, struct svg_parm *svg_p,
                                        unsigned long long itv, struct record_header *record_hdr)
 {
@@ -5144,7 +5179,7 @@ __print_funct_t svg_print_softnet_stats(struct activity *a, int curr, int action
                 * Allocate arrays that will contain the graphs data
                 * and the min/max values.
                 */
-               out = allocate_graph_lines(5 * a->item_list_sz, &outsize, &spmin, &spmax);
+               out = allocate_graph_lines(SOFT_ARRAY_SZ * a->item_list_sz, &outsize, &spmin, &spmax);
        }
 
        if (action & F_MAIN) {
@@ -5187,7 +5222,7 @@ __print_funct_t svg_print_softnet_stats(struct activity *a, int curr, int action
                                        ssnc = &ssnczero;
                                }
                        }
-                       pos = i * 5;
+                       pos = i * SOFT_ARRAY_SZ;
 
                        /* Check for min/max values */
                        save_extrema(a->gtypes_nr, (void *) ssnc, (void *) ssnp,
@@ -5224,7 +5259,7 @@ __print_funct_t svg_print_softnet_stats(struct activity *a, int curr, int action
                                /* No */
                                continue;
 
-                       pos = i * 5;
+                       pos = i * SOFT_ARRAY_SZ;
 
                        if (!i) {
                                /* This is CPU "all" */
@@ -5237,7 +5272,7 @@ __print_funct_t svg_print_softnet_stats(struct activity *a, int curr, int action
                        draw_activity_graphs(a->g_nr, g_type,
                                             title, g_title, item_name, group,
                                             spmin + pos, spmax + pos, out + pos, outsize + pos,
-                                            svg_p, record_hdr, FALSE, a->id, i);
+                                            svg_p, record_hdr, FALSE, a, i);
                }
 
                /* Free remaining structures */
@@ -5268,23 +5303,14 @@ __print_funct_t svg_print_psicpu_stats(struct activity *a, int curr, int action,
                *psic = (struct stats_psi_cpu *) a->buf[curr],
                *psip = (struct stats_psi_cpu *) a->buf[!curr];
        int group[] = {3, 1};
-       int g_type[] = {SVG_LINE_GRAPH, SVG_LINE_GRAPH};
+       int g_type[] = {SVG_LINE_GRAPH, SVG_BAR_GRAPH};
        char *title[] = {"CPU pressure trends (some tasks)", "CPU stall time (some tasks)"};
-       char *g_title[] = {"s_acpu10", "s_acpu60", "s_acpu300",
-                          "s_tcpu/s"};
-       /*
-        * s_acpu10:0, s_acpu60:1, s_acpu300:2, s_tcpu/s:3
-        * g_fields[]: metric position for each field in stats_psi_cpu structure
-        *       some_cpu_total=3  -> only s_tcpu/s will be checked in save_extrema() function.
-        *      (some_acpu_10=0)
-        *      (some_acpu_60=1)
-        *      (some_acpu_300=2)
-        */
-       int g_fields[] = {3};
-       unsigned int local_types_nr[] = {1, 0, 0};
+       char *g_title[] = {"%scpu-10", "%scpu-60", "%scpu-300",
+                          "%scpu"};
        static double *spmin, *spmax;
        static char **out;
        static int *outsize;
+       double tval;
 
        if (action & F_BEGIN) {
                /*
@@ -5295,13 +5321,7 @@ __print_funct_t svg_print_psicpu_stats(struct activity *a, int curr, int action,
        }
 
        if (action & F_MAIN) {
-               /*
-                * Check for min/max values.
-                * Don't use save_extrema() function as some values are absolute ones (s_acpu10,...)
-                * but s_tcpu/s is a per-second value.
-                */
-               save_extrema(local_types_nr, (void *) a->buf[curr], (void *) a->buf[!curr],
-                            itv, spmin, spmax, g_fields);
+               /* Check for min/max values */
                if (psic->some_acpu_10 > *spmax) {
                        *spmax = psic->some_acpu_10;
                }
@@ -5320,23 +5340,31 @@ __print_funct_t svg_print_psicpu_stats(struct activity *a, int curr, int action,
                if (psic->some_acpu_300 < *(spmin + 2)) {
                        *(spmin + 2) = psic->some_acpu_300;
                }
+               tval = ((double) psic->some_cpu_total - psip->some_cpu_total) / (100 * itv);
+               if (tval > *(spmax + 3)) {
+                       *(spmax + 3) = tval;
+               }
+               if (tval < *(spmin + 3)) {
+                       *(spmin + 3) = tval;
+               }
 
-               /* s_acpu10 */
+               /* %scpu-10 */
                lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                         (double) psic->some_acpu_10 / 100,
                         out, outsize, svg_p->restart);
-               /* s_acpu60 */
+               /* %scpu-60 */
                lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                         (double) psic->some_acpu_60 / 100,
                         out + 1, outsize + 1, svg_p->restart);
-               /* s_acpu300 */
+               /* %scpu-300 */
                lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                         (double) psic->some_acpu_300 / 100,
                         out + 2, outsize + 2, svg_p->restart);
-               /* s_tcpu/s */
-               lniappend(record_hdr->ust_time - svg_p->ust_time_ref,
-                         S_VALUE(psip->some_cpu_total, psic->some_cpu_total, itv),
-                         out + 3, outsize + 3, svg_p->restart);
+               /* %scpu */
+               brappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        0.0,
+                        ((double) psic->some_cpu_total - psip->some_cpu_total) / (100 * itv),
+                        out + 3, outsize + 3, svg_p->dt);
        }
 
        if (action & F_END) {
@@ -5346,7 +5374,7 @@ __print_funct_t svg_print_psicpu_stats(struct activity *a, int curr, int action,
                *(spmin + 2) /= 100; *(spmax + 2) /= 100;
 
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -5376,18 +5404,17 @@ __print_funct_t svg_print_psiio_stats(struct activity *a, int curr, int action,
                *psic = (struct stats_psi_io *) a->buf[curr],
                *psip = (struct stats_psi_io *) a->buf[!curr];
        int group[] = {3, 1, 3, 1};
-       int g_type[] = {SVG_LINE_GRAPH, SVG_LINE_GRAPH, SVG_LINE_GRAPH, SVG_LINE_GRAPH};
+       int g_type[] = {SVG_LINE_GRAPH, SVG_BAR_GRAPH, SVG_LINE_GRAPH, SVG_BAR_GRAPH};
        char *title[] = {"I/O pressure trends (some tasks)", "I/O stall time (some tasks)",
                         "I/O pressure trends (full)", "I/O stall time (full)"};
-       char *g_title[] = {"s_aio10", "s_aio60", "s_aio300",
-                          "s_tio/s",
-                          "f_aio10", "f_aio60", "f_aio300",
-                          "f_tio/s"};
-       int g_fields[] = {3, 7};
-       unsigned int local_types_nr[] = {2, 0, 0};
+       char *g_title[] = {"%sio-10", "%sio-60", "%sio-300",
+                          "%sio",
+                          "%fio-10", "%fio-60", "%fio-300",
+                          "%fio"};
        static double *spmin, *spmax;
        static char **out;
        static int *outsize;
+       double tval;
 
        if (action & F_BEGIN) {
                /*
@@ -5398,13 +5425,7 @@ __print_funct_t svg_print_psiio_stats(struct activity *a, int curr, int action,
        }
 
        if (action & F_MAIN) {
-               /*
-                * Check for min/max values.
-                * Don't use save_extrema() function as some values are absolute ones and others are
-                * per-second ones.
-                */
-               save_extrema(local_types_nr, (void *) a->buf[curr], (void *) a->buf[!curr],
-                            itv, spmin, spmax, g_fields);
+               /* Check for min/max values */
                if (psic->some_aio_10 > *spmax) {
                        *spmax = psic->some_aio_10;
                }
@@ -5423,6 +5444,13 @@ __print_funct_t svg_print_psiio_stats(struct activity *a, int curr, int action,
                if (psic->some_aio_300 < *(spmin + 2)) {
                        *(spmin + 2) = psic->some_aio_300;
                }
+               tval = ((double) psic->some_io_total - psip->some_io_total) / (100 * itv);
+               if (tval > *(spmax + 3)) {
+                       *(spmax + 3) = tval;
+               }
+               if (tval < *(spmin + 3)) {
+                       *(spmin + 3) = tval;
+               }
 
                if (psic->full_aio_10 > *(spmax + 4)) {
                        *(spmax + 4) = psic->full_aio_10;
@@ -5442,40 +5470,49 @@ __print_funct_t svg_print_psiio_stats(struct activity *a, int curr, int action,
                if (psic->full_aio_300 < *(spmin + 6)) {
                        *(spmin + 6) = psic->full_aio_300;
                }
+               tval = ((double) psic->full_io_total - psip->full_io_total) / (100 * itv);
+               if (tval > *(spmax + 7)) {
+                       *(spmax + 7) = tval;
+               }
+               if (tval < *(spmin + 7)) {
+                       *(spmin + 7) = tval;
+               }
 
-               /* s_aio10 */
+               /* %sio-10 */
                lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                         (double) psic->some_aio_10 / 100,
                         out, outsize, svg_p->restart);
-               /* s_aio60 */
+               /* %sio-60 */
                lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                         (double) psic->some_aio_60 / 100,
                         out + 1, outsize + 1, svg_p->restart);
-               /* s_aio300 */
+               /* %sio-300 */
                lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                         (double) psic->some_aio_300 / 100,
                         out + 2, outsize + 2, svg_p->restart);
-               /* s_tio/s */
-               lniappend(record_hdr->ust_time - svg_p->ust_time_ref,
-                         S_VALUE(psip->some_io_total, psic->some_io_total, itv),
-                         out + 3, outsize + 3, svg_p->restart);
+               /* %sio */
+               brappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        0.0,
+                        ((double) psic->some_io_total - psip->some_io_total) / (100 * itv),
+                        out + 3, outsize + 3, svg_p->dt);
 
-               /* f_aio10 */
+               /* %fio-10 */
                lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                         (double) psic->full_aio_10 / 100,
                         out + 4, outsize + 4, svg_p->restart);
-               /* f_aio60 */
+               /* %fio-60 */
                lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                         (double) psic->full_aio_60 / 100,
                         out + 5, outsize + 5, svg_p->restart);
-               /* f_aio300 */
+               /* %fio-300 */
                lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                         (double) psic->full_aio_300 / 100,
                         out + 6, outsize + 6, svg_p->restart);
-               /* f_tio/s */
-               lniappend(record_hdr->ust_time - svg_p->ust_time_ref,
-                         S_VALUE(psip->full_io_total, psic->full_io_total, itv),
-                         out + 7, outsize + 7, svg_p->restart);
+               /* %fio */
+               brappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        0.0,
+                        ((double) psic->full_io_total - psip->full_io_total) / (100 * itv),
+                        out + 7, outsize + 7, svg_p->dt);
        }
 
        if (action & F_END) {
@@ -5489,7 +5526,7 @@ __print_funct_t svg_print_psiio_stats(struct activity *a, int curr, int action,
                *(spmin + 6) /= 100; *(spmax + 6) /= 100;
 
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);
@@ -5519,18 +5556,17 @@ __print_funct_t svg_print_psimem_stats(struct activity *a, int curr, int action,
                *psic = (struct stats_psi_mem *) a->buf[curr],
                *psip = (struct stats_psi_mem *) a->buf[!curr];
        int group[] = {3, 1, 3, 1};
-       int g_type[] = {SVG_LINE_GRAPH, SVG_LINE_GRAPH, SVG_LINE_GRAPH, SVG_LINE_GRAPH};
+       int g_type[] = {SVG_LINE_GRAPH, SVG_BAR_GRAPH, SVG_LINE_GRAPH, SVG_BAR_GRAPH};
        char *title[] = {"Memory pressure trends (some tasks)", "Memory stall time (some tasks)",
                         "Memory pressure trends (full)", "Memory stall time (full)"};
-       char *g_title[] = {"s_amem10", "s_amem60", "s_amem300",
-                          "s_tmem/s",
-                          "f_amem10", "f_amem60", "f_amem300",
-                          "f_tmem/s"};
-       int g_fields[] = {3, 7};
-       unsigned int local_types_nr[] = {2, 0, 0};
+       char *g_title[] = {"%smem-10", "%smem-60", "%smem-300",
+                          "%smem",
+                          "%fmem-10", "%fmem-60", "%fmem-300",
+                          "%fmem"};
        static double *spmin, *spmax;
        static char **out;
        static int *outsize;
+       double tval;
 
        if (action & F_BEGIN) {
                /*
@@ -5541,13 +5577,7 @@ __print_funct_t svg_print_psimem_stats(struct activity *a, int curr, int action,
        }
 
        if (action & F_MAIN) {
-               /*
-                * Check for min/max values.
-                * Don't use save_extrema() function as some values are absolute ones and others are
-                * per-second ones.
-                */
-               save_extrema(local_types_nr, (void *) a->buf[curr], (void *) a->buf[!curr],
-                            itv, spmin, spmax, g_fields);
+               /* Check for min/max values */
                if (psic->some_amem_10 > *spmax) {
                        *spmax = psic->some_amem_10;
                }
@@ -5566,6 +5596,13 @@ __print_funct_t svg_print_psimem_stats(struct activity *a, int curr, int action,
                if (psic->some_amem_300 < *(spmin + 2)) {
                        *(spmin + 2) = psic->some_amem_300;
                }
+               tval = ((double) psic->some_mem_total - psip->some_mem_total) / (100 * itv);
+               if (tval > *(spmax + 3)) {
+                       *(spmax + 3) = tval;
+               }
+               if (tval < *(spmin + 3)) {
+                       *(spmin + 3) = tval;
+               }
 
                if (psic->full_amem_10 > *(spmax + 4)) {
                        *(spmax + 4) = psic->full_amem_10;
@@ -5585,40 +5622,49 @@ __print_funct_t svg_print_psimem_stats(struct activity *a, int curr, int action,
                if (psic->full_amem_300 < *(spmin + 6)) {
                        *(spmin + 6) = psic->full_amem_300;
                }
+               tval = ((double) psic->full_mem_total - psip->full_mem_total) / (100 * itv);
+               if (tval > *(spmax + 7)) {
+                       *(spmax + 7) = tval;
+               }
+               if (tval < *(spmin + 7)) {
+                       *(spmin + 7) = tval;
+               }
 
-               /* s_amem10 */
+               /* %smem-10 */
                lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                         (double) psic->some_amem_10 / 100,
                         out, outsize, svg_p->restart);
-               /* s_amem60 */
+               /* %smem-60 */
                lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                         (double) psic->some_amem_60 / 100,
                         out + 1, outsize + 1, svg_p->restart);
-               /* s_amem300 */
+               /* %smem-300 */
                lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                         (double) psic->some_amem_300 / 100,
                         out + 2, outsize + 2, svg_p->restart);
-               /* s_tmem/s */
-               lniappend(record_hdr->ust_time - svg_p->ust_time_ref,
-                         S_VALUE(psip->some_mem_total, psic->some_mem_total, itv),
-                         out + 3, outsize + 3, svg_p->restart);
+               /* %smem */
+               brappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        0.0,
+                        ((double) psic->some_mem_total - psip->some_mem_total) / (100 * itv),
+                        out + 3, outsize + 3, svg_p->dt);
 
-               /* f_amem10 */
+               /* %fmem-10 */
                lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                         (double) psic->full_amem_10 / 100,
                         out + 4, outsize + 4, svg_p->restart);
-               /* f_amem60 */
+               /* %fmem-60 */
                lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                         (double) psic->full_amem_60 / 100,
                         out + 5, outsize + 5, svg_p->restart);
-               /* f_amem300 */
+               /* %fmem-300 */
                lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
                         (double) psic->full_amem_300 / 100,
                         out + 6, outsize + 6, svg_p->restart);
-               /* f_tmem/s */
-               lniappend(record_hdr->ust_time - svg_p->ust_time_ref,
-                         S_VALUE(psip->full_mem_total, psic->full_mem_total, itv),
-                         out + 7, outsize + 7, svg_p->restart);
+               /* %fmem */
+               brappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        0.0,
+                        ((double) psic->full_mem_total - psip->full_mem_total) / (100 * itv),
+                        out + 7, outsize + 7, svg_p->dt);
        }
 
        if (action & F_END) {
@@ -5632,7 +5678,7 @@ __print_funct_t svg_print_psimem_stats(struct activity *a, int curr, int action,
                *(spmin + 6) /= 100; *(spmax + 6) /= 100;
 
                draw_activity_graphs(a->g_nr, g_type, title, g_title, NULL, group,
-                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0);
+                                    spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a, 0);
 
                /* Free remaining structures */
                free_graphs(out, outsize, spmin, spmax);