/**
  * Adds an occurrence of this event to the cumulative counters. This method can be used as an
  * alternative to <code>startRun</code> and <code>endRun</code> for clients that want to track the
  * context and execution time separately.
  *
  * @param elapsed The elapsed time of the new occurrence in milliseconds
  * @param contextName The context for the event to return, or <code>null</code>. The context
  *     optionally provides extra information about an event, such as the name of a project being
  *     built, or the input of an editor being opened.
  */
 public void addRun(long elapsed, String contextName) {
   if (!ENABLED) return;
   runCount++;
   runningTime += elapsed;
   if (elapsed > getThreshold(event))
     PerformanceStatsProcessor.failed(
         createFailureStats(contextName, elapsed), blamePluginId, elapsed);
   if (TRACE_SUCCESS) PerformanceStatsProcessor.changed(this);
 }
 /**
  * Writes all statistics using the provided writer
  *
  * @param out The writer to print stats to.
  */
 public static void printStats(PrintWriter out) {
   if (!ENABLED) return;
   PerformanceStatsProcessor.printStats(out);
 }
 /**
  * Removes an event listener. Has no effect if an equal listener object is not currently
  * registered.
  *
  * @param listener The listener to remove
  * @see #addListener(PerformanceStats.PerformanceListener)
  */
 public static void removeListener(PerformanceListener listener) {
   if (ENABLED) PerformanceStatsProcessor.removeListener(listener);
 }
 /** Prints all statistics to the standard output. */
 public static void printStats() {
   if (!ENABLED) return;
   PrintWriter writer = new PrintWriter(System.out);
   PerformanceStatsProcessor.printStats(writer);
   writer.flush();
 }