diff --git a/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/CTFClock.java b/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/CTFClock.java index cf58d0bcc6..3b354e2ec8 100644 --- a/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/CTFClock.java +++ b/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/CTFClock.java @@ -159,4 +159,10 @@ public boolean isClockScaled() { return fIsScaled; } + /** + * @return the frequency in Hz + */ + public long getFrequency() { + return ((Long) getProperty(FREQ)); + } } diff --git a/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTrace.java b/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTrace.java index a3282f1dde..6bfd422bc2 100644 --- a/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTrace.java +++ b/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTrace.java @@ -832,6 +832,18 @@ public final long getOffset() { return fSingleClock.getClockOffset(); } + /** + * Gets the frequency + * + * @return the frequency + */ + public final long getFrequency() { + if (getClock() == null) { + return 0; + } + return fSingleClock.getFrequency(); + } + /** * Gets the time scale in nanoseconds/cycle * 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 d34aebde0d..d4f2dedf5f 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 @@ -115,6 +115,7 @@ public class CtfTmfTrace extends TmfTrace * @since 1.2 */ public static final String CLOCK_OFFSET = "clock_offset"; //$NON-NLS-1$ + public static final String CLOCK_FREQUENCY = "frequency"; //$NON-NLS-1$ /** * Default cache size for CTF traces @@ -585,6 +586,7 @@ public Map getProperties() { } properties.putAll(trace.getEnvironment()); properties.put(CLOCK_OFFSET, Long.toUnsignedString(trace.getOffset())); + properties.put(CLOCK_FREQUENCY, Long.toUnsignedString(trace.getFrequency())); properties.put(Messages.CtfTmfTrace_HostID, getHostId()); return properties; }