Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a2489cf authored by Ben Murdoch's avatar Ben Murdoch
Browse files

Add a hidden API to set trace tag on atrace counters.

Currently the only counter API on trace uses the APP tag. Add a new
(hidden) API that will allow the system to set counters with different
tags.

Bug: 358369221
Flag: EXEMPT - adding hidden API only with no usage yet
Test: Try to add a counter with TRACE_TAG_WINDOW_MANAGER and check trace
Change-Id: I874d60998a26b7a80ac93b0a5e70ffddcaa9197c
parent a9910754
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -520,8 +520,20 @@ public final class Trace {
     * @param counterValue The counter value.
     */
    public static void setCounter(@NonNull String counterName, long counterValue) {
        if (isTagEnabled(TRACE_TAG_APP)) {
            nativeTraceCounter(TRACE_TAG_APP, counterName, counterValue);
        setCounter(TRACE_TAG_APP, counterName, counterValue);
    }

    /**
     * Writes trace message to indicate the value of a given counter under a given trace tag.
     *
     * @param traceTag The trace tag.
     * @param counterName The counter name to appear in the trace.
     * @param counterValue The counter value.
     * @hide
     */
    public static void setCounter(long traceTag, @NonNull String counterName, long counterValue) {
        if (isTagEnabled(traceTag)) {
            nativeTraceCounter(traceTag, counterName, counterValue);
        }
    }