public abstract class AbstractConsoleEventBusListener extends Object implements BuckEventListener
BuckEventListener
s responsible for outputting information about the
running build to stderr
.Constructor and Description |
---|
AbstractConsoleEventBusListener(RenderingConsole console,
Clock clock,
Locale locale,
ExecutionEnvironment executionEnvironment,
boolean showTextInAllCaps,
int numberOfSlowRulesToShow,
boolean showSlowRulesInConsole,
com.google.common.collect.ImmutableSet<String> buildDetailsCommands) |
Modifier and Type | Method and Description |
---|---|
void |
actionGraphFinished(ActionGraphEvent.Finished finished) |
void |
actionGraphStarted(ActionGraphEvent.Started started) |
protected boolean |
addLineFromEventInterval(String prefix,
Optional<String> suffix,
long currentMillis,
EventInterval startAndFinish,
ProgressEstimation progress,
Optional<Long> minimum,
com.google.common.collect.ImmutableList.Builder<String> lines)
Adds a line about an
EventInterval to lines. |
protected boolean |
addLineFromEvents(String prefix,
Optional<String> suffix,
long currentMillis,
Collection<EventInterval> eventIntervals,
ProgressEstimation progress,
Optional<Long> minimum,
com.google.common.collect.ImmutableList.Builder<String> lines)
Adds a line about a set of start and finished events to lines.
|
static void |
aggregateFinishedEvent(ConcurrentHashMap<EventKey,EventInterval> map,
BuckEvent finished) |
static void |
aggregateStartedEvent(ConcurrentHashMap<EventKey,EventInterval> map,
BuckEvent started) |
void |
buildFinished(BuildEvent.Finished finished) |
void |
buildRuleFinished(BuildRuleEvent.Finished finished) |
void |
buildRuleResumed(BuildRuleEvent.Resumed resumed) |
void |
buildRuleStarted(BuildRuleEvent.Started started) |
void |
buildRuleSuspended(BuildRuleEvent.Suspended suspended) |
void |
buildStarted(BuildEvent.Started started) |
void |
close()
Cleanup, output any trace data collected to the backing store.
|
void |
commandFinished(CommandEvent.Finished event) |
void |
commandStartedEvent(CommandEvent.Started startedEvent) |
protected String |
convertToAllCapsIfNeeded(String str) |
boolean |
displaysEstimatedProgress() |
protected com.google.common.collect.ImmutableList<String> |
formatConsoleEvent(ConsoleEvent logEvent)
Formats a
ConsoleEvent and adds it to lines . |
protected String |
formatElapsedTime(long elapsedTimeMs) |
protected Optional<Double> |
getApproximateBuildProgress() |
static String |
getBuildDetailsLine(BuildId buildId,
String buildDetailsTemplate) |
static String |
getBuildLogLine(BuildId buildId) |
protected ProgressEstimation |
getEstimatedProgressOfCreatingActionGraph() |
protected Optional<Double> |
getEstimatedProgressOfGeneratingProjectFiles() |
protected ProgressEstimation |
getEstimatedProgressOfParsingBuckFiles() |
protected static Collection<EventInterval> |
getEventsBetween(long start,
long end,
Iterable<EventInterval> eventIntervals)
Filter a list of events and return the subset that fall between the given start and end
timestamps.
|
protected String |
getNetworkStatsLine(BuildEvent.Finished finishedEvent) |
protected Optional<String> |
getOptionalBuildLineSuffix() |
protected static long |
getTotalCompletedTimeFromEventIntervals(Collection<EventInterval> eventIntervals)
Get the summed elapsed time from all matched event pairs.
|
protected static long |
getWorkingTimeFromLastStartUntilNow(Collection<EventInterval> eventIntervals,
long currentMillis)
Deprecated.
|
void |
installFinished(InstallEvent.Finished finished) |
void |
installStarted(InstallEvent.Started started) |
protected long |
logEventInterval(String prefix,
Optional<String> suffix,
long currentMillis,
long offsetMs,
BuckEvent startEvent,
BuckEvent finishedEvent,
Optional<Double> progress,
Optional<Long> minimum,
com.google.common.collect.ImmutableList.Builder<String> lines)
Adds a line about a pair of start and finished events to lines.
|
protected long |
logEventInterval(String prefix,
Optional<String> suffix,
long currentMillis,
long offsetMs,
Collection<EventInterval> eventIntervals,
Optional<Double> progress,
Optional<Long> minimum,
com.google.common.collect.ImmutableList.Builder<String> lines)
Deprecated.
|
protected void |
logHttpCacheUploads(com.google.common.collect.ImmutableList.Builder<String> lines)
Adds a line about a the state of cache uploads to lines.
|
abstract void |
printSevereWarningDirectly(String line) |
void |
projectGenerationFinished(ProjectGenerationEvent.Finished finished) |
void |
projectGenerationProcessedTarget(ProjectGenerationEvent.Processed processed) |
void |
projectGenerationStarted(ProjectGenerationEvent.Started started) |
void |
register(BuckEventBus buildEventBus) |
protected String |
renderRemoteUploads()
A method to print the line responsible to show how our remote cache upload goes.
|
void |
ruleCountCalculated(BuildEvent.RuleCountCalculated calculated) |
void |
ruleCountUpdated(BuildEvent.UnskippedRuleCountUpdated updated) |
void |
setProgressEstimator(ProgressEstimator estimator) |
void |
setPublicAnnouncements(BuckEventBus eventBus,
Optional<String> announcements) |
void |
testRuleFinished(TestRuleEvent.Finished finished) |
void |
testRuleStarted(TestRuleEvent.Started started) |
void |
watchmanFinished(WatchmanStatusEvent.Finished finished) |
void |
watchmanStarted(WatchmanStatusEvent.Started started) |
protected static final long UNFINISHED_EVENT_PAIR
protected final RenderingConsole console
protected final Clock clock
protected final Verbosity verbosity
protected final Ansi ansi
@Nullable protected volatile ProjectGenerationEvent.Started projectGenerationStarted
@Nullable protected volatile ProjectGenerationEvent.Finished projectGenerationFinished
@Nullable protected volatile WatchmanStatusEvent.Started watchmanStarted
@Nullable protected volatile WatchmanStatusEvent.Finished watchmanFinished
protected ConcurrentLinkedDeque<ActionGraphEvent.Started> actionGraphStarted
protected ConcurrentLinkedDeque<ActionGraphEvent.Finished> actionGraphFinished
protected ConcurrentHashMap<EventKey,EventInterval> actionGraphEvents
@Nullable protected volatile BuildEvent.Started buildStarted
@Nullable protected volatile BuildEvent.Finished buildFinished
@Nullable protected volatile InstallEvent.Started installStarted
@Nullable protected volatile InstallEvent.Finished installFinished
@Nullable protected volatile CommandEvent.Finished commandFinished
protected volatile OptionalInt ruleCount
protected final AtomicInteger numRulesCompleted
protected Optional<ProgressEstimator> progressEstimator
protected final NetworkStatsTracker networkStatsTracker
protected final ParseStatsTracker parseStats
protected BuildRuleThreadTracker buildRuleThreadTracker
protected final com.google.common.collect.ImmutableSet<String> buildDetailsCommands
public AbstractConsoleEventBusListener(RenderingConsole console, Clock clock, Locale locale, ExecutionEnvironment executionEnvironment, boolean showTextInAllCaps, int numberOfSlowRulesToShow, boolean showSlowRulesInConsole, com.google.common.collect.ImmutableSet<String> buildDetailsCommands)
public void register(BuckEventBus buildEventBus)
public static String getBuildDetailsLine(BuildId buildId, String buildDetailsTemplate)
public boolean displaysEstimatedProgress()
public void setProgressEstimator(ProgressEstimator estimator)
protected String formatElapsedTime(long elapsedTimeMs)
protected Optional<Double> getEstimatedProgressOfGeneratingProjectFiles()
protected ProgressEstimation getEstimatedProgressOfParsingBuckFiles()
protected ProgressEstimation getEstimatedProgressOfCreatingActionGraph()
public void setPublicAnnouncements(BuckEventBus eventBus, Optional<String> announcements)
public abstract void printSevereWarningDirectly(String line)
protected static Collection<EventInterval> getEventsBetween(long start, long end, Iterable<EventInterval> eventIntervals)
com.facebook.buck.event.listener.ProxyBuckEvent
instances,
so that the resulting collection is strictly contained within the boundaries.start
- the start timestamp (inclusive)end
- the end timestamp (also inclusive)eventIntervals
- the events to filter.protected long logEventInterval(String prefix, Optional<String> suffix, long currentMillis, long offsetMs, @Nullable BuckEvent startEvent, @Nullable BuckEvent finishedEvent, Optional<Double> progress, Optional<Long> minimum, com.google.common.collect.ImmutableList.Builder<String> lines)
prefix
- Prefix to print for this event pair.suffix
- Suffix to print for this event pair.currentMillis
- The current time in milliseconds.offsetMs
- Offset to remove from calculated time. Set this to a non-zero value if the
event pair would contain another event. For example, build time includes parse time, but to
make the events easier to reason about it makes sense to pull parse time out of build time.startEvent
- The started event.finishedEvent
- The finished event.lines
- The builder to append lines to.UNFINISHED_EVENT_PAIR
.protected void logHttpCacheUploads(com.google.common.collect.ImmutableList.Builder<String> lines)
lines
- The builder to append lines to.protected boolean addLineFromEvents(String prefix, Optional<String> suffix, long currentMillis, Collection<EventInterval> eventIntervals, ProgressEstimation progress, Optional<Long> minimum, com.google.common.collect.ImmutableList.Builder<String> lines)
prefix
- Prefix to print for this event pair.suffix
- Suffix to print for this event pair.currentMillis
- The current time in milliseconds.eventIntervals
- the collection of start/end events to measure elapsed time.lines
- The builder to append lines to.protected boolean addLineFromEventInterval(String prefix, Optional<String> suffix, long currentMillis, EventInterval startAndFinish, ProgressEstimation progress, Optional<Long> minimum, com.google.common.collect.ImmutableList.Builder<String> lines)
EventInterval
to lines.prefix
- Prefix to print for this event pair.suffix
- Suffix to print for this event pair.currentMillis
- The current time in milliseconds.startAndFinish
- the event interval to measure elapsed time.lines
- The builder to append lines to.@Deprecated protected long logEventInterval(String prefix, Optional<String> suffix, long currentMillis, long offsetMs, Collection<EventInterval> eventIntervals, Optional<Double> progress, Optional<Long> minimum, com.google.common.collect.ImmutableList.Builder<String> lines)
prefix
- Prefix to print for this event pair.suffix
- Suffix to print for this event pair.currentMillis
- The current time in milliseconds.offsetMs
- Offset to remove from calculated time. Set this to a non-zero value if the
event pair would contain another event. For example, build time includes parse time, but to
make the events easier to reason about it makes sense to pull parse time out of build time.eventIntervals
- the collection of start/end events to sum up when calculating elapsed
time.lines
- The builder to append lines to.UNFINISHED_EVENT_PAIR
.@Deprecated protected static long getWorkingTimeFromLastStartUntilNow(Collection<EventInterval> eventIntervals, long currentMillis)
eventIntervals
- the collection of event starts/stops.currentMillis
- the current time.protected static long getTotalCompletedTimeFromEventIntervals(Collection<EventInterval> eventIntervals)
EventKey
.eventIntervals
- a set of paired events (incomplete events are okay).protected com.google.common.collect.ImmutableList<String> formatConsoleEvent(ConsoleEvent logEvent)
ConsoleEvent
and adds it to lines
.public void commandStartedEvent(CommandEvent.Started startedEvent)
public static void aggregateStartedEvent(ConcurrentHashMap<EventKey,EventInterval> map, BuckEvent started)
public static void aggregateFinishedEvent(ConcurrentHashMap<EventKey,EventInterval> map, BuckEvent finished)
public void projectGenerationStarted(ProjectGenerationEvent.Started started)
public void projectGenerationProcessedTarget(ProjectGenerationEvent.Processed processed)
public void projectGenerationFinished(ProjectGenerationEvent.Finished finished)
public void watchmanStarted(WatchmanStatusEvent.Started started)
public void watchmanFinished(WatchmanStatusEvent.Finished finished)
public void actionGraphStarted(ActionGraphEvent.Started started)
public void actionGraphFinished(ActionGraphEvent.Finished finished)
public void buildStarted(BuildEvent.Started started)
public void ruleCountCalculated(BuildEvent.RuleCountCalculated calculated)
public void ruleCountUpdated(BuildEvent.UnskippedRuleCountUpdated updated)
protected String getNetworkStatsLine(@Nullable BuildEvent.Finished finishedEvent)
public void buildRuleStarted(BuildRuleEvent.Started started)
public void buildRuleResumed(BuildRuleEvent.Resumed resumed)
public void buildRuleSuspended(BuildRuleEvent.Suspended suspended)
public void buildRuleFinished(BuildRuleEvent.Finished finished)
public void buildFinished(BuildEvent.Finished finished)
public void testRuleStarted(TestRuleEvent.Started started)
public void testRuleFinished(TestRuleEvent.Finished finished)
public void installStarted(InstallEvent.Started started)
public void installFinished(InstallEvent.Finished finished)
public void commandFinished(CommandEvent.Finished event)
protected String renderRemoteUploads()
public void close() throws IOException
BuckEventListener
close
in interface BuckEventListener
close
in interface Closeable
close
in interface AutoCloseable
IOException