From 1b176657dea3da2fc8b2c00bf6f0d8b25c92ee74 Mon Sep 17 00:00:00 2001 Message-Id: <1b176657dea3da2fc8b2c00bf6f0d8b25c92ee74.1587532692.git.kamalesh@linux.vnet.ibm.com> In-Reply-To: References: From: Kamalesh Babulal Date: Tue, 21 Apr 2020 08:09:12 -0500 Subject: [PATCH V4 11/14] lparstat: Move displaying system configuration details to new func To: powerpc-utils-devel@googlegroups.com Cc: Tyrel Datwyler , Nathan Lynch , Naveen N . Rao , Gautham R . Shenoy , Vasant Hegde System configuration details is required while displaying the scaled metrics too. Move it to a new function, to be called by both default, scaled metrics too. Signed-off-by: Kamalesh Babulal --- src/lparstat.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lparstat.c b/src/lparstat.c index 84a6544..3768b79 100644 --- a/src/lparstat.c +++ b/src/lparstat.c @@ -989,16 +989,13 @@ int print_iflag_data() return 0; } -void print_default_output(int interval, int count) +void print_system_configuration(void) { - char *fmt = "%5s %5s %5s %8s %8s %5s %5s %5s %5s %5s\n"; char *descr; char buf[128]; int offset, smt, active_proc; char type[32]; char value[32]; - char user[32], sys[32], wait[32], idle[32], physc[32], entc[32]; - char lbusy[32], app[32], vcsw[32], phint[32]; memset(buf, 0, 128); get_sysdata("shared_processor_mode", &descr, value); @@ -1031,6 +1028,16 @@ void print_default_output(int interval, int count) offset += sprintf(buf + offset, "ent=%s ", value); fprintf(stdout, "\nSystem Configuration\n%s\n\n", buf); +} + +void print_default_output(int interval, int count) +{ + char *fmt = "%5s %5s %5s %8s %8s %5s %5s %5s %5s %5s\n"; + char *descr; + char user[32], sys[32], wait[32], idle[32], physc[32], entc[32]; + char lbusy[32], app[32], vcsw[32], phint[32]; + + print_system_configuration(); fprintf(stdout, fmt, "\%user", "\%sys", "\%wait", "\%idle", "physc", "\%entc", "lbusy", "app", "vcsw", "phint"); -- 2.25.3