diff options
author | Jon Bratseth <bratseth@verizonmedia.com> | 2020-03-19 22:29:07 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@verizonmedia.com> | 2020-03-19 22:29:07 +0100 |
commit | 35a2b7042a3dbbbbef81d7a9d703058e86148d19 (patch) | |
tree | 42c29709d15e730e9647afa9f938463c9aea4b84 /config-provisioning/src/main/java/com | |
parent | 7a662f9fcf6a1615d384ed84b3b468e3b4ba403e (diff) |
Output floats with 1 decimal in toString
Diffstat (limited to 'config-provisioning/src/main/java/com')
-rw-r--r-- | config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java index cd3d08b072a..6399352a6ec 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java @@ -191,10 +191,11 @@ public class NodeResources { @Override public String toString() { - return "[vcpu: " + vcpu + ", memory: " + memoryGb + " Gb, disk " + diskGb + " Gb" + - (bandwidthGbps > 0 ? ", bandwidth: " + bandwidthGbps + " Gbps" : "") + - ( ! diskSpeed.isDefault() ? ", disk speed: " + diskSpeed : "") + - ( ! storageType.isDefault() ? ", storage type: " + storageType : "") + "]"; + return String.format("[vcpu: %1$.1f, memory: %2$.1f Gb, disk %3$.1f Gb" + + (bandwidthGbps > 0 ? ", bandwidth: %4$.1f Gbps" : "") + + ( ! diskSpeed.isDefault() ? ", disk speed: " + diskSpeed : "") + + ( ! storageType.isDefault() ? ", storage type: " + storageType : "") + "]", + vcpu, memoryGb, diskGb, bandwidthGbps); } /** Returns true if all the resources of this are the same or larger than the given resources */ |