CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
FastTimerService::Measurement Struct Reference

Public Member Functions

void measure () noexcept
 
void measure_and_accumulate (Resources &store) noexcept
 
void measure_and_accumulate (AtomicResources &store) noexcept
 
void measure_and_store (Resources &store) noexcept
 
 Measurement () noexcept
 

Public Attributes

uint64_t allocated
 
uint64_t deallocated
 
boost::chrono::high_resolution_clock::time_point time_real
 
boost::chrono::thread_clock::time_point time_thread
 

Detailed Description

Definition at line 194 of file FastTimerService.h.

Constructor & Destructor Documentation

◆ Measurement()

FastTimerService::Measurement::Measurement ( )
noexcept

Definition at line 312 of file FastTimerService.cc.

312 { measure(); }

Member Function Documentation

◆ measure()

void FastTimerService::Measurement::measure ( )
noexcept

Definition at line 314 of file FastTimerService.cc.

References memory_usage::allocated(), memory_usage::deallocated(), and submitPVValidationJobs::now.

Referenced by FastTimerService::on_scheduler_entry().

314  {
315 #ifdef DEBUG_THREAD_CONCURRENCY
316  id = std::this_thread::get_id();
317 #endif // DEBUG_THREAD_CONCURRENCY
322 }
boost::chrono::thread_clock::time_point time_thread
static uint64_t deallocated()
Definition: memory_usage.cc:88
boost::chrono::high_resolution_clock::time_point time_real
static uint64_t allocated()
Definition: memory_usage.cc:86

◆ measure_and_accumulate() [1/2]

void FastTimerService::Measurement::measure_and_accumulate ( Resources store)
noexcept

Definition at line 342 of file FastTimerService.cc.

References memory_usage::allocated(), cms::cuda::assert(), memory_usage::deallocated(), and submitPVValidationJobs::now.

Referenced by FastTimerService::on_scheduler_entry(), and FastTimerService::on_scheduler_exit().

342  {
343 #ifdef DEBUG_THREAD_CONCURRENCY
344  assert(std::this_thread::get_id() == id);
345 #endif // DEBUG_THREAD_CONCURRENCY
346  auto new_time_thread = boost::chrono::thread_clock::now();
347  auto new_time_real = boost::chrono::high_resolution_clock::now();
348  auto new_allocated = memory_usage::allocated();
349  auto new_deallocated = memory_usage::deallocated();
350  store.time_thread += new_time_thread - time_thread;
351  store.time_real += new_time_real - time_real;
352  store.allocated += new_allocated - allocated;
353  store.deallocated += new_deallocated - deallocated;
354  time_thread = new_time_thread;
355  time_real = new_time_real;
356  allocated = new_allocated;
357  deallocated = new_deallocated;
358 }
assert(be >=bs)
boost::chrono::thread_clock::time_point time_thread
static uint64_t deallocated()
Definition: memory_usage.cc:88
boost::chrono::high_resolution_clock::time_point time_real
static uint64_t allocated()
Definition: memory_usage.cc:86

◆ measure_and_accumulate() [2/2]

void FastTimerService::Measurement::measure_and_accumulate ( AtomicResources store)
noexcept

Definition at line 360 of file FastTimerService.cc.

References memory_usage::allocated(), cms::cuda::assert(), submitPVResolutionJobs::count, memory_usage::deallocated(), and submitPVValidationJobs::now.

360  {
361 #ifdef DEBUG_THREAD_CONCURRENCY
362  assert(std::this_thread::get_id() == id);
363 #endif // DEBUG_THREAD_CONCURRENCY
364  auto new_time_thread = boost::chrono::thread_clock::now();
365  auto new_time_real = boost::chrono::high_resolution_clock::now();
366  auto new_allocated = memory_usage::allocated();
367  auto new_deallocated = memory_usage::deallocated();
368  store.time_thread += boost::chrono::duration_cast<boost::chrono::nanoseconds>(new_time_thread - time_thread).count();
369  store.time_real += boost::chrono::duration_cast<boost::chrono::nanoseconds>(new_time_real - time_real).count();
370  store.allocated += new_allocated - allocated;
371  store.deallocated += new_deallocated - deallocated;
372  time_thread = new_time_thread;
373  time_real = new_time_real;
374  allocated = new_allocated;
375  deallocated = new_deallocated;
376 }
boost::date_time::subsecond_duration< boost::posix_time::time_duration, 1000000000 > nanoseconds
assert(be >=bs)
boost::chrono::thread_clock::time_point time_thread
static uint64_t deallocated()
Definition: memory_usage.cc:88
boost::chrono::high_resolution_clock::time_point time_real
static uint64_t allocated()
Definition: memory_usage.cc:86

◆ measure_and_store()

void FastTimerService::Measurement::measure_and_store ( Resources store)
noexcept

Definition at line 324 of file FastTimerService.cc.

References memory_usage::allocated(), cms::cuda::assert(), memory_usage::deallocated(), and submitPVValidationJobs::now.

324  {
325 #ifdef DEBUG_THREAD_CONCURRENCY
326  assert(std::this_thread::get_id() == id);
327 #endif // DEBUG_THREAD_CONCURRENCY
328  auto new_time_thread = boost::chrono::thread_clock::now();
329  auto new_time_real = boost::chrono::high_resolution_clock::now();
330  auto new_allocated = memory_usage::allocated();
331  auto new_deallocated = memory_usage::deallocated();
332  store.time_thread = new_time_thread - time_thread;
333  store.time_real = new_time_real - time_real;
334  store.allocated = new_allocated - allocated;
335  store.deallocated = new_deallocated - deallocated;
336  time_thread = new_time_thread;
337  time_real = new_time_real;
338  allocated = new_allocated;
339  deallocated = new_deallocated;
340 }
assert(be >=bs)
boost::chrono::thread_clock::time_point time_thread
static uint64_t deallocated()
Definition: memory_usage.cc:88
boost::chrono::high_resolution_clock::time_point time_real
static uint64_t allocated()
Definition: memory_usage.cc:86

Member Data Documentation

◆ allocated

uint64_t FastTimerService::Measurement::allocated

Definition at line 211 of file FastTimerService.h.

◆ deallocated

uint64_t FastTimerService::Measurement::deallocated

Definition at line 212 of file FastTimerService.h.

◆ time_real

boost::chrono::high_resolution_clock::time_point FastTimerService::Measurement::time_real

Definition at line 210 of file FastTimerService.h.

◆ time_thread

boost::chrono::thread_clock::time_point FastTimerService::Measurement::time_thread

Definition at line 209 of file FastTimerService.h.