Created @TraceEvent annotation and corresponding processor
When a method has the @TraceEvent annotation, it will be transformed to include
TraceEvent.begin() and TraceEvent.end() at the start and end of the method.
The function body is moved to a new helper method, while the old function's new
body looks like the following:
```
TraceEvent.begin("Foo.bar");
try {
wrappedByTraceEvent$bar();
TraceEvent.end("Foo.bar");
} catch (Throwable e) {
TraceEvent.end("Foo.bar");
throw e;
}
```
Used the following code to test building various methods:
```
@TraceEvent
public static void basic() {}
@TraceEvent
public void takesArguments(boolean arg1, long arg2, float arg3) {}
@TraceEvent
public int returnsPrimitive(int arg1, byte arg2, Object arg3, TraceEvent arg4) {
return 10;
}
@TraceEvent
public Object returnsObject(char arg1, short arg2, double arg3) {
return null;
}
@TraceEvent
public int throwsError() throws Exception {
throw new Exception();
}
```
Bug: 818267
Change-Id: I11127203662bf84de4a890da29a09676e760e621
Reviewed-on: https://chromium-review.googlesource.com/1066173
Commit-Queue: Tiger Oakes <tigero@google.com>
Reviewed-by:
Biao She <bshe@chromium.org>
Reviewed-by:
agrieve <agrieve@chromium.org>
Reviewed-by:
Eric Stevenson <estevenson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565624}
Showing
Please register or sign in to comment