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 310 of file FastTimerService.cc.

310 { measure(); }

Member Function Documentation

◆ measure()

void FastTimerService::Measurement::measure ( )
noexcept

Definition at line 312 of file FastTimerService.cc.

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

Referenced by FastTimerService::on_scheduler_entry().

312  {
313 #ifdef DEBUG_THREAD_CONCURRENCY
314  id = std::this_thread::get_id();
315 #endif // DEBUG_THREAD_CONCURRENCY
320 }
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 340 of file FastTimerService.cc.

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

340  {
341 #ifdef DEBUG_THREAD_CONCURRENCY
342  assert(std::this_thread::get_id() == id);
343 #endif // DEBUG_THREAD_CONCURRENCY
344  auto new_time_thread = boost::chrono::thread_clock::now();
345  auto new_time_real = boost::chrono::high_resolution_clock::now();
346  auto new_allocated = memory_usage::allocated();
347  auto new_deallocated = memory_usage::deallocated();
348  store.time_thread += new_time_thread - time_thread;
349  store.time_real += new_time_real - time_real;
350  store.allocated += new_allocated - allocated;
351  store.deallocated += new_deallocated - deallocated;
352  time_thread = new_time_thread;
353  time_real = new_time_real;
354  allocated = new_allocated;
355  deallocated = new_deallocated;
356 }
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 358 of file FastTimerService.cc.

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

358  {
359 #ifdef DEBUG_THREAD_CONCURRENCY
360  assert(std::this_thread::get_id() == id);
361 #endif // DEBUG_THREAD_CONCURRENCY
362  auto new_time_thread = boost::chrono::thread_clock::now();
363  auto new_time_real = boost::chrono::high_resolution_clock::now();
364  auto new_allocated = memory_usage::allocated();
365  auto new_deallocated = memory_usage::deallocated();
366  store.time_thread += boost::chrono::duration_cast<boost::chrono::nanoseconds>(new_time_thread - time_thread).count();
367  store.time_real += boost::chrono::duration_cast<boost::chrono::nanoseconds>(new_time_real - time_real).count();
368  store.allocated += new_allocated - allocated;
369  store.deallocated += new_deallocated - deallocated;
370  time_thread = new_time_thread;
371  time_real = new_time_real;
372  allocated = new_allocated;
373  deallocated = new_deallocated;
374 }
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 322 of file FastTimerService.cc.

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

322  {
323 #ifdef DEBUG_THREAD_CONCURRENCY
324  assert(std::this_thread::get_id() == id);
325 #endif // DEBUG_THREAD_CONCURRENCY
326  auto new_time_thread = boost::chrono::thread_clock::now();
327  auto new_time_real = boost::chrono::high_resolution_clock::now();
328  auto new_allocated = memory_usage::allocated();
329  auto new_deallocated = memory_usage::deallocated();
330  store.time_thread = new_time_thread - time_thread;
331  store.time_real = new_time_real - time_real;
332  store.allocated = new_allocated - allocated;
333  store.deallocated = new_deallocated - deallocated;
334  time_thread = new_time_thread;
335  time_real = new_time_real;
336  allocated = new_allocated;
337  deallocated = new_deallocated;
338 }
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.