BioDynaMo
v1.05.120-25dc9790
|
This class implements a progress bar that can be used to track the progress of a simulation. More...
#include <progress_bar.h>
Public Member Functions | |
ProgressBar () | |
ProgressBar (int total_steps) | |
void | Step (uint64_t steps=1) |
Inceases the counter executed_steps_ by steps . More... | |
void | PrintProgressBar (std::ostream &out=std::cout) |
Prints the progress bar. More... | |
void | SetTimeUnit (const std::string &time_unit) |
Private Attributes | |
std::string | time_unit_ = "s" |
Time unit string for elapsed and remaining time. More... | |
uint64_t | total_steps_ = 0 |
Total number of steps to be executed. More... | |
uint64_t | executed_steps_ = 0 |
Number of steps that have already been executed. More... | |
int64_t | start_time_ = 0 |
Timestamp when to when the progress bar was initialized. More... | |
size_t | n_terminal_chars_ = 0 |
real_t | time_conversion_factor_ = 1000 |
Variable for conversion of time units (e.g. 1000 for ms to s). More... | |
bool | first_iter_ = true |
bool | write_to_file_ = false |
This class implements a progress bar that can be used to track the progress of a simulation.
The progress bar is printed to the terminal and looks like this: 100% [====================] 1000/1000 0.0s
The progress bar is updated every time the function Step
is called in the scheduler.
The progress bar is not visible if the simulation output is written to a file.
Relevant parameters:
Param::progress_bar_time_unit
(default: "s")Param::use_progress_bar
(default: false) Definition at line 40 of file progress_bar.h.
bdm::ProgressBar::ProgressBar | ( | ) |
Definition at line 36 of file progress_bar.cc.
|
explicit |
Definition at line 38 of file progress_bar.cc.
void bdm::ProgressBar::PrintProgressBar | ( | std::ostream & | out = std::cout | ) |
Prints the progress bar.
Definition at line 43 of file progress_bar.cc.
void bdm::ProgressBar::SetTimeUnit | ( | const std::string & | time_unit | ) |
Set the time unit (and the conversion factor) for elapsed and remaining time.
Definition at line 123 of file progress_bar.cc.
void bdm::ProgressBar::Step | ( | uint64_t | steps = 1 | ) |
Inceases the counter executed_steps_
by steps
.
Definition at line 41 of file progress_bar.cc.
|
private |
Number of steps that have already been executed.
Definition at line 47 of file progress_bar.h.
|
private |
Boolean variable to print certain information only once in the first iteration.
Definition at line 57 of file progress_bar.h.
|
private |
Keep track of space that is needed for printing elapsed and remaining time for nicer output.
Definition at line 52 of file progress_bar.h.
|
private |
Timestamp when to when the progress bar was initialized.
Definition at line 49 of file progress_bar.h.
|
private |
Variable for conversion of time units (e.g. 1000 for ms to s).
Definition at line 54 of file progress_bar.h.
|
private |
Time unit string for elapsed and remaining time.
Definition at line 43 of file progress_bar.h.
|
private |
Total number of steps to be executed.
Definition at line 45 of file progress_bar.h.
|
private |
Variable to detect if we write to a file or not. ProgressBar is not visible if we write to file.
Definition at line 60 of file progress_bar.h.