def METHOD_NAME(self, session):
    duration = session.getDuration()
    if duration == 0.:
        # profiled code was too fast for the clock, throw this result out
        # if we keep it we may get many false positive spike detects
        return
    isSpike = self._checkSpike(session)
    self._durationAverager.addValue(duration)
    storeAvg = True
    if self._avgSession is not None:
        avgDur = self.getAvgDuration()
        if abs(self._avgSession.getDuration() - avgDur) < abs(duration - avgDur):
            # current avg data is more average than this new sample, keep the data we've
            # already got stored
            storeAvg = False
    if storeAvg:
        if self._avgSession:
            self._avgSession.release()
        self._avgSession = session.getReference()