From 3a5e751dc0ca7b62bc098dae5b761b719b85cafa Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Sun, 12 Apr 2020 11:22:04 +0200 Subject: [PATCH] sadf: RAW: Add PSI support Signed-off-by: Sebastien GODARD --- activity.c | 6 ++-- raw_stats.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++ raw_stats.h | 6 ++++ 3 files changed, 93 insertions(+), 3 deletions(-) diff --git a/activity.c b/activity.c index a09da59..d4e7097 100644 --- a/activity.c +++ b/activity.c @@ -1898,7 +1898,7 @@ struct activity psi_cpu_act = { //FIXME .f_xml_print = xml_print_psicpu_stats, //FIXME .f_json_print = json_print_psicpu_stats, //FIXME .f_svg_print = svg_print_psicpu_stats, -//FIXME .f_raw_print = raw_print_psicpu_stats, + .f_raw_print = raw_print_psicpu_stats, //FIXME .f_pcp_print = pcp_print_psicpu_stats, .f_count_new = NULL, .item_list = NULL, @@ -1944,7 +1944,7 @@ struct activity psi_io_act = { //FIXME .f_xml_print = xml_print_psiio_stats, //FIXME .f_json_print = json_print_psiio_stats, //FIXME .f_svg_print = svg_print_psiio_stats, -//FIXME .f_raw_print = raw_print_psiio_stats, + .f_raw_print = raw_print_psiio_stats, //FIXME .f_pcp_print = pcp_print_psiio_stats, .f_count_new = NULL, .item_list = NULL, @@ -1990,7 +1990,7 @@ struct activity psi_mem_act = { //FIXME .f_xml_print = xml_print_psimem_stats, //FIXME .f_json_print = json_print_psimem_stats, //FIXME .f_svg_print = svg_print_psimem_stats, -//FIXME .f_raw_print = raw_print_psimem_stats, + .f_raw_print = raw_print_psimem_stats, //FIXME .f_pcp_print = pcp_print_psimem_stats, .f_count_new = NULL, .item_list = NULL, diff --git a/raw_stats.c b/raw_stats.c index 6fff547..ec7586c 100644 --- a/raw_stats.c +++ b/raw_stats.c @@ -1664,3 +1664,87 @@ __print_funct_t raw_print_softnet_stats(struct activity *a, char *timestr, int c 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 + *spic = (struct stats_psi_cpu *) a->buf[curr], + *spip = (struct stats_psi_cpu *) a->buf[!curr]; + + printf("%s; %s; %lu;", timestr, pfield(a->hdr_line, FIRST), spic->some_acpu_10); + printf(" %s; %lu;", pfield(NULL, 0), spic->some_acpu_60); + printf(" %s; %lu;", pfield(NULL, 0), spic->some_acpu_300); + printf(" %s", pfield(NULL, 0)); + pval((unsigned long long) spip->some_cpu_total, (unsigned long long) spic->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 + *spic = (struct stats_psi_io *) a->buf[curr], + *spip = (struct stats_psi_io *) a->buf[!curr]; + + printf("%s; %s; %lu;", timestr, pfield(a->hdr_line, FIRST), spic->some_aio_10); + printf(" %s; %lu;", pfield(NULL, 0), spic->some_aio_60); + printf(" %s; %lu;", pfield(NULL, 0), spic->some_aio_300); + printf(" %s", pfield(NULL, 0)); + pval((unsigned long long) spip->some_io_total, (unsigned long long) spic->some_io_total); + + printf(" %s; %lu;", pfield(NULL, 0), spic->full_aio_10); + printf(" %s; %lu;", pfield(NULL, 0), spic->full_aio_60); + printf(" %s; %lu;", pfield(NULL, 0), spic->full_aio_300); + printf(" %s", pfield(NULL, 0)); + pval((unsigned long long) spip->full_io_total, (unsigned long long) spic->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 + *spic = (struct stats_psi_mem *) a->buf[curr], + *spip = (struct stats_psi_mem *) a->buf[!curr]; + + printf("%s; %s; %lu;", timestr, pfield(a->hdr_line, FIRST), spic->some_amem_10); + printf(" %s; %lu;", pfield(NULL, 0), spic->some_amem_60); + printf(" %s; %lu;", pfield(NULL, 0), spic->some_amem_300); + printf(" %s", pfield(NULL, 0)); + pval((unsigned long long) spip->some_mem_total, (unsigned long long) spic->some_mem_total); + + printf(" %s; %lu;", pfield(NULL, 0), spic->full_amem_10); + printf(" %s; %lu;", pfield(NULL, 0), spic->full_amem_60); + printf(" %s; %lu;", pfield(NULL, 0), spic->full_amem_300); + printf(" %s", pfield(NULL, 0)); + pval((unsigned long long) spip->full_mem_total, (unsigned long long) spic->full_mem_total); + printf("\n"); +} diff --git a/raw_stats.h b/raw_stats.h index a6520a7..7b49046 100644 --- a/raw_stats.h +++ b/raw_stats.h @@ -92,5 +92,11 @@ __print_funct_t raw_print_fchost_stats (struct activity *, char *, int); __print_funct_t raw_print_softnet_stats (struct activity *, char *, int); +__print_funct_t raw_print_psicpu_stats + (struct activity *, char *, int); +__print_funct_t raw_print_psiio_stats + (struct activity *, char *, int); +__print_funct_t raw_print_psimem_stats + (struct activity *, char *, int); #endif /* _RAW_STATS_H */ -- 2.40.0