public class ChromeTraceParser extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
ChromeTraceParser.ChromeTraceEventMatcher<T>
Extracts data of interest if it finds a Chrome trace event of the type it is looking for.
|
Modifier and Type | Field and Description |
---|---|
static ChromeTraceParser.ChromeTraceEventMatcher<String> |
COMMAND
Tries to extract the command that was used to trigger the invocation of Buck that generated the
trace.
|
Constructor and Description |
---|
ChromeTraceParser(ProjectFilesystem projectFilesystem) |
Modifier and Type | Method and Description |
---|---|
static <T> Optional<T> |
getResultForMatcher(ChromeTraceParser.ChromeTraceEventMatcher<T> matcher,
Map<ChromeTraceParser.ChromeTraceEventMatcher<?>,Object> results)
Designed for use with the result of
parse(Path, Set) . |
Map<ChromeTraceParser.ChromeTraceEventMatcher<?>,Object> |
parse(Path pathToTrace,
Set<ChromeTraceParser.ChromeTraceEventMatcher<?>> chromeTraceEventMatchers)
Parses a Chrome trace and stops parsing once all of the specified matchers have been satisfied.
|
public static final ChromeTraceParser.ChromeTraceEventMatcher<String> COMMAND
public ChromeTraceParser(ProjectFilesystem projectFilesystem)
public Map<ChromeTraceParser.ChromeTraceEventMatcher<?>,Object> parse(Path pathToTrace, Set<ChromeTraceParser.ChromeTraceEventMatcher<?>> chromeTraceEventMatchers) throws IOException
pathToTrace
- is a relative path [to the ProjectFilesystem] to a Chrome trace in the "JSON
Array Format."chromeTraceEventMatchers
- set of matchers this invocation of parse()
is trying to
satisfy. Once a matcher finds a match, it will not consider any other events in the trace.Map
where every matcher that found a match will have an entry whose key is
the matcher and whose value is the one returned by ChromeTraceParser.ChromeTraceEventMatcher.test(Map,
String)
without the Optional
wrapper.IOException
public static <T> Optional<T> getResultForMatcher(ChromeTraceParser.ChromeTraceEventMatcher<T> matcher, Map<ChromeTraceParser.ChromeTraceEventMatcher<?>,Object> results)
parse(Path, Set)
. Helper function
to avoid some distasteful casting logic.