NetDEM v1.0
Loading...
Searching...
No Matches
netdem::DEMProfiler Class Reference

A profiler class for measuring performance metrics in a DEM simulation. More...

#include <dem_profiler.hpp>

Public Types

enum  TimerType {
  linked_list , contacts , particles , walls ,
  pre_modifiers , mid_modifiers , post_modifiers , mpi_communication ,
  custom , num_timers
}
 

Public Member Functions

 DEMProfiler ()
 
void StartTimer (TimerType t_type)
 Start a timer for measuring elapsed time.
 
void EndTimer (TimerType t_type)
 End a timer for measuring elapsed time.
 
void Clear ()
 
void Print ()
 

Static Public Member Functions

static int64t GetTimeMicros ()
 Get the current time in microseconds.
 

Public Attributes

int64t timer_list [TimerType::num_timers]
 
int num_particles {0}
 
int num_walls {0}
 
int num_neighs {0}
 
int num_neigh_builds {0}
 
double num_neighs_per_p {0}
 

Detailed Description

A profiler class for measuring performance metrics in a DEM simulation.

This class provides a set of methods and member variables for measuring various performance metrics during a discrete element method (DEM) simulation. These metrics include timing information for different parts of the simulation, as well as counts of particles, walls, neighbors, and other relevant quantities. The class also includes methods for clearing and printing the collected data.

Examples
00_sdf_demo.cpp, and 2_ev_gjk_performance.cpp.

Member Enumeration Documentation

◆ TimerType

Enumerator
linked_list 
contacts 
particles 
walls 
pre_modifiers 
mid_modifiers 
post_modifiers 
mpi_communication 
custom 
num_timers 

Constructor & Destructor Documentation

◆ DEMProfiler()

DEMProfiler::DEMProfiler ( )

A default constructor for this class.

Member Function Documentation

◆ Clear()

void DEMProfiler::Clear ( )

Reset all performance metrics to zero.

Examples
00_sdf_demo.cpp, and 2_ev_gjk_performance.cpp.

◆ EndTimer()

void DEMProfiler::EndTimer ( TimerType t_type)

End a timer for measuring elapsed time.

This method stops a timer that was previously started using StartTimer(). The timer's elapsed time since it was started is added to the appropriate entry in the timer_list array. If no timer with the specified type is currently running, this method does nothing.

Parameters
t_typeThe type of timer to stop.
Examples
00_sdf_demo.cpp, and 2_ev_gjk_performance.cpp.

◆ GetTimeMicros()

DEMProfiler::int64t DEMProfiler::GetTimeMicros ( )
static

Get the current time in microseconds.

This static method returns the current time in microseconds, using whatever high-precision timer is available on the system. This is used to measure elapsed time between different points in the simulation.

Returns
The current time in microseconds.

◆ Print()

void DEMProfiler::Print ( )

Print all collected performance metrics to the console.

◆ StartTimer()

void DEMProfiler::StartTimer ( TimerType t_type)

Start a timer for measuring elapsed time.

This method starts a timer for measuring elapsed time in a particular part of the simulation. The timer is identified by a TimerType enum value, which determines its position in the timer_list array. If a timer with the same type is already running, this method does nothing.

Parameters
t_typeThe type of timer to start.
Examples
00_sdf_demo.cpp, and 2_ev_gjk_performance.cpp.

Member Data Documentation

◆ num_neigh_builds

int netdem::DEMProfiler::num_neigh_builds {0}

The number of times neighbor lists were rebuilt during the simulation.

◆ num_neighs

int netdem::DEMProfiler::num_neighs {0}

The total number of particle neighbors in the simulation.

◆ num_neighs_per_p

double netdem::DEMProfiler::num_neighs_per_p {0}

The average number of neighbors per particle in the simulation.

◆ num_particles

int netdem::DEMProfiler::num_particles {0}

The number of particles in the simulation.

◆ num_walls

int netdem::DEMProfiler::num_walls {0}

The number of walls in the simulation.

◆ timer_list

int64t netdem::DEMProfiler::timer_list[TimerType::num_timers]

An array of timers for measuring elapsed time in different parts of the simulation.

Examples
00_sdf_demo.cpp, and 2_ev_gjk_performance.cpp.

The documentation for this class was generated from the following files: