+
+/*
+ ***************************************************************************
+ * Display huge pages statistics in raw format.
+ *
+ * IN:
+ * @a Activity structure with statistics.
+ * @timestr Time for current statistics sample.
+ * @curr Index in array for current sample statistics.
+ ***************************************************************************
+ */
+__print_funct_t raw_print_huge_stats(struct activity *a, char *timestr, int curr)
+{
+ struct stats_huge
+ *smc = (struct stats_huge *) a->buf[curr];
+
+ printf("%s; %s; %llu;", timestr, pfield(a->hdr_line, FIRST), smc->frhkb);
+ printf(" hugtotal; %llu;", smc->tlhkb);
+ pfield(NULL, 0); /* Skip kbhugused */
+ pfield(NULL, 0); /* Skip %hugused */
+ printf(" %s; %llu;", pfield(NULL, 0), smc->rsvdhkb);
+ printf(" %s; %llu;\n", pfield(NULL, 0), smc->surphkb);
+}
+
+/*
+ ***************************************************************************
+ * Display weighted CPU frequency statistics in raw format.
+ *
+ * IN:
+ * @a Activity structure with statistics.
+ * @timestr Time for current statistics sample.
+ * @curr Index in array for current sample statistics.
+ ***************************************************************************
+ */
+__print_funct_t raw_print_pwr_wghfreq_stats(struct activity *a, char *timestr, int curr)
+{
+ int i, k;
+ struct stats_pwr_wghfreq *spc, *spp, *spc_k, *spp_k;
+
+ for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
+
+ spc = (struct stats_pwr_wghfreq *) ((char *) a->buf[curr] + i * a->msize * a->nr2);
+ spp = (struct stats_pwr_wghfreq *) ((char *) a->buf[!curr] + i * a->msize * a->nr2);
+
+ /* Should current CPU (including CPU "all") be displayed? */
+ if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
+ /* No */
+ continue;
+
+ printf("%s; %s; %d;", timestr, pfield(a->hdr_line, FIRST), i - 1);
+
+ for (k = 0; k < a->nr2; k++) {
+
+ spc_k = (struct stats_pwr_wghfreq *) ((char *) spc + k * a->msize);
+ if (!spc_k->freq)
+ break;
+ spp_k = (struct stats_pwr_wghfreq *) ((char *) spp + k * a->msize);
+
+ printf(" freq; %lu;", spc_k->freq);
+ printf(" tminst");
+ pval(spp_k->time_in_state, spc_k->time_in_state);
+ }
+ printf("\n");
+ }
+}
+
+/*
+ ***************************************************************************
+ * Display USB devices statistics in raw format.
+ *
+ * IN:
+ * @a Activity structure with statistics.
+ * @timestr Time for current statistics sample.
+ * @curr Index in array for current sample statistics.
+ ***************************************************************************
+ */
+__print_funct_t raw_print_pwr_usb_stats(struct activity *a, char *timestr, int curr)
+{
+ int i;
+ struct stats_pwr_usb *suc;
+
+ for (i = 0; i < a->nr[curr]; i++) {
+ suc = (struct stats_pwr_usb *) ((char *) a->buf[curr] + i * a->msize);
+
+ printf("%s; %s; \"%s\";", timestr, pfield(a->hdr_line, FIRST), suc->manufacturer);
+ printf(" %s; \"%s\";", pfield(NULL, 0), suc->product);
+ printf(" %s; %d;", pfield(NULL, 0), suc->bus_nr);
+ printf(" %s; %x;", pfield(NULL, 0), suc->vendor_id);
+ printf(" %s; %x;", pfield(NULL, 0), suc->product_id);
+ printf(" %s; %u;\n", pfield(NULL, 0), suc->bmaxpower);
+ }
+}
+
+/*
+ ***************************************************************************
+ * Display filesystems statistics in raw format.
+ *
+ * IN:
+ * @a Activity structure with statistics.
+ * @timestr Time for current statistics sample.
+ * @curr Index in array for current sample statistics.
+ ***************************************************************************
+ */
+__print_funct_t raw_print_filesystem_stats(struct activity *a, char *timestr, int curr)
+{
+ int i;
+ struct stats_filesystem *sfc;
+ char *dev_name;
+
+ 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, dev_name))
+ /* Device not found */
+ continue;
+ }
+
+ printf("%s; %s; \"%s\";", timestr, pfield(a->hdr_line, FIRST + DISPLAY_MOUNT(a->opt_flags)),
+ dev_name);
+ printf(" f_bfree; %llu;", sfc->f_bfree);
+ printf(" f_blocks; %llu;", sfc->f_blocks);
+ printf(" f_bavail; %llu;", sfc->f_bavail);
+ pfield(NULL, 0); /* Skip MBfsfree */
+ pfield(NULL, 0); /* Skip MBfsused */
+ pfield(NULL, 0); /* Skip %fsused */
+ pfield(NULL, 0); /* Skip %ufsused */
+ printf(" %s; %llu;", pfield(NULL, 0), sfc->f_ffree);
+ printf(" f_files; %llu;\n", sfc->f_files);
+
+ }
+}
+
+/*
+ ***************************************************************************
+ * Display Fibre Channel HBA statistics in raw format.
+ *
+ * IN:
+ * @a Activity structure with statistics.
+ * @timestr Time for current statistics sample.
+ * @curr Index in array for current sample statistics.
+ ***************************************************************************
+ */
+__print_funct_t raw_print_fchost_stats(struct activity *a, char *timestr, int curr)
+{
+ int i, j, j0, found;
+ struct stats_fchost *sfcc, *sfcp, sfczero;
+
+ memset(&sfczero, 0, sizeof(struct stats_fchost));
+
+ for (i = 0; i < a->nr[curr]; i++) {
+
+ found = FALSE;
+ sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize);
+
+ if (a->nr[!curr] > 0) {
+ /* Look for corresponding structure in previous iteration */
+ j = i;
+
+ if (j >= a->nr[!curr]) {
+ j = a->nr[!curr] - 1;
+ }
+
+ j0 = j;
+
+ do {
+ sfcp = (struct stats_fchost *) ((char *) a->buf[!curr] + j * a->msize);
+ if (!strcmp(sfcc->fchost_name, sfcp->fchost_name)) {
+ found = TRUE;
+ break;
+ }
+ if (++j >= a->nr[!curr]) {
+ j = 0;
+ }
+ }
+ while (j != j0);
+ }
+
+ printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
+
+ if (!found) {
+ /* This is a newly registered host. Previous stats are zero */
+ sfcp = &sfczero;
+ if (DISPLAY_DEBUG_MODE(flags)) {
+ printf(" [NEW]");
+ }
+ }
+
+ printf("; %s;", sfcc->fchost_name);
+ printf(" %s", pfield(NULL, 0));
+ pval((unsigned long long) sfcp->f_rxframes, (unsigned long long) sfcc->f_rxframes);
+ printf(" %s", pfield(NULL, 0));
+ pval((unsigned long long) sfcp->f_txframes, (unsigned long long) sfcc->f_txframes);
+ printf(" %s", pfield(NULL, 0));
+ pval((unsigned long long) sfcp->f_rxwords, (unsigned long long) sfcc->f_rxwords);
+ printf(" %s", pfield(NULL, 0));
+ pval((unsigned long long) sfcp->f_txwords, (unsigned long long) sfcc->f_txwords);
+ printf("\n");
+ }
+}
+
+/*
+ ***************************************************************************
+ * Display softnet statistics in raw format.
+ *
+ * IN:
+ * @a Activity structure with statistics.
+ * @timestr Time for current statistics sample.
+ * @curr Index in array for current sample statistics.
+ ***************************************************************************
+ */
+__print_funct_t raw_print_softnet_stats(struct activity *a, char *timestr, int curr)
+{
+ int i;
+ struct stats_softnet *ssnc, *ssnp;
+
+ /* @nr[curr] cannot normally be greater than @nr_ini */
+ if (a->nr[curr] > a->nr_ini) {
+ a->nr_ini = a->nr[curr];
+ }
+
+ /* Don't display CPU "all" which doesn't exist in file */
+ for (i = 1; (i < a->nr_ini) && (i < a->bitmap->b_size + 1); i++) {
+
+ /*
+ * The size of a->buf[...] CPU structure may be different from the default
+ * sizeof(struct stats_pwr_cpufreq) value if data have been read from a file!
+ * That's why we don't use a syntax like:
+ * ssnc = (struct stats_softnet *) a->buf[...] + i;
+ */
+ ssnc = (struct stats_softnet *) ((char *) a->buf[curr] + i * a->msize);
+ ssnp = (struct stats_softnet *) ((char *) a->buf[!curr] + i * a->msize);
+
+ /*
+ * Note: a->nr is in [1, NR_CPUS + 1].
+ * Bitmap size is provided for (NR_CPUS + 1) CPUs.
+ * Anyway, NR_CPUS may vary between the version of sysstat
+ * used by sadc to create a file, and the version of sysstat
+ * used by sar to read it...
+ */
+
+ /* Should current CPU (including CPU "all") be displayed? */
+ if (!(a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))))
+ /* No */
+ continue;
+
+ /* Yes: Display current CPU stats */
+ printf("%s; %s", timestr, pfield(a->hdr_line, FIRST));
+ if (DISPLAY_DEBUG_MODE(flags) && i) {
+ if (ssnc->processed + ssnc->dropped + ssnc->time_squeeze +
+ ssnc->received_rps + ssnc->flow_limit == 0) {
+ /* CPU is considered offline */
+ printf(" [OFF]");
+ }
+ }
+ printf("; %d;", i - 1);
+
+ printf(" %s", pfield(NULL, 0));
+ pval((unsigned long long) ssnp->processed, (unsigned long long) ssnc->processed);
+ printf(" %s", pfield(NULL, 0));
+ pval((unsigned long long) ssnp->dropped, (unsigned long long) ssnc->dropped);
+ printf(" %s", pfield(NULL, 0));
+ pval((unsigned long long) ssnp->time_squeeze, (unsigned long long) ssnc->time_squeeze);
+ printf(" %s", pfield(NULL, 0));
+ pval((unsigned long long) ssnp->received_rps, (unsigned long long) ssnc->received_rps);
+ printf(" %s", pfield(NULL, 0));
+ pval((unsigned long long) ssnp->flow_limit, (unsigned long long) ssnc->flow_limit);
+ printf("\n");
+ }
+}
+
+/*
+ ***************************************************************************
+ * Display pressure-stall CPU statistics in raw format.
+ *
+ * IN:
+ * @a Activity structure with statistics.
+ * @timestr Time for current statistics sample.
+ * @curr Index in array for current sample statistics.
+ ***************************************************************************
+ */
+__print_funct_t raw_print_psicpu_stats(struct activity *a, char *timestr, int curr)
+{
+ struct stats_psi_cpu
+ *psic = (struct stats_psi_cpu *) a->buf[curr],
+ *psip = (struct stats_psi_cpu *) a->buf[!curr];
+
+ printf("%s; %s; %lu;", timestr, pfield(a->hdr_line, FIRST), psic->some_acpu_10);
+ printf(" %s; %lu;", pfield(NULL, 0), psic->some_acpu_60);
+ printf(" %s; %lu;", pfield(NULL, 0), psic->some_acpu_300);
+ printf(" %s", pfield(NULL, 0));
+ pval((unsigned long long) psip->some_cpu_total, (unsigned long long) psic->some_cpu_total);
+ printf("\n");
+}
+
+/*
+ ***************************************************************************
+ * Display pressure-stall I/O statistics in raw format.
+ *
+ * IN:
+ * @a Activity structure with statistics.
+ * @timestr Time for current statistics sample.
+ * @curr Index in array for current sample statistics.
+ ***************************************************************************
+ */
+__print_funct_t raw_print_psiio_stats(struct activity *a, char *timestr, int curr)
+{
+ struct stats_psi_io
+ *psic = (struct stats_psi_io *) a->buf[curr],
+ *psip = (struct stats_psi_io *) a->buf[!curr];
+
+ printf("%s; %s; %lu;", timestr, pfield(a->hdr_line, FIRST), psic->some_aio_10);
+ printf(" %s; %lu;", pfield(NULL, 0), psic->some_aio_60);
+ printf(" %s; %lu;", pfield(NULL, 0), psic->some_aio_300);
+ printf(" %s", pfield(NULL, 0));
+ pval((unsigned long long) psip->some_io_total, (unsigned long long) psic->some_io_total);
+
+ printf(" %s; %lu;", pfield(NULL, 0), psic->full_aio_10);
+ printf(" %s; %lu;", pfield(NULL, 0), psic->full_aio_60);
+ printf(" %s; %lu;", pfield(NULL, 0), psic->full_aio_300);
+ printf(" %s", pfield(NULL, 0));
+ pval((unsigned long long) psip->full_io_total, (unsigned long long) psic->full_io_total);
+ printf("\n");
+}
+
+/*
+ ***************************************************************************
+ * Display pressure-stall mem statistics in raw format.
+ *
+ * IN:
+ * @a Activity structure with statistics.
+ * @timestr Time for current statistics sample.
+ * @curr Index in array for current sample statistics.
+ ***************************************************************************
+ */
+__print_funct_t raw_print_psimem_stats(struct activity *a, char *timestr, int curr)
+{
+ struct stats_psi_mem
+ *psic = (struct stats_psi_mem *) a->buf[curr],
+ *psip = (struct stats_psi_mem *) a->buf[!curr];
+
+ printf("%s; %s; %lu;", timestr, pfield(a->hdr_line, FIRST), psic->some_amem_10);
+ printf(" %s; %lu;", pfield(NULL, 0), psic->some_amem_60);
+ printf(" %s; %lu;", pfield(NULL, 0), psic->some_amem_300);
+ printf(" %s", pfield(NULL, 0));
+ pval((unsigned long long) psip->some_mem_total, (unsigned long long) psic->some_mem_total);
+
+ printf(" %s; %lu;", pfield(NULL, 0), psic->full_amem_10);
+ printf(" %s; %lu;", pfield(NULL, 0), psic->full_amem_60);
+ printf(" %s; %lu;", pfield(NULL, 0), psic->full_amem_300);
+ printf(" %s", pfield(NULL, 0));
+ pval((unsigned long long) psip->full_mem_total, (unsigned long long) psic->full_mem_total);
+ printf("\n");
+}