@@ -0,0 +1,3137 @@
+/*%0A * Copyright 2013-present Facebook, Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A * not use this file except in compliance with the License. You may obtain%0A * a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT%0A * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the%0A * License for the specific language governing permissions and limitations%0A * under the License.%0A */%0Apackage com.facebook.buck.event;%0A%0Aimport com.facebook.buck.timing.Clock;%0Aimport com.facebook.buck.util.Scope;%0Aimport com.google.common.base.Supplier;%0A%0A/** Event Class containing the perf data regarding action graph building */%0Apublic class ActionGraphPerfStatEvent extends AbstractBuckEvent %7B%0A%0A  private static final String EVENT_NAME = %22ActionGraphPerfStats%22;%0A%0A  private final Long elapsedTime;%0A  private final int numberNodesGenerated;%0A  private final String targetNodeDescriptionName;%0A  private final String buildTargetName;%0A%0A  private ActionGraphPerfStatEvent(%0A      Long time, int generatedNodesCount, String descriptionName, String buildName) %7B%0A    super(EventKey.unique());%0A    elapsedTime = time;%0A    numberNodesGenerated = generatedNodesCount;%0A    targetNodeDescriptionName = descriptionName;%0A    buildTargetName = buildName;%0A  %7D%0A%0A  /**%0A   * Creates a Scope for the timing event%0A   *%0A   * @param clock%0A   * @param eventBus%0A   * @param getRuleSize%0A   * @param descriptionName%0A   * @param buildTargetName%0A   * @return%0A   */%0A  public static Scope start(%0A      Clock clock,%0A      BuckEventBus eventBus,%0A      Supplier%3CInteger%3E getRuleSize,%0A      String descriptionName,%0A      String buildTargetName) %7B%0A    ActionGraphPerfStatEvent.Start start = new Start(clock);%0A    int startSize = getRuleSize.get();%0A    return () -%3E%0A        eventBus.post(%0A            start.finish(getRuleSize.get() - startSize, descriptionName, buildTargetName));%0A  %7D%0A%0A  @Override%0A  protected String getValueString() %7B%0A    return %22%22;%0A  %7D%0A%0A  @Override%0A  public String getEventName() %7B%0A    return EVENT_NAME;%0A  %7D%0A%0A  public Long getElapsedTime() %7B%0A    return elapsedTime;%0A  %7D%0A%0A  public int getNumberNodesGenerated() %7B%0A    return numberNodesGenerated;%0A  %7D%0A%0A  public String getBuildTargetName() %7B%0A    return buildTargetName;%0A  %7D%0A%0A  public String getTargetNodeDescriptionName() %7B%0A    return targetNodeDescriptionName;%0A  %7D%0A%0A  /** Class representing the start of timing */%0A  public static class Start %7B%0A%0A    private final Long startTime;%0A    private Clock clock;%0A%0A    private Start(Clock clock) %7B%0A      this.clock = clock;%0A      this.startTime = clock.currentTimeMillis();%0A    %7D%0A%0A    /** Generates the event representing the end of the timing */%0A    private ActionGraphPerfStatEvent finish(%0A        int generatedNodesCount, String descriptionName, String buildTargetName) %7B%0A      return new ActionGraphPerfStatEvent(%0A          clock.currentTimeMillis() - startTime,%0A          generatedNodesCount,%0A          descriptionName,%0A          buildTargetName);%0A    %7D%0A  %7D%0A%7D%0A

Add scuba logging and action graph instrumentation event