NetDEM v1.0
|
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} |
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.
DEMProfiler::DEMProfiler | ( | ) |
A default constructor for this class.
void DEMProfiler::Clear | ( | ) |
Reset all performance metrics to zero.
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.
t_type | The type of timer to stop. |
|
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.
void DEMProfiler::Print | ( | ) |
Print all collected performance metrics to the console.
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.
t_type | The type of timer to start. |
int netdem::DEMProfiler::num_neigh_builds {0} |
The number of times neighbor lists were rebuilt during the simulation.
int netdem::DEMProfiler::num_neighs {0} |
The total number of particle neighbors in the simulation.
double netdem::DEMProfiler::num_neighs_per_p {0} |
The average number of neighbors per particle in the simulation.
int netdem::DEMProfiler::num_particles {0} |
The number of particles in the simulation.
int netdem::DEMProfiler::num_walls {0} |
The number of walls in the simulation.
int64t netdem::DEMProfiler::timer_list[TimerType::num_timers] |
An array of timers for measuring elapsed time in different parts of the simulation.