timing: Use sub-second formatter for duration in table viewer
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Thu, 26 May 2016 19:11:37 +0000 (15:11 -0400)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Thu, 21 Jul 2016 12:35:57 +0000 (08:35 -0400)
A formatter makes the duration clearer, especially for large durations when
it's hard to figure the number of numbers in the string

Change-Id: I8b71ccc18c905809530df148d63881aced09c916
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/73802
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
analysis/org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests/src/org/eclipse/tracecompass/analysis/os/linux/ui/swtbot/tests/latency/SystemCallLatencyDensityViewTest.java
analysis/org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests/src/org/eclipse/tracecompass/analysis/os/linux/ui/swtbot/tests/latency/SystemCallLatencyTableAnalysisTest.java
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java

index bbaa540b16e9b1fc803aca9014fadc11cebe4fa4..76eaaf3594bc5e1a52510c2ce472638f7a62dd97 100644 (file)
@@ -184,11 +184,11 @@ public class SystemCallLatencyDensityViewTest {
         createDensityViewer();
         SWTBotUtils.waitForJobs();
         SWTBotTable tableBot = new SWTBotTable(fDensityViewer.getTableViewer().getTable());
-        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1600", 0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1,600", 0, 2));
         tableBot.header("Duration").click();
-        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1600", 0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1,600", 0, 2));
         tableBot.header("Duration").click();
-        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1001046400", 0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1,001,046,400", 0, 2));
         final Chart densityChart = fDensityChart;
         assertNotNull(densityChart);
         bot.waitUntil(ConditionHelpers.numberOfSeries(densityChart, 1));
index 9a0ab4c5c1ce08452422c7ff2c60af9888775d04..f952178b4d6bbd2c47b22bb9313337a876ee47f1 100644 (file)
@@ -232,7 +232,7 @@ public class SystemCallLatencyTableAnalysisTest {
         tableBot.header("Duration").click();
         bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2));
         tableBot.header("Duration").click();
-        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "999999", 0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "999,999", 0, 2));
     }
 
     /**
@@ -253,11 +253,11 @@ public class SystemCallLatencyTableAnalysisTest {
         fTable.updateModel(fixture);
         SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable());
         SWTBot bot = new SWTBot();
-        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "894633", 0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "894,633", 0, 2));
         tableBot.header("Duration").click();
         bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2));
         tableBot.header("Duration").click();
-        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "999999", 0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "999,999", 0, 2));
     }
 
     /**
@@ -278,11 +278,11 @@ public class SystemCallLatencyTableAnalysisTest {
         fTable.updateModel(fixture);
         SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable());
         SWTBot bot = new SWTBot();
-        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "400689", 0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "400,689", 0, 2));
         tableBot.header("Duration").click();
         bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2));
         tableBot.header("Duration").click();
-        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "998001", 0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "998,001", 0, 2));
     }
 
     /**
@@ -308,11 +308,11 @@ public class SystemCallLatencyTableAnalysisTest {
         createTable();
         SWTBotUtils.waitForJobs();
         SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable());
-        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "24100", 0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "24,100", 0, 2));
         tableBot.header("Duration").click();
-        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1000", 0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1,000", 0, 2));
         tableBot.header("Duration").click();
-        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "5904091700", 0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "5,904,091,700", 0, 2));
         bot.closeAllEditors();
         SWTBotUtils.deleteProject(PROJECT_NAME, bot);
     }
index 43693b5a6a3d69d7fd96ab930037b83323a3617f..1edb03a0aaf929ab0dfd983f017dce224f2c9087 100644 (file)
@@ -13,6 +13,9 @@
 
 package org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.table;
 
+import java.text.DecimalFormat;
+import java.text.Format;
+
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
@@ -59,6 +62,8 @@ import org.eclipse.tracecompass.tmf.ui.viewers.table.TmfSimpleTableViewer;
  */
 public abstract class AbstractSegmentStoreTableViewer extends TmfSimpleTableViewer {
 
+    private static final Format FORMATTER = new DecimalFormat("###,###.##");
+
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
@@ -174,7 +179,7 @@ public abstract class AbstractSegmentStoreTableViewer extends TmfSimpleTableView
         createColumn(Messages.SegmentStoreTableViewer_duration, new SegmentStoreTableColumnLabelProvider() {
             @Override
             public String getTextForSegment(ISegment input) {
-                return NonNullUtils.nullToEmptyString(Long.toString(input.getLength()));
+                return NonNullUtils.nullToEmptyString(FORMATTER.format(input.getLength()));
             }
         }, SegmentComparators.INTERVAL_LENGTH_COMPARATOR);
     }
This page took 0.027646 seconds and 5 git commands to generate.