From a1349585c8c33c4951782f25cb8ef6cd5985b429 Mon Sep 17 00:00:00 2001 From: Xavier Raynaud Date: Mon, 3 Jan 2011 09:09:56 +0000 Subject: fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=332269 --- .../linuxtools/gprof/view/fields/SampleProfField.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'gprof/org.eclipse.linuxtools.gprof') diff --git a/gprof/org.eclipse.linuxtools.gprof/src/org/eclipse/linuxtools/gprof/view/fields/SampleProfField.java b/gprof/org.eclipse.linuxtools.gprof/src/org/eclipse/linuxtools/gprof/view/fields/SampleProfField.java index 54ac658ecb..88485af66a 100644 --- a/gprof/org.eclipse.linuxtools.gprof/src/org/eclipse/linuxtools/gprof/view/fields/SampleProfField.java +++ b/gprof/org.eclipse.linuxtools.gprof/src/org/eclipse/linuxtools/gprof/view/fields/SampleProfField.java @@ -120,22 +120,33 @@ public class SampleProfField extends AbstractSTDataViewersField implements IChar { long timeInNs = (long) (i/prof_rate); long ns = timeInNs%1000; - long timeInUs = timeInNs/1000; if (timeInUs == 0) return ns + "ns"; long us = timeInUs%1000; long timeInMs = timeInUs/1000; - if (timeInMs == 0) return us + "." + ns + "us"; + if (timeInMs == 0) { + String ns_s = "" + ns; + while (ns_s.length() < 3) ns_s = "0" + ns_s; + return us + "." + ns_s + "us"; + } long ms = timeInMs%1000; long timeInS = timeInMs/1000; - if (timeInS == 0) return ms + "." + us + "ms"; + if (timeInS == 0) { + String us_s = "" + us; + while (us_s.length() < 3) us_s = "0" + us_s; + return ms + "." + us_s + "ms"; + } long s = timeInS%60; long timeInMin = timeInS/60; - if (timeInMin == 0) return s + "." + ms + "s"; + if (timeInMin == 0) { + String ms_s = "" + ms; + while (ms_s.length() < 3) ms_s = "0" + ms_s; + return s + "." + ms_s + "s"; + } long min = timeInMin%60; long timeInHour = timeInMin/60; -- cgit v1.2.3