public abstract class SimplePerfEvent extends AbstractBuckEvent
BuckEvent
s used for gathering performance statistics. These are only
intended to be used with the trace viewer and should not be used to communicate information
between parts of the system.Modifier and Type | Class and Description |
---|---|
static class |
SimplePerfEvent.Finished |
static class |
SimplePerfEvent.PerfEventId |
static interface |
SimplePerfEvent.Scope
Represents the scope within which a particular performance operation is taking place.
|
static interface |
SimplePerfEvent.Started |
static class |
SimplePerfEvent.Type |
BUILD_FINISHED, BUILD_REPORT, BUILD_STARTED, BUILD_STATUS_EVENT, CACHE_RATE_STATS_UPDATE_EVENT, INDIVIDUAL_TEST_AWAITING_RESULTS, INSTALL_STARTED, PARSE_FINISHED, PARSE_STARTED, PROJECT_GENERATION_FINISHED, PROJECT_GENERATION_STARTED, TEST_RUN_STARTED
Constructor and Description |
---|
SimplePerfEvent(EventKey eventKey) |
configure, equals, getBuildId, getEventKey, getNanoTime, getThreadId, getThreadUserNanoTime, getTimestampMillis, getValueString, hashCode, isConfigured, isRelatedTo, toLogMessage, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getEventName, storeLastInstanceAndReplayForNewClients
public SimplePerfEvent(EventKey eventKey)
public abstract SimplePerfEvent.PerfEventId getEventId()
public abstract SimplePerfEvent.Type getEventType()
public abstract com.google.common.collect.ImmutableMap<String,Object> getEventInfo()
public static SimplePerfEvent.Started started(SimplePerfEvent.PerfEventId perfEventId, com.google.common.collect.ImmutableMap<String,Object> info)
scope(BuckEventBus, PerfEventId, ImmutableMap)
when
possible.
Create an event that indicates the start of a particular operation.
perfEventId
- identifier of the operation (Upload, CacheFetch, Parse, etc..).info
- Any additional information to be saved with the event. This will be serialized and
potentially sent over the wire, so please keep this small.public static SimplePerfEvent.Started started(SimplePerfEvent.PerfEventId perfEventId)
started(PerfEventId, ImmutableMap)
.perfEventId
- identifier of the operation (Upload, CacheFetch, Parse, etc..).public static SimplePerfEvent.Started started(SimplePerfEvent.PerfEventId perfEventId, String k1, Object v1)
started(PerfEventId, ImmutableMap)
.perfEventId
- identifier of the operation (Upload, CacheFetch, Parse, etc..).k1
- name of the value to be stored with the event.v1
- value to be stored. This will be serialized and potentially sent over the wire, so
please keep this small.public static SimplePerfEvent.Started started(SimplePerfEvent.PerfEventId perfEventId, String k1, Object v1, String k2, Object v2)
started(PerfEventId, ImmutableMap)
.perfEventId
- identifier of the operation (Upload, CacheFetch, Parse, etc..).k1
- name of the value to be stored with the event.v1
- value to be stored. This will be serialized and potentially sent over the wire, so
please keep this small.k2
- name of the value to be stored with the event.v2
- value to be stored. This will be serialized and potentially sent over the wire, so
please keep this small.public static SimplePerfEvent.Scope scope(BuckEventBus bus, SimplePerfEvent.PerfEventId perfEventId, com.google.common.collect.ImmutableMap<String,Object> info)
try (perfEvent = SimplePerfEvent.scope(bus, PerfEventId.of("BurnCpu"))) { int bitsFlopped = 0; for (int i = 0; i < 1000; i++) { bitsFlopped += invokeExpensiveOp(); if (bitsFlopped % 100 == 0) { // Some of these events are of special interest. perfEvent.update("noFlopIteration", i); } } perfEvent.appendFinishedInfo("totalBitsFlopped", bitsFlopped); }
bus
- the BuckEventBus
to post update and finished events to.perfEventId
- identifier of the operation (Upload, CacheFetch, Parse, etc..).info
- Any additional information to be saved with the event. This will be serialized and
potentially sent over the wire, so please keep this small.public static SimplePerfEvent.Scope scope(BuckEventBus bus, SimplePerfEvent.PerfEventId perfEventId)
scope(BuckEventBus, PerfEventId, ImmutableMap)
.public static SimplePerfEvent.Scope scope(BuckEventBus bus, SimplePerfEvent.PerfEventId perfEventId, String k1, Object v1)
scope(BuckEventBus, PerfEventId, ImmutableMap)
.public static SimplePerfEvent.Scope scope(BuckEventBus bus, SimplePerfEvent.PerfEventId perfEventId, String k1, Object v1, String k2, Object v2)
scope(BuckEventBus, PerfEventId, ImmutableMap)
.public static SimplePerfEvent.Scope scope(Optional<BuckEventBus> bus, SimplePerfEvent.PerfEventId perfEventId, com.google.common.collect.ImmutableMap<String,Object> info)
scope(BuckEventBus, PerfEventId, ImmutableMap)
.public static SimplePerfEvent.Scope scope(Optional<BuckEventBus> bus, SimplePerfEvent.PerfEventId perfEventId)
scope(BuckEventBus, PerfEventId, ImmutableMap)
.public static SimplePerfEvent.Scope scope(Optional<BuckEventBus> bus, SimplePerfEvent.PerfEventId perfEventId, String k, Object v)
scope(BuckEventBus, PerfEventId, ImmutableMap)
.public static SimplePerfEvent.Scope scope(Optional<BuckEventBus> bus, SimplePerfEvent.PerfEventId perfEventId, String k, Object v, String k2, Object v2)
scope(BuckEventBus, PerfEventId, ImmutableMap)
.public static SimplePerfEvent.Scope scope(BuckEventBus bus, String perfEventName)
scope(BuckEventBus, PerfEventId, ImmutableMap)
.public static SimplePerfEvent.Scope scopeIgnoringShortEvents(BuckEventBus bus, SimplePerfEvent.PerfEventId perfEventId, com.google.common.collect.ImmutableMap<String,Object> info, SimplePerfEvent.Scope parentScope, long minimumTime, TimeUnit timeUnit)
scope(BuckEventBus, PerfEventId, ImmutableMap)
, but doesn't post
the events if the duration of the scope is below a certain threshold. NOTE: The events are
buffered before being posted. The longer they are buffered, the more likely any logging code
will be confused. Ideally the threshold should not exceed 100ms.bus
- the BuckEventBus
to post update and finished events to.perfEventId
- identifier of the operation (Upload, CacheFetch, Parse, etc..).info
- Any additional information to be saved with the event. This will be serialized and
potentially sent over the wire, so please keep this small.minimumTime
- the scope must take at least this long for the event to be posted.timeUnit
- time unit for minimumTime.public static SimplePerfEvent.Scope scopeIgnoringShortEvents(BuckEventBus bus, SimplePerfEvent.PerfEventId perfEventId, SimplePerfEvent.Scope parentScope, long minimumTime, TimeUnit timeUnit)
scope(BuckEventBus, PerfEventId, ImmutableMap)
.public static SimplePerfEvent.Scope scopeIgnoringShortEvents(BuckEventBus bus, SimplePerfEvent.PerfEventId perfEventId, String k1, Object v1, SimplePerfEvent.Scope parentScope, long minimumTime, TimeUnit timeUnit)
scope(BuckEventBus, PerfEventId, ImmutableMap)
.public static SimplePerfEvent.Scope scopeIgnoringShortEvents(BuckEventBus bus, SimplePerfEvent.PerfEventId perfEventId, String k1, Object v1, String k2, Object v2, SimplePerfEvent.Scope parentScope, long minimumTime, TimeUnit timeUnit)
scope(BuckEventBus, PerfEventId, ImmutableMap)
.