Navigation, longtask and frame don't have a clear method (yet) Resource timings can only be cleared in bulk see: https://developer.mozilla.org/en-US/docs/Web/API/Performance/clearMeasures
359723
function clear (entry) {
    var type = entry.entryType
    if (type === 'measure') window.performance.clearMeasures(entry.name)
    else if (type === 'resource') window.performance.clearResourceTimings()
  }
113545
def clear_timeline(self):
        
        self._timeline.delete(tk.ALL)
        self._canvas_ticks.delete(tk.ALL)
1358270
public void addGetTimeNanos(long duration) {
        for (;;) {
            long nanos = getCacheTimeTakenNanos;
            if (nanos <= Long.MAX_VALUE - duration) {
                if (GET_CACHE_TIME_TAKEN_NANOS.compareAndSet(this, nanos, nanos + duration)) {
                    return;
                }
            } else {
                //counter full. Just reset.
                if (GET_CACHE_TIME_TAKEN_NANOS.compareAndSet(this, nanos, duration)) {
                    clear();
                    return;
                }
            }
        }
    }
609566
function () {

            var that = this;
            var now = +new Date();
            var toRemove = _(this.controllers).filter(function (c) {
                var age = (now - c.lastView);
                return (age > 60000); // Keep in cache for 1 minute.
            });

            _(toRemove).each(function (c) {
                if (c.controller !== that.currentController) {
                    delete that.controllers[c.pageUID];
                    c.controller.destroy();
                    if (c.controller._rootView) {
                        c.controller._rootView.clean();
                        c.controller._rootView.remove();
                        Jackbone.trigger("destroyview", c.controller._rootView);
                    }
                }
            });
        }
1228896
function(opts) {
            var performance = window.performance || window.webkitPerformance || window.msPerformance || window.mozPerformance;

            if (performance === undefined) {
                //console.log('Unfortunately, your browser does not support the Navigation Timing API');
                return;
            }

            var timing = performance.timing;
            var api = {};
            opts = opts || {};

            if (timing) {
                if(opts && !opts.simple) {
                    for (var k in timing) {
                        if (timing.hasOwnProperty(k)) {
                            api[k] = timing[k];
                        }
                    }
                }


                // Time to first paint
                if (api.firstPaint === undefined) {
                    // All times are relative times to the start time within the
                    // same objects
                    var firstPaint = 0;

                    // Chrome
                    if (window.chrome && window.chrome.loadTimes) {
                        // Convert to ms
                        firstPaint = window.chrome.loadTimes().firstPaintTime * 1000;
                        api.firstPaintTime = firstPaint - (window.chrome.loadTimes().startLoadTime*1000);
                    }
                    // IE
                    else if (typeof window.performance.timing.msFirstPaint === 'number') {
                        firstPaint = window.performance.timing.msFirstPaint;
                        api.firstPaintTime = firstPaint - window.performance.timing.navigationStart;
                    }
                    // Firefox
                    // This will use the first times after MozAfterPaint fires
                    //else if (window.performance.timing.navigationStart && typeof InstallTrigger !== 'undefined') {
                    //    api.firstPaint = window.performance.timing.navigationStart;
                    //    api.firstPaintTime = mozFirstPaintTime - window.performance.timing.navigationStart;
                    //}
                    if (opts && !opts.simple) {
                        api.firstPaint = firstPaint;
                    }
                }

                // Total time from start to load
                api.loadTime = timing.loadEventEnd - timing.fetchStart;
                // Time spent constructing the DOM tree
                api.domReadyTime = timing.domComplete - timing.domInteractive;
                // Time consumed preparing the new page
                api.readyStart = timing.fetchStart - timing.navigationStart;
                // Time spent during redirection
                api.redirectTime = timing.redirectEnd - timing.redirectStart;
                // AppCache
                api.appcacheTime = timing.domainLookupStart - timing.fetchStart;
                // Time spent unloading documents
                api.unloadEventTime = timing.unloadEventEnd - timing.unloadEventStart;
                // DNS query time
                api.lookupDomainTime = timing.domainLookupEnd - timing.domainLookupStart;
                // TCP connection time
                api.connectTime = timing.connectEnd - timing.connectStart;
                // Time spent during the request
                api.requestTime = timing.responseEnd - timing.requestStart;
                // Request to completion of the DOM loading
                api.initDomTreeTime = timing.domInteractive - timing.responseEnd;
                // Load event time
                api.loadEventTime = timing.loadEventEnd - timing.loadEventStart;
            }

            return api;
        }
1351164
def _clear(self):
        """"""
        self._finished = False
        self._measurement = None
        self._message = None
        self._message_body = None
715266
function() {
			var self = this;
	
			self.loadedSearches = {};
			self.userOptions = {};
			self.renderCache = {};
			self.options = self.sifter.items = {};
			self.lastQuery = null;
			self.trigger('option_clear');
			self.clear();
		}
1348332
function( time, type ) {
		time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
		type = type || "fx";

		return this.queue( type, function( next, hooks ) {
			var timeout = setTimeout( next, time );
			hooks.stop = function() {
				clearTimeout( timeout );
			};
		});
	}
579258
function handleRouteChange( place, routerParameters, fragment ) {
      const parameters = { ...place.defaultParameters, ...routerParameters };
      const isSamePlace = activePlace && place.id === activePlace.id;
      const isSameFragment = fragment === activeFragment;

      if( isSamePlace && isSameFragment && equals( parameters, activeParameters ) ) {
         navigationInProgress = false;
         log.trace( `Canceling navigation to "${place.id}". Already there with same parameters.` );
         return Promise.resolve();
      }
      if( navigationInProgress ) {
         log.trace( `Canceling navigation to "${place.id}". Navigation already in progress.` );
         return Promise.resolve();
      }
      navigationInProgress = true;

      const fromPlace = activePlace ? activePlace.targets[ TARGET_SELF ] : '';
      const navigationTimer = timer.started( {
         label: `navigation (${fromPlace} -> ${place.targets[ TARGET_SELF ]})`,
         persistenceKey: SESSION_KEY_TIMER
      } );

      const event = {
         target: requestedTarget || place.id,
         place: place.id,
         data: parameters
      };
      if( fragment ) {
         event.fragment = fragment;
      }
      requestedTarget = null;

      const options = { sender: COLLABORATOR_ID };
      return eventBus.publish( `willNavigate.${event.target}`, event, options )
         .then( () => {
            if( activePlace && isSamePlace ) {
               activeParameters = parameters;
               activeFragment = fragment;
               return Promise.resolve();
            }

            return pageService.controller().tearDownPage()
               .then( () => {
                  log.setTag( 'PLCE', place.id );
                  activeParameters = parameters;
                  activeFragment = fragment;
                  activePlace = place;
                  return pageService.controller().setupPage( place.page );
               } );
         } )
         .then( () => {
            navigationInProgress = false;
            navigationTimer.stopAndLog( 'didNavigate' );
            return eventBus.publish( `didNavigate.${event.target}`, event, options );
         } )
         .catch( err => {
            log.error( `Failed to navigate to place "${place.id}". Error: [0]\n`, err.stack );
            return Promise.reject( err );
         } );
   }
378338
private void resetAnimation(){		
		mLastUpdateTime = SystemClock.uptimeMillis();
		mLastProgressStateTime = mLastUpdateTime;
		if(mProgressMode == ProgressView.MODE_INDETERMINATE){
			mStartLine = mReverse ? getBounds().width() : 0;
			mStrokeColorIndex = 0;
			mLineWidth = mReverse ? -mMinLineWidth : mMinLineWidth;
			mProgressState = PROGRESS_STATE_STRETCH;
		}
		else if(mProgressMode == ProgressView.MODE_BUFFER){
			mStartLine = 0;
		}	
		else if(mProgressMode == ProgressView.MODE_QUERY){
			mStartLine = !mReverse ? getBounds().width() : 0;
			mStrokeColorIndex = 0;
			mLineWidth = !mReverse ? -mMaxLineWidth : mMaxLineWidth;
		}		
	}
402477
function checkFrames(frames) {
            if (!frames[0]) {
                postMessage({
                    error: 'Something went wrong. Maybe WebP format is not supported in the current browser.'
                });
                return;
            }

            var width = frames[0].width,
                height = frames[0].height,
                duration = frames[0].duration;

            for (var i = 1; i < frames.length; i++) {
                duration += frames[i].duration;
            }
            return {
                duration: duration,
                width: width,
                height: height
            };
        }
823711
private void remeasure() {
        // TODO: Performance: Guard against calling too often, can it be done without requestLayout?
        forceLayout();
        measure(MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.EXACTLY),
                MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY)
        );
        requestLayout();
    }
1188047
private void clear() {
		availableSlots.clear();
		allocatedSlots.clear();
		pendingRequests.clear();
		waitingForResourceManager.clear();
		registeredTaskManagers.clear();
	}
1101478
function() {
      var csr = new tr.ClockSyncRecord('ftrace_importer', 0, {});
      this.model_.clockSyncRecords.push(csr);
      if (this.stackFrameEvents_) {
        this.importStackFrames_(
            this.stackFrameEvents_, 'g', false /* addRootFrame */);
      }

      if (this.traceAnnotations_)
        this.importAnnotations_();

      var events = this.events_;
      for (var eI = 0; eI < events.length; eI++) {
        var event = events[eI];
        if (event.args === '__stripped__') {
          event.argsStripped = true;
          event.args = undefined;
        }

        if (event.ph === 'B' || event.ph === 'E') {
          this.processDurationEvent(event);

        } else if (event.ph === 'X') {
          var slice = this.processCompleteEvent(event);
          // TODO(yuhaoz): If Chrome supports creating other events with flow,
          // we will need to call processFlowEvent for them also.
          // https://github.com/catapult-project/catapult/issues/1259
          if (slice !== undefined && event.bind_id !== undefined)
            this.processFlowEvent(event, slice);

        } else if (event.ph === 'b' || event.ph === 'e' || event.ph === 'n' ||
                   event.ph === 'S' || event.ph === 'F' || event.ph === 'T' ||
                   event.ph === 'p') {
          this.processAsyncEvent(event);

        // Note, I is historic. The instant event marker got changed, but we
        // want to support loading old trace files so we have both I and i.
        } else if (event.ph === 'I' || event.ph === 'i' || event.ph === 'R') {
          this.processInstantEvent(event);

        } else if (event.ph === 'P') {
          this.processTraceSampleEvent(event);

        } else if (event.ph === 'C') {
          this.processCounterEvent(event);

        } else if (event.ph === 'M') {
          this.processMetadataEvent(event);

        } else if (event.ph === 'N' || event.ph === 'D' || event.ph === 'O') {
          this.processObjectEvent(event);

        } else if (event.ph === 's' || event.ph === 't' || event.ph === 'f') {
          this.processFlowEvent(event);

        } else if (event.ph === 'v') {
          this.processMemoryDumpEvent(event);

        } else {
          this.model_.importWarning({
            type: 'parse_error',
            message: 'Unrecognized event phase: ' +
                event.ph + ' (' + event.name + ')'
          });
        }
      }

      // Remove all the root stack frame children as they should
      // already be added.
      tr.b.iterItems(this.v8ProcessRootStackFrame_, function(name, frame) {
        frame.removeAllChildren();
      });
    }
912713
function() {
        var height = this.root.height;
        var width = this.root.width;
        this.canvas.clearRect(0, 0, width, height);
        this.features = {};
        if (this.hitDetection) {
            this.hitContext.clearRect(0, 0, width, height);
        }
    }
834572
function(event, queue, visited, flowEvents) {
      var stopFollowing = false;
      var inputAck = false;

      event.iterateAllSubsequentSlices(function(slice) {
        if (stopFollowing)
          return;

        // Do not follow TaskQueueManager::RunTask because it causes
        // many false events to be included.
        if (slice.title === 'TaskQueueManager::RunTask')
          return;

        // Do not follow ScheduledActionSendBeginMainFrame because the real
        // main thread BeginMainFrame is already traced by LatencyInfo flow.
        if (slice.title === 'ThreadProxy::ScheduledActionSendBeginMainFrame')
          return;

        // Do not follow ScheduleBeginImplFrameDeadline that triggers an
        // OnBeginImplFrameDeadline that is tracked by another LatencyInfo.
        if (slice.title === 'Scheduler::ScheduleBeginImplFrameDeadline') {
          if (this.triggerOtherInputs(slice, flowEvents))
            return;
        }

        // Do not follow PostComposite that triggers CompositeImmediately
        // that is tracked by another LatencyInfo.
        if (slice.title === 'CompositorImpl::PostComposite') {
          if (this.triggerOtherInputs(slice, flowEvents))
            return;
        }

        // Stop following the rest of the current slice hierarchy if
        // FilterAndSendWebInputEvent occurs after ProcessInputEventAck.
        if (slice.title === 'InputRouterImpl::ProcessInputEventAck')
          inputAck = true;
        if (inputAck &&
            slice.title === 'InputRouterImpl::FilterAndSendWebInputEvent')
          stopFollowing = true;

        this.followCurrentSlice(slice, queue, visited);
      }, this);
    }
542895
function processLogs() {
  var calcs = 0;
  for (var i in stats) {
    stats[i].average = stats[i].totalTime / stats[i].count;
    calcs += stats[i].calcs;
  }
  var time1 = meaningfulTime();
  var time2 = meaningfulTime();
  console.error("TRACER TOTAL OVERHEAD", (calcs*timeDiff(time2, time1)).toFixed(2)+'ms');

  while (Object.keys(stats).length > 0) {
    var biggest = 0;
    var biggestPath = Object.keys(stats)[0];
    for (var path in stats) {
      if (stats[path].average >= biggest) {
        biggestPath = path;
        biggest = stats[path].average;
      }
    }
    console.error("TRACER TOTAL",
                  stats[biggestPath].min.toFixed(2)+'ms',
                  stats[biggestPath].average.toFixed(2)+'ms',
                  stats[biggestPath].max.toFixed(2)+'ms',
                  stats[biggestPath].count,
                  biggestPath);
    delete stats[biggestPath];
  }
}