Skip to content

Commit

Permalink
Update FC/HBA statistics display functions
Browse files Browse the repository at this point in the history
Various fixes in function used to display FC/HBA statistics:
1) Only one function is necessary to display FC/HBA statistics. So
remove print_avg_fchost_stats() function.
2) At the end of the report, display average statistics per host, not a
summary.
3) Update column width used to display statistics (10 characters wide)
to be consistent with other activities display.
4) Move FCHOST column to the right because the host name length may be
greater than 10 characters.
5) Fix timestamp displayed with header line.
6) Remove extra carriage return at the end of display.

Signed-off-by: Sebastien GODARD <[email protected]>
  • Loading branch information
sysstat committed Apr 12, 2015
1 parent db64e68 commit a3797b1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 50 deletions.
2 changes: 1 addition & 1 deletion activity.c
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ struct activity fchost_act = {
#endif
#ifdef SOURCE_SAR
.f_print = print_fchost_stats,
.f_print_avg = print_avg_fchost_stats,
.f_print_avg = print_fchost_stats,
#endif
#ifdef SOURCE_SADF
.f_render = render_fchost_stats,
Expand Down
57 changes: 10 additions & 47 deletions pr_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -2585,73 +2585,36 @@ __print_funct_t print_avg_filesystem_stats(struct activity *a, int prev, int cur

/*
***************************************************************************
* Display Fibre Channel HBA statistics. This function is used to
* display instantaneous and average statistics.
* Display Fibre Channel HBA statistics.
*
* IN:
* @a Activity structure with statistics.
* @prev Index in array where stats used as reference are.
* @curr Index in array for current sample statistics.
* @dispavg TRUE if displaying average statistics.
* @itv Interval of time in jiffies.
***************************************************************************
*/
__print_funct_t stub_print_fchost_stats(struct activity *a, int prev, int curr,
int dispavg, unsigned long long itv)
__print_funct_t print_fchost_stats(struct activity *a, int prev, int curr,
unsigned long long itv)
{
int i;
struct stats_fchost *sfcc,*sfcp;


if (dis) {
printf("\n%-11s FCHOST fch_rxf/s fch_txf/s fch_rxw/s fch_txw/s\n",
(dispavg ? _("Summary:") : timestamp[curr]));
printf("\n%-11s fch_rxf/s fch_txf/s fch_rxw/s fch_txw/s FCHOST\n",
timestamp[!curr]);
}

for (i = 0; i < a->nr; i++) {

sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize);
sfcp = (struct stats_fchost *) ((char *) a->buf[prev] + i * a->msize);

printf("%-11s %10s %11.2f %11.2f %11.2f %11.2f\n",
(dispavg ? _("Average:") : timestamp[curr]),
sfcc->fchost_name,
printf("%-11s %9.2f %9.2f %9.2f %9.2f %s\n", timestamp[curr],
S_VALUE(sfcp->f_rxframes, sfcc->f_rxframes, itv),
S_VALUE(sfcp->f_txframes, sfcc->f_txframes, itv),
S_VALUE(sfcp->f_rxwords, sfcc->f_rxwords, itv),
S_VALUE(sfcp->f_txwords, sfcc->f_txwords, itv));
S_VALUE(sfcp->f_txwords, sfcc->f_txwords, itv),
sfcc->fchost_name);
}
printf("\n");
}

/*
***************************************************************************
* Display Fibre Channel HBA statistics.
*
* IN:
* @a Activity structure with statistics.
* @prev Index in array where stats used as reference are.
* @curr Index in array for current sample statistics.
* @itv Interval of time in jiffies.
***************************************************************************
*/
__print_funct_t print_fchost_stats(struct activity *a, int prev, int curr,
unsigned long long itv)
{
stub_print_fchost_stats(a, prev, curr, FALSE, itv);
}

/*
***************************************************************************
* Display average Fibre Channel HBA statistics.
*
* IN:
* @a Activity structure with statistics.
* @prev Index in array where stats used as reference are.
* @curr Index in array for current sample statistics.
* @itv Interval of time in jiffies.
***************************************************************************
*/
__print_funct_t print_avg_fchost_stats(struct activity *a, int prev, int curr,
unsigned long long itv)
{
stub_print_fchost_stats(a, prev, curr, TRUE, itv);
}
2 changes: 0 additions & 2 deletions pr_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,5 @@ extern __print_funct_t print_avg_pwr_usb_stats
(struct activity *, int, int, unsigned long long);
extern __print_funct_t print_avg_filesystem_stats
(struct activity *, int, int, unsigned long long);
extern __print_funct_t print_avg_fchost_stats
(struct activity *, int, int, unsigned long long);

#endif /* _PR_STATS_H */

0 comments on commit a3797b1

Please sign in to comment.