From: Sebastien GODARD Date: Sat, 29 Jan 2022 14:26:50 +0000 (+0100) Subject: A_IRQ: Update sadf PPC/DB output report X-Git-Tag: v12.5.6~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3b0f4cb061d481a4b1d86892e1da78876e31e43e;p=sysstat A_IRQ: Update sadf PPC/DB output report Signed-off-by: Sebastien GODARD --- diff --git a/rndr_stats.c b/rndr_stats.c index fded6b0..1da2fd3 100644 --- a/rndr_stats.c +++ b/rndr_stats.c @@ -145,7 +145,7 @@ static void render(int isdb, char *pre, int rflags, const char *pptxt, else if (rflags & PT_USERND) { printf("%s%.0f", seps[isdb], dval); } - else { + else if (rflags & PT_NOFLAG) { printf("%s%.2f", seps[isdb], dval); } if (newline) { @@ -517,36 +517,77 @@ __print_funct_t render_pcsw_stats(struct activity *a, int isdb, char *pre, __print_funct_t render_irq_stats(struct activity *a, int isdb, char *pre, int curr, unsigned long long itv) { - int i; - struct stats_irq *sic, *sip; - int pt_newlin - = (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN); + int i, c, first; + struct stats_irq *stc_cpu_irq, *stp_cpu_irq, *stc_cpuall_irq; + unsigned char masked_cpu_bitmap[BITMAP_SIZE(NR_CPUS)] = {0}; + char cpu_name[32], ppc_txt[512]; - for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) { + /* @nr[curr] cannot normally be greater than @nr_ini */ + if (a->nr[curr] > a->nr_ini) { + a->nr_ini = a->nr[curr]; + } + + /* Identify offline and unselected CPU, and keep persistent statistics values */ + get_global_int_statistics(a, !curr, curr, flags, masked_cpu_bitmap); - sic = (struct stats_irq *) ((char *) a->buf[curr] + i * a->msize); - sip = (struct stats_irq *) ((char *) a->buf[!curr] + i * a->msize); + for (i = 0; i < a->nr2; i++) { - /* Should current interrupt (including int "sum") be displayed? */ - if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) { + stc_cpuall_irq = (struct stats_irq *) ((char *) a->buf[curr] + i * a->msize); + + if (a->item_list != NULL) { + /* A list of devices has been entered on the command line */ + if (!search_list_item(a->item_list, stc_cpuall_irq->irq_name)) + /* Device not found */ + continue; + } + + first = TRUE; + for (c = 0; (c < a->nr[curr]) && (c < a->bitmap->b_size + 1); c++) { + + stc_cpu_irq = (struct stats_irq *) ((char *) a->buf[curr] + c * a->msize * a->nr2 + + i * a->msize); + stp_cpu_irq = (struct stats_irq *) ((char *) a->buf[!curr] + c * a->msize * a->nr2 + + i * a->msize); + + /* Should current CPU (including CPU "all") be displayed? */ + if (masked_cpu_bitmap[c >> 3] & (1 << (c & 0x07))) + /* No */ + continue; /* Yes: Display it */ - if (!i) { - /* This is interrupt "sum" */ - render(isdb, pre, pt_newlin, - "sum\tintr/s", "-1", NULL, + if (!c) { + strcpy(cpu_name, "all"); + } + else { + snprintf(cpu_name, sizeof(cpu_name), "CPU%d", c - 1); + cpu_name[sizeof(cpu_name) - 1] = '\0'; + } + snprintf(ppc_txt, sizeof(ppc_txt), "%s\t%s", stc_cpuall_irq->irq_name, cpu_name); + ppc_txt[sizeof(ppc_txt) - 1] = '\0'; + + if (first) { + render(isdb, pre, PT_NOFLAG, + "%s", "%s", + isdb ? cons(sv, stc_cpuall_irq->irq_name, NULL) + : cons(sv, ppc_txt, NULL), NOVAL, - S_VALUE(sip->irq_nr, sic->irq_nr, itv), + S_VALUE(stp_cpu_irq->irq_nr, stc_cpu_irq->irq_nr, itv), NULL); + first = FALSE; } else { - render(isdb, pre, pt_newlin, - "i%03d\tintr/s", "%d", cons(iv, i - 1, NOVAL), + render(isdb, pre, PT_NOFLAG, + "%s", NULL, + cons(sv, ppc_txt, NULL), NOVAL, - S_VALUE(sip->irq_nr, sic->irq_nr, itv), + S_VALUE(stp_cpu_irq->irq_nr, stc_cpu_irq->irq_nr, itv), NULL); } } + if (isdb && !DISPLAY_HORIZONTALLY(flags)) { + /* Print a newline chr and make sure that @pre text will be printed next time */ + render(isdb, pre, PT_NEWLIN, NULL, NULL, NULL, NOVAL, NOVAL, NULL); + } } } diff --git a/rndr_stats.h b/rndr_stats.h index 68d5750..dae420e 100644 --- a/rndr_stats.h +++ b/rndr_stats.h @@ -14,11 +14,11 @@ *************************************************************************** */ -#define PT_NOFLAG 0x0000 /* Prevent undescribed '0' in render calls */ #define PT_USEINT 0x0001 /* Use the integer arg, not double nor string */ #define PT_NEWLIN 0x0002 /* Terminate the current output line */ #define PT_USESTR 0x0004 /* Use the string arg */ #define PT_USERND 0x0008 /* Double value, format %.0f */ +#define PT_NOFLAG 0x0010 /* Prevent undescribed '0' in render calls */ #define NOVAL 0 /* For placeholder zeros */ #define DNOVAL 0.0 /* Wilma! */