]> granicus.if.org Git - sysstat/commitdiff
SVG: Add SVG output for NFS client statistics
authorSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 17 Jun 2016 08:29:33 +0000 (10:29 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 17 Jun 2016 08:29:33 +0000 (10:29 +0200)
These graphs correspond to the output of "sar -n NFS".

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
activity.c
svg_stats.c
svg_stats.h

index 620f6da9a65c75da71ed8cd2aa03f8532b93d5f7..685a05b1cda6b9395036b1e8409d83540287c5ff 100644 (file)
@@ -531,9 +531,10 @@ struct activity net_nfs_act = {
        .f_render       = render_net_nfs_stats,
        .f_xml_print    = xml_print_net_nfs_stats,
        .f_json_print   = json_print_net_nfs_stats,
+       .f_svg_print    = svg_print_net_nfs_stats,
        .hdr_line       = "call/s;retrans/s;read/s;write/s;access/s;getatt/s",
        .name           = "A_NET_NFS",
-       .g_nr           = 0,
+       .g_nr           = 3,
 #endif
        .nr             = 1,
        .nr2            = 1,
index 8c3358810d96c1898da51671171a49c3907a940e..7925f80f7733c8bbc92206df746e525dc411baaa 100644 (file)
@@ -2194,6 +2194,85 @@ __print_funct_t svg_print_net_edev_stats(struct activity *a, int curr, int actio
        }
 }
 
+/*
+ ***************************************************************************
+ * Display NFS client statistics in SVG.
+ *
+ * IN:
+ * @a          Activity structure with statistics.
+ * @curr       Index in array for current sample statistics.
+ * @action     Action expected from current function.
+ * @svg_p      SVG specific parameters: Current graph number (.@graph_no),
+ *             flag indicating that a restart record has been previously
+ *             found (.@restart) and time used for the X axis origin
+ *             (@ust_time_ref).
+ * @itv                Interval of time in jiffies (only with F_MAIN action).
+ * @record_hdr Pointer on record header of current stats sample.
+ ***************************************************************************
+ */
+__print_funct_t svg_print_net_nfs_stats(struct activity *a, int curr, int action, struct svg_parm *svg_p,
+                                       unsigned long long itv, struct record_header *record_hdr)
+{
+       struct stats_net_nfs
+               *snnc = (struct stats_net_nfs *) a->buf[curr],
+               *snnp = (struct stats_net_nfs *) a->buf[!curr];
+       int group[] = {2, 2, 2};
+       char *title[] = {"NFS client statistics (1)", "NFS client statistics (2)", "NFS client statistics (3)"};
+       char *g_title[] = {"call/s", "retrans/s",
+                          "read/s", "write/s",
+                          "access/s", "getatt/s"};
+       static double *spmin, *spmax;
+       static char **out;
+       static int *outsize;
+
+       if (action & F_BEGIN) {
+               /*
+                * Allocate arrays that will contain the graphs data
+                * and the min/max values.
+                */
+               out = allocate_graph_lines(6, &outsize, &spmin, &spmax);
+       }
+
+       if (action & F_MAIN) {
+               /* Check for min/max values */
+               save_extrema(0, 0, 6, (void *) a->buf[curr], (void *) a->buf[!curr],
+                            itv, spmin, spmax);
+
+               /* call/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snnp->nfs_rpccnt, snnc->nfs_rpccnt, itv),
+                        out, outsize, svg_p->restart);
+               /* retrans/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snnp->nfs_rpcretrans, snnc->nfs_rpcretrans, itv),
+                        out + 1, outsize + 1, svg_p->restart);
+               /* read/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snnp->nfs_readcnt, snnc->nfs_readcnt, itv),
+                        out + 2, outsize + 2, svg_p->restart);
+               /* write/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snnp->nfs_writecnt, snnc->nfs_writecnt, itv),
+                        out + 3, outsize + 3, svg_p->restart);
+               /* access/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snnp->nfs_accesscnt, snnc->nfs_accesscnt, itv),
+                        out + 4, outsize + 4, svg_p->restart);
+               /* getatt/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snnp->nfs_getattcnt, snnc->nfs_getattcnt, itv),
+                        out + 5, outsize + 5, svg_p->restart);
+       }
+
+       if (action & F_END) {
+               draw_activity_graphs(a->g_nr, SVG_LINE_GRAPH, title, g_title, NULL, group,
+                                    spmin, spmax, out, outsize, svg_p, record_hdr);
+
+               /* Free remaining structures */
+               free_graphs(out, outsize, spmin, spmax);
+       }
+}
+
 /*
  ***************************************************************************
  * Display network socket statistics in SVG.
index cf9e5439b30188d94544a52c5640252b43d13487..7155d6347a23d651ecdf886a485cdf7f077ec203 100644 (file)
@@ -44,6 +44,9 @@ __print_funct_t svg_print_net_dev_stats
 __print_funct_t svg_print_net_edev_stats
        (struct activity *, int, int, struct svg_parm *, unsigned long long,
         struct record_header *);
+__print_funct_t svg_print_net_nfs_stats
+       (struct activity *, int, int, struct svg_parm *, unsigned long long,
+        struct record_header *);
 __print_funct_t svg_print_net_sock_stats
        (struct activity *, int, int, struct svg_parm *, unsigned long long,
         struct record_header *);