Beispiel #1
0
/// addPeakMemoryMeasurement - This method should be called whenever memory
/// usage needs to be checked.  It adds a peak memory measurement to the
/// currently active timers, which will be printed when the timer group prints
///
void Timer::addPeakMemoryMeasurement() {
    sys::SmartScopedLock<true> L(*TimerLock);
    size_t MemUsed = getMemUsage();

    for (std::vector<Timer*>::iterator I = ActiveTimers->begin(),
            E = ActiveTimers->end(); I != E; ++I)
        (*I)->PeakMem = std::max((*I)->PeakMem, MemUsed-(*I)->PeakMemBase);
}
Beispiel #2
0
/// addPeakMemoryMeasurement - This method should be called whenever memory
/// usage needs to be checked.  It adds a peak memory measurement to the
/// currently active timers, which will be printed when the timer group prints
///
void Timer::addPeakMemoryMeasurement() {
  size_t MemUsed = getMemUsage();

  for (std::vector<Timer*>::iterator I = ActiveTimers->begin(),
         E = ActiveTimers->end(); I != E; ++I) {
    (*I)->Lock.acquire();
    (*I)->PeakMem = std::max((*I)->PeakMem, MemUsed-(*I)->PeakMemBase);
    (*I)->Lock.release();
  }
}
Beispiel #3
0
void Timer::stopTimer() {
  Time += TimeRecord::getCurrentTime(false);

  if (ActiveTimers->back() == this) {
    ActiveTimers->pop_back();
  } else {
    std::vector<Timer*>::iterator I =
      std::find(ActiveTimers->begin(), ActiveTimers->end(), this);
    assert(I != ActiveTimers->end() && "stop but no startTimer?");
    ActiveTimers->erase(I);
  }
}
Beispiel #4
0
void Timer::stopTimer() {
    sys::SmartScopedLock<true> L(*TimerLock);
    TimeRecord TR = getTimeRecord(false);
    Elapsed    += TR.Elapsed;
    UserTime   += TR.UserTime;
    SystemTime += TR.SystemTime;
    MemUsed    += TR.MemUsed;

    if (ActiveTimers->back() == this) {
        ActiveTimers->pop_back();
    } else {
        std::vector<Timer*>::iterator I =
            std::find(ActiveTimers->begin(), ActiveTimers->end(), this);
        assert(I != ActiveTimers->end() && "stop but no startTimer?");
        ActiveTimers->erase(I);
    }
}