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. This commit added public
methods to get the direct frequency.

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

Signed-off-by: Siwei Zhang <[email protected]>
  • Loading branch information
Siwei Zhang committed Sep 23, 2024
1 parent 945b92e commit b6ada56
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 b6ada56

Please sign in to comment.