Commit 8e5c0b0f authored by boliu's avatar boliu Committed by Commit bot

android: Remove TraceEvent.begin()/end()

All callers have been moved to onens with explicit event names. Removing
the expensive dumping stack implemntation.

BUG=439118

Review URL: https://codereview.chromium.org/803603002

Cr-Commit-Position: refs/heads/master@{#308356}
parent 72e9ec89
......@@ -238,19 +238,6 @@ public class TraceEvent {
if (sEnabled) nativeFinishAsync(name, id);
}
/**
* Convenience wrapper around the versions of begin() that take string parameters.
* The name of the event will be derived from the class and function name that call this.
* IMPORTANT: if using this version, ensure end() (no parameters) is always called from the
* same calling context.
*
* Note that the overhead is at ms or sub-ms order. Don't use this when millisecond accuracy
* is desired.
*/
public static void begin() {
if (sEnabled) nativeBegin(getCallerName(), null);
}
/**
* Triggers the 'begin' native trace event with no arguments.
* @param name The name of the event.
......@@ -268,14 +255,6 @@ public class TraceEvent {
if (sEnabled) nativeBegin(name, arg);
}
/**
* Convenience wrapper around the versions of end() that take string parameters.
* @see #begin()
*/
public static void end() {
if (sEnabled) nativeEnd(getCallerName(), null);
}
/**
* Triggers the 'end' native trace event with no arguments.
* @param name The name of the event.
......@@ -293,21 +272,6 @@ public class TraceEvent {
if (sEnabled) nativeEnd(name, arg);
}
private static String getCallerName() {
// This was measured to take about 1ms on Trygon device.
StackTraceElement[] stack = java.lang.Thread.currentThread().getStackTrace();
// Commented out to avoid excess call overhead, but these lines can be useful to debug
// exactly where the TraceEvent's client is on the callstack.
// int index = 0;
// while (!stack[index].getClassName().equals(TraceEvent.class.getName())) ++index;
// while (stack[index].getClassName().equals(TraceEvent.class.getName())) ++index;
// System.logW("TraceEvent caller is at stack index " + index);
// '4' Was derived using the above commented out code snippet.
return stack[4].getClassName() + "." + stack[4].getMethodName();
}
private static native void nativeRegisterEnabledObserver();
private static native void nativeStartATrace();
private static native void nativeStopATrace();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment