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 (AtomicResources &store) noexcept
 
void measure_and_accumulate (Resources &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 188 of file FastTimerService.h.

Constructor & Destructor Documentation

◆ Measurement()

FastTimerService::Measurement::Measurement ( )
noexcept

Definition at line 304 of file FastTimerService.cc.

304 { measure(); }

Member Function Documentation

◆ measure()

void FastTimerService::Measurement::measure ( )
noexcept

Definition at line 306 of file FastTimerService.cc.

306  {
307 #ifdef DEBUG_THREAD_CONCURRENCY
308  id = std::this_thread::get_id();
309 #endif // DEBUG_THREAD_CONCURRENCY
314 }

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

◆ measure_and_accumulate() [1/2]

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

Definition at line 352 of file FastTimerService.cc.

352  {
353 #ifdef DEBUG_THREAD_CONCURRENCY
354  assert(std::this_thread::get_id() == id);
355 #endif // DEBUG_THREAD_CONCURRENCY
356  auto new_time_thread = boost::chrono::thread_clock::now();
357  auto new_time_real = boost::chrono::high_resolution_clock::now();
358  auto new_allocated = memory_usage::allocated();
359  auto new_deallocated = memory_usage::deallocated();
360  store.time_thread += boost::chrono::duration_cast<boost::chrono::nanoseconds>(new_time_thread - time_thread).count();
361  store.time_real += boost::chrono::duration_cast<boost::chrono::nanoseconds>(new_time_real - time_real).count();
362  store.allocated += new_allocated - allocated;
363  store.deallocated += new_deallocated - deallocated;
364  time_thread = new_time_thread;
365  time_real = new_time_real;
366  allocated = new_allocated;
367  deallocated = new_deallocated;
368 }

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

◆ measure_and_accumulate() [2/2]

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

Definition at line 334 of file FastTimerService.cc.

334  {
335 #ifdef DEBUG_THREAD_CONCURRENCY
336  assert(std::this_thread::get_id() == id);
337 #endif // DEBUG_THREAD_CONCURRENCY
338  auto new_time_thread = boost::chrono::thread_clock::now();
339  auto new_time_real = boost::chrono::high_resolution_clock::now();
340  auto new_allocated = memory_usage::allocated();
341  auto new_deallocated = memory_usage::deallocated();
342  store.time_thread += new_time_thread - time_thread;
343  store.time_real += new_time_real - time_real;
344  store.allocated += new_allocated - allocated;
345  store.deallocated += new_deallocated - deallocated;
346  time_thread = new_time_thread;
347  time_real = new_time_real;
348  allocated = new_allocated;
349  deallocated = new_deallocated;
350 }

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

◆ measure_and_store()

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

Definition at line 316 of file FastTimerService.cc.

316  {
317 #ifdef DEBUG_THREAD_CONCURRENCY
318  assert(std::this_thread::get_id() == id);
319 #endif // DEBUG_THREAD_CONCURRENCY
320  auto new_time_thread = boost::chrono::thread_clock::now();
321  auto new_time_real = boost::chrono::high_resolution_clock::now();
322  auto new_allocated = memory_usage::allocated();
323  auto new_deallocated = memory_usage::deallocated();
324  store.time_thread = new_time_thread - time_thread;
325  store.time_real = new_time_real - time_real;
326  store.allocated = new_allocated - allocated;
327  store.deallocated = new_deallocated - deallocated;
328  time_thread = new_time_thread;
329  time_real = new_time_real;
330  allocated = new_allocated;
331  deallocated = new_deallocated;
332 }

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

Member Data Documentation

◆ allocated

uint64_t FastTimerService::Measurement::allocated

Definition at line 205 of file FastTimerService.h.

◆ deallocated

uint64_t FastTimerService::Measurement::deallocated

Definition at line 206 of file FastTimerService.h.

◆ time_real

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

Definition at line 204 of file FastTimerService.h.

◆ time_thread

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

Definition at line 203 of file FastTimerService.h.

FastTimerService::Measurement::measure
void measure() noexcept
Definition: FastTimerService.cc:306
cms::cuda::assert
assert(be >=bs)
FastTimerService::Measurement::deallocated
uint64_t deallocated
Definition: FastTimerService.h:206
fileCollector.now
now
Definition: fileCollector.py:207
FastTimerService::Measurement::allocated
uint64_t allocated
Definition: FastTimerService.h:205
memory_usage::deallocated
static uint64_t deallocated()
Definition: memory_usage.cc:88
memory_usage::allocated
static uint64_t allocated()
Definition: memory_usage.cc:86
FastTimerService::Measurement::time_real
boost::chrono::high_resolution_clock::time_point time_real
Definition: FastTimerService.h:204
FastTimerService::Measurement::time_thread
boost::chrono::thread_clock::time_point time_thread
Definition: FastTimerService.h:203