From 06a93628cbcac812e96061612cf4490d2dbb7f16 Mon Sep 17 00:00:00 2001 From: Matthew Khouzam Date: Wed, 27 Jan 2016 20:56:01 -0500 Subject: [PATCH] ctf: expose UTC offset in trace properties This shows the time of boot of the system wrt UTC for most CTF traces. Initial step towards fixing bug 484620 Change-Id: I62a934051f5d06c0e5c151743cbcc868f311e50f Signed-off-by: Matthew Khouzam Reviewed-on: https://git.eclipse.org/r/65229 Reviewed-by: Hudson CI Reviewed-by: Bernd Hufmann Tested-by: Bernd Hufmann --- .../tmf/ctf/core/tests/trace/CtfTmfTraceTest.java | 3 ++- .../tracecompass/tmf/ctf/core/trace/CtfTmfTrace.java | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/trace/CtfTmfTraceTest.java b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/trace/CtfTmfTraceTest.java index 16b6586013..78870e6e7a 100644 --- a/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/trace/CtfTmfTraceTest.java +++ b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/trace/CtfTmfTraceTest.java @@ -241,7 +241,8 @@ public class CtfTmfTraceTest { @Test public void testGetTraceProperties() { int result = fixture.getTraceProperties().size(); - assertEquals(9, result); + assertEquals(10, result); + assertEquals(String.valueOf(1332166405241713987L), fixture.getTraceProperties().get("clock_offset")); } /** diff --git a/ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/trace/CtfTmfTrace.java b/ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/trace/CtfTmfTrace.java index 878da4a2e2..2f6435cf3e 100644 --- a/ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/trace/CtfTmfTrace.java +++ b/ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/trace/CtfTmfTrace.java @@ -88,6 +88,12 @@ public class CtfTmfTrace extends TmfTrace // Constants // ------------------------------------------- + /** + * Clock offset property + * @since 2.0 + */ + public static final String CLOCK_OFFSET = "clock_offset"; //$NON-NLS-1$ + /** * Default cache size for CTF traces */ @@ -432,6 +438,7 @@ public class CtfTmfTrace extends TmfTrace public Map getTraceProperties() { Map properties = new HashMap<>(); properties.putAll(fTrace.getEnvironment()); + properties.put(CLOCK_OFFSET, Long.toUnsignedString(fTrace.getOffset())); properties.put(Messages.CtfTmfTrace_HostID, getHostId()); return properties; } -- 2.34.1