Esempio n. 1
0
Timer::Timer(Name name, StructuredLogEntry* log_entry)
  : m_name(name)
  , m_finished(false)
  , m_start(getCPUTimeNanos())
  , m_start_wall(getWallClockMicros())
  , m_log_entry(log_entry)
{
}
Esempio n. 2
0
void Timer::end() {
  assert(!m_finished);
  auto const finish = getCPUTimeNanos();
  auto const elapsed = finish - m_start;

  auto& counter = (*s_counters)[m_name];
  counter.total += elapsed;
  ++counter.count;
  m_finished = true;
}
Esempio n. 3
0
void Timer::end() {
  if (!RuntimeOption::EvalJitTimer) return;

  assert(!m_finished);
  auto const finish = getCPUTimeNanos();
  auto const elapsed = finish - m_start;

  auto& counter = s_counters[m_name];
  counter.total += elapsed;
  ++counter.count;
  m_finished = true;
}
Esempio n. 4
0
int64_t Timer::stop() {
  if (!RuntimeOption::EvalJitTimer) return 0;

  assertx(!m_finished);
  auto const elapsed = getCPUTimeNanos() - m_start;
  auto const elapsed_wall_clock = getWallClockMicros() - m_start_wall;

  if (m_log_entry) {
    m_log_entry->setInt(std::string(s_names[(size_t)m_name].str) + "_micros",
                        elapsed / 1000);
  }

  auto& counter = s_counters[m_name];
  counter.total += elapsed;
  ++counter.count;
  counter.max = std::max(counter.max, elapsed);
  counter.wall_time_elapsed += elapsed_wall_clock;
  m_finished = true;
  return elapsed;
}
Esempio n. 5
0
Timer::Timer(Name name)
  : m_name(name)
  , m_start(getCPUTimeNanos())
  , m_finished(false)
{
}
Esempio n. 6
0
Timer::Timer(const std::string& name)
  : m_name(name)
  , m_start(getCPUTimeNanos())
  , m_finished(false)
{
}