]> granicus.if.org Git - sysstat/blobdiff - svg_stats.c
Merge branch 'scop-grep-E'
[sysstat] / svg_stats.c
index 9b514d2f8e91e97ddf92a33bcd70e4095d703bc1..aea9bda0cd862e86a2c2ba037b343b13a991dda3 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * svg_stats.c: Funtions used by sadf to display statistics in SVG format.
- * (C) 2016-2020 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,
@@ -670,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",
@@ -2135,7 +2140,6 @@ __print_funct_t svg_print_disk_stats(struct activity *a, int curr, int action, s
 
        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.
@@ -2150,6 +2154,7 @@ __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_device_name(sdc->major, sdc->minor, sdc->wwn, sdc->part_nr,
@@ -2210,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);
@@ -2387,7 +2393,6 @@ __print_funct_t svg_print_net_dev_stats(struct activity *a, int curr, int action
 
        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.
@@ -2402,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 */
@@ -2440,6 +2446,7 @@ __print_funct_t svg_print_net_dev_stats(struct activity *a, int curr, int action
                        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);
@@ -2603,7 +2610,6 @@ __print_funct_t svg_print_net_edev_stats(struct activity *a, int curr, int actio
 
        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.
@@ -2618,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 */
@@ -2660,6 +2664,7 @@ __print_funct_t svg_print_net_edev_stats(struct activity *a, int curr, int actio
                        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);
@@ -4992,7 +4997,6 @@ __print_funct_t svg_print_fchost_stats(struct activity *a, int curr, int action,
 
        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.
@@ -5009,6 +5013,7 @@ __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++) {
@@ -5063,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;
                        }
 
                        /*