Skip to content

Commit

Permalink
Expose the clock and frequency in CtfTmfTrace
Browse files Browse the repository at this point in the history
The frequency of the CtfTmfTrace is currently exposed in an indirect way using cyclesToNanos(). BUt sometimes there is the need to get direct frequency.

[Added] public method to get clock info in CTFTmfTrace
[Added] public method to get frequency to get CTFClock

Signed-off-by: Siwei Zhang <[email protected]>
  • Loading branch information
Siwei Zhang committed Sep 23, 2024
1 parent 945b92e commit 633fa1c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,10 @@ public boolean isClockScaled() {
return fIsScaled;
}

/**
* @return the frequency in Hz
*/
public long getFrequency() {
return ((Long) getProperty(FREQ));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,20 @@ public Map<String, String> getEnvironment() {
return trace.getEnvironment();
}

/**
* Get the CTF clock defined in this CTF trace, in <name, value>
* form. This comes from the trace's CTF metadata.
*
* @return The CTF environment
*/
public CTFClock getClock() {
CTFTrace trace = fTrace;
if (trace == null) {
return null;
}
return trace.getClock();
}

/**
* @since 3.0
*/
Expand Down

0 comments on commit 633fa1c

Please sign in to comment.