Skip to content

Commit

Permalink
sadf: PSI: Change metrics names and make them percent values
Browse files Browse the repository at this point in the history
Change PSI metrics names (e.g. s_acpu10 -> %scpu-10) to make clear that
they are percent values.
Also change metrics using the total number of microseconds spent stalled
on ressources to also be a percent value calculated over the past time
interval (e.g. s_tcpu/s -> %scpu).

Signed-off-by: Sebastien GODARD <[email protected]>
  • Loading branch information
sysstat committed Apr 18, 2020
1 parent e7b9cfa commit 47d0238
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 161 deletions.
6 changes: 3 additions & 3 deletions activity.c
Original file line number Diff line number Diff line change
Expand Up @@ -1889,7 +1889,7 @@ struct activity psi_cpu_act = {
.f_print_avg = print_avg_psicpu_stats,
#endif
#if defined(SOURCE_SAR) || defined(SOURCE_SADF)
.hdr_line = "s_acpu10;s_acpu60;s_acpu300;s_tcpu/s",
.hdr_line = "%scpu-10;%scpu-60;%scpu-300;%scpu",
#endif
.gtypes_nr = {STATS_PSI_CPU_ULL, STATS_PSI_CPU_UL, STATS_PSI_CPU_U},
.ftypes_nr = {0, 0, 0},
Expand Down Expand Up @@ -1935,7 +1935,7 @@ struct activity psi_io_act = {
.f_print_avg = print_avg_psiio_stats,
#endif
#if defined(SOURCE_SAR) || defined(SOURCE_SADF)
.hdr_line = "s_aio10;s_aio60;s_aio300;s_tio/s;f_aio10;f_aio60;f_aio300;f_tio/s",
.hdr_line = "%sio-10;%sio-60;%sio-300;%sio;%fio-10;%fio-60;%fio-300;%fio",
#endif
.gtypes_nr = {STATS_PSI_IO_ULL, STATS_PSI_IO_UL, STATS_PSI_IO_U},
.ftypes_nr = {0, 0, 0},
Expand Down Expand Up @@ -1981,7 +1981,7 @@ struct activity psi_mem_act = {
.f_print_avg = print_avg_psimem_stats,
#endif
#if defined(SOURCE_SAR) || defined(SOURCE_SADF)
.hdr_line = "s_amem10;s_amem60;s_amem300;s_tmem/s;f_amem10;f_amem60;f_amem300;f_tmem/s",
.hdr_line = "%smem-10;%smem-60;%smem-300;%smem;%fmem-10;%fmem-60;%fmem-300;%fmem",
#endif
.gtypes_nr = {STATS_PSI_MEM_ULL, STATS_PSI_MEM_UL, STATS_PSI_MEM_U},
.ftypes_nr = {0, 0, 0},
Expand Down
20 changes: 10 additions & 10 deletions json_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -2466,11 +2466,11 @@ __print_funct_t json_print_psicpu_stats(struct activity *a, int curr, int tab,
"\"some_avg10\": %.2f, "
"\"some_avg60\": %.2f, "
"\"some_avg300\": %.2f, "
"\"some_total\": %.2f}",
"\"some_avg\": %.2f}",
(double) psic->some_acpu_10 / 100,
(double) psic->some_acpu_60 / 100,
(double) psic->some_acpu_300 / 100,
S_VALUE(psip->some_cpu_total, psic->some_cpu_total, itv));
((double) psic->some_cpu_total - psip->some_cpu_total) / (100 * itv));
tab--;

close_json_markup:
Expand Down Expand Up @@ -2507,19 +2507,19 @@ __print_funct_t json_print_psiio_stats(struct activity *a, int curr, int tab,
"\"some_avg10\": %.2f, "
"\"some_avg60\": %.2f, "
"\"some_avg300\": %.2f, "
"\"some_total\": %.2f, "
"\"some_avg\": %.2f, "
"\"full_avg10\": %.2f, "
"\"full_avg60\": %.2f, "
"\"full_avg300\": %.2f, "
"\"full_total\": %.2f}",
"\"full_avg\": %.2f}",
(double) psic->some_aio_10 / 100,
(double) psic->some_aio_60 / 100,
(double) psic->some_aio_300 / 100,
S_VALUE(psip->some_io_total, psic->some_io_total, itv),
((double) psic->some_io_total - psip->some_io_total) / (100 * itv),
(double) psic->full_aio_10 / 100,
(double) psic->full_aio_60 / 100,
(double) psic->full_aio_300 / 100,
S_VALUE(psip->full_io_total, psic->full_io_total, itv));
((double) psic->full_io_total - psip->full_io_total) / (100 * itv));
tab--;

close_json_markup:
Expand Down Expand Up @@ -2556,19 +2556,19 @@ __print_funct_t json_print_psimem_stats(struct activity *a, int curr, int tab,
"\"some_avg10\": %.2f, "
"\"some_avg60\": %.2f, "
"\"some_avg300\": %.2f, "
"\"some_total\": %.2f, "
"\"some_avg\": %.2f, "
"\"full_avg10\": %.2f, "
"\"full_avg60\": %.2f, "
"\"full_avg300\": %.2f, "
"\"full_total\": %.2f}",
"\"full_avg\": %.2f}",
(double) psic->some_amem_10 / 100,
(double) psic->some_amem_60 / 100,
(double) psic->some_amem_300 / 100,
S_VALUE(psip->some_mem_total, psic->some_mem_total, itv),
((double) psic->some_mem_total - psip->some_mem_total) / (100 * itv),
(double) psic->full_amem_10 / 100,
(double) psic->full_amem_60 / 100,
(double) psic->full_amem_300 / 100,
S_VALUE(psip->full_mem_total, psic->full_mem_total, itv));
((double) psic->full_mem_total - psip->full_mem_total) / (100 * itv));
tab--;

close_json_markup:
Expand Down
20 changes: 10 additions & 10 deletions pcp_def_metrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -1785,45 +1785,45 @@ void pcp_def_psi_metrics(struct activity *a)
PM_IN_NULL, PM_TYPE_FLOAT, indom, PM_SEM_INSTANT,
pmiUnits(0, 0, 0, 0, 0, 0));

pmiAddMetric("psi.cpu.some.total",
pmiAddMetric("psi.cpu.some.avg",
PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
pmiUnits(0, 0, 0, 0, 0, 0));
}
else if (a->id == A_PSI_IO) {
/* Create metrics for A_PSI_IO */
pmiAddMetric("psi.io.some.trends",
PM_IN_NULL, PM_TYPE_FLOAT, indom, PM_SEM_INSTANT,
pmiUnits(0, 0, 0, 0, 0, 0));

pmiAddMetric("psi.io.some.total",
pmiAddMetric("psi.io.some.avg",
PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
pmiUnits(0, 0, 0, 0, 0, 0));

pmiAddMetric("psi.io.full.trends",
PM_IN_NULL, PM_TYPE_FLOAT, indom, PM_SEM_INSTANT,
pmiUnits(0, 0, 0, 0, 0, 0));

pmiAddMetric("psi.io.full.total",
pmiAddMetric("psi.io.full.avg",
PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
pmiUnits(0, 0, 0, 0, 0, 0));
}
else {
/* Create metrics for A_PSI_MEM */
pmiAddMetric("psi.mem.some.trends",
PM_IN_NULL, PM_TYPE_FLOAT, indom, PM_SEM_INSTANT,
pmiUnits(0, 0, 0, 0, 0, 0));

pmiAddMetric("psi.mem.some.total",
pmiAddMetric("psi.mem.some.avg",
PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
pmiUnits(0, 0, 0, 0, 0, 0));

pmiAddMetric("psi.mem.full.trends",
PM_IN_NULL, PM_TYPE_FLOAT, indom, PM_SEM_INSTANT,
pmiUnits(0, 0, 0, 0, 0, 0));

pmiAddMetric("psi.mem.full.total",
pmiAddMetric("psi.mem.full.avg",
PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
pmiUnits(0, 0, 0, 0, 0, 0));
}
#endif /* HAVE_PCP */
}
20 changes: 10 additions & 10 deletions pcp_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -2273,8 +2273,8 @@ __print_funct_t pcp_print_psicpu_stats(struct activity *a, int curr, unsigned lo
pmiPutValue("psi.cpu.some.trends", "300 sec", buf);

snprintf(buf, sizeof(buf), "%f",
S_VALUE(psip->some_cpu_total, psic->some_cpu_total, itv));
pmiPutValue("psi.cpu.some.total", NULL, buf);
((double) psic->some_cpu_total - psip->some_cpu_total) / (100 * itv));
pmiPutValue("psi.cpu.some.avg", NULL, buf);
#endif /* HAVE_PCP */
}

Expand Down Expand Up @@ -2308,8 +2308,8 @@ __print_funct_t pcp_print_psiio_stats(struct activity *a, int curr, unsigned lon
pmiPutValue("psi.io.some.trends", "300 sec", buf);

snprintf(buf, sizeof(buf), "%f",
S_VALUE(psip->some_io_total, psic->some_io_total, itv));
pmiPutValue("psi.io.some.total", NULL, buf);
((double) psic->some_io_total - psip->some_io_total) / (100 * itv));
pmiPutValue("psi.io.some.avg", NULL, buf);

snprintf(buf, sizeof(buf), "%f", (double) psic->full_aio_10 / 100);
pmiPutValue("psi.io.full.trends", "10 sec", buf);
Expand All @@ -2321,8 +2321,8 @@ __print_funct_t pcp_print_psiio_stats(struct activity *a, int curr, unsigned lon
pmiPutValue("psi.io.full.trends", "300 sec", buf);

snprintf(buf, sizeof(buf), "%f",
S_VALUE(psip->full_io_total, psic->full_io_total, itv));
pmiPutValue("psi.io.full.total", NULL, buf);
((double) psic->full_io_total - psip->full_io_total) / (100 * itv));
pmiPutValue("psi.io.full.avg", NULL, buf);
#endif /* HAVE_PCP */
}

Expand Down Expand Up @@ -2356,8 +2356,8 @@ __print_funct_t pcp_print_psimem_stats(struct activity *a, int curr, unsigned lo
pmiPutValue("psi.mem.some.trends", "300 sec", buf);

snprintf(buf, sizeof(buf), "%f",
S_VALUE(psip->some_mem_total, psic->some_mem_total, itv));
pmiPutValue("psi.mem.some.total", NULL, buf);
((double) psic->some_mem_total - psip->some_mem_total) / (100 * itv));
pmiPutValue("psi.mem.some.avg", NULL, buf);

snprintf(buf, sizeof(buf), "%f", (double) psic->full_amem_10 / 100);
pmiPutValue("psi.mem.full.trends", "10 sec", buf);
Expand All @@ -2369,7 +2369,7 @@ __print_funct_t pcp_print_psimem_stats(struct activity *a, int curr, unsigned lo
pmiPutValue("psi.mem.full.trends", "300 sec", buf);

snprintf(buf, sizeof(buf), "%f",
S_VALUE(psip->full_mem_total, psic->full_mem_total, itv));
pmiPutValue("psi.mem.full.total", NULL, buf);
((double) psic->full_mem_total - psip->full_mem_total) / (100 * itv));
pmiPutValue("psi.mem.full.avg", NULL, buf);
#endif /* HAVE_PCP */
}
20 changes: 10 additions & 10 deletions pr_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -3074,8 +3074,8 @@ void stub_print_psicpu_stats(struct activity *a, int prev, int curr, int dispavg
s_avg10 = s_avg60 = s_avg300 = 0;
}

cprintf_f(NO_UNIT, 1, 9, 2,
S_VALUE(psip->some_cpu_total, psic->some_cpu_total, itv));
cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
((double) psic->some_cpu_total - psip->some_cpu_total) / (100 * itv));
printf("\n");
}

Expand Down Expand Up @@ -3169,8 +3169,8 @@ void stub_print_psiio_stats(struct activity *a, int prev, int curr, int dispavg,
s_avg10 = s_avg60 = s_avg300 = 0;
}

cprintf_f(NO_UNIT, 1, 9, 2,
S_VALUE(psip->some_io_total, psic->some_io_total, itv));
cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
((double) psic->some_io_total - psip->some_io_total) / (100 * itv));

if (!dispavg) {
/* Display instantaneous "full" values */
Expand All @@ -3195,8 +3195,8 @@ void stub_print_psiio_stats(struct activity *a, int prev, int curr, int dispavg,
f_avg10 = f_avg60 = f_avg300 = 0;
}

cprintf_f(NO_UNIT, 1, 9, 2,
S_VALUE(psip->full_io_total, psic->full_io_total, itv));
cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
((double) psic->full_io_total - psip->full_io_total) / (100 * itv));
printf("\n");
}

Expand Down Expand Up @@ -3290,8 +3290,8 @@ void stub_print_psimem_stats(struct activity *a, int prev, int curr, int dispavg
s_avg10 = s_avg60 = s_avg300 = 0;
}

cprintf_f(NO_UNIT, 1, 9, 2,
S_VALUE(psip->some_mem_total, psic->some_mem_total, itv));
cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
((double) psic->some_mem_total - psip->some_mem_total) / (100 * itv));

if (!dispavg) {
/* Display instantaneous "full" values */
Expand All @@ -3316,8 +3316,8 @@ void stub_print_psimem_stats(struct activity *a, int prev, int curr, int dispavg
f_avg10 = f_avg60 = f_avg300 = 0;
}

cprintf_f(NO_UNIT, 1, 9, 2,
S_VALUE(psip->full_mem_total, psic->full_mem_total, itv));
cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
((double) psic->full_mem_total - psip->full_mem_total) / (100 * itv));
printf("\n");
}

Expand Down

0 comments on commit 47d0238

Please sign in to comment.