Blob Blame History Raw
commit bc928b06605371b72c7fe8ec7e81886114a9e9d4
Author: Sourabh Jain <sourabhjain@linux.ibm.com>
Date:   Thu Jan 31 14:25:21 2019 +0530

    lparstat: restrict the physc and entc attribute values to two decimal places
    
    Print format of physical processors consumed (physc) and percentage of
    the entitled capacity consumed (entc) attributes has changed from six
    decimal places to two.
    
    The least possible value allowed for processor entitlement to a LPAR
    is 0.05 so printing physc and entc values with such a high precision
    is incorrect.
    
    Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
    Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
    Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>

diff --git a/src/lparstat.c b/src/lparstat.c
index ec57c1a..c9b86fd 100644
--- a/src/lparstat.c
+++ b/src/lparstat.c
@@ -176,7 +176,7 @@ void get_cpu_physc(struct sysentry *unused_se, char *buf)
 		physc = (new_purr - old_purr)/timebase/elapsed;
 	}
 
-	sprintf(buf, "%.6f", physc);
+	sprintf(buf, "%.2f", physc);
 }
 
 void get_per_entc(struct sysentry *unused_se, char *buf)
@@ -188,7 +188,7 @@ void get_per_entc(struct sysentry *unused_se, char *buf)
 	get_sysdata("DesEntCap", &descr, entc);
 	get_sysdata("physc", &descr, physc);
 
-	sprintf(buf, "%.6f", atof(physc) / atof(entc) * 100.0);
+	sprintf(buf, "%.2f", atof(physc) / atof(entc) * 100.0);
 }
 
 void get_cpu_app(struct sysentry *unused_se, char *buf)