cgv
|
This class allows to monitor the performance of a set of tasks that are repeatedly executed over time. More...
#include <performance_monitor.h>
Public Types | |
typedef std::vector< performance_measurement > | frame_data |
Public Member Functions | |
performance_monitor () | |
construct performance monitor with standard configuration | |
file io configuration | |
void | set_file_name (const std::string &_file_name) |
const std::string & | get_file_name () const |
void | enable () |
enable performance monitoring | |
void | disable () |
disable performance monitoring | |
bool | is_enabled () const |
return whether performance monitoring is enabled | |
handling of tasks and frames | |
void | init_tasks () |
initialize the list of tasks to one for the frame and one for each default rendering pass | |
int | add_task (const std::string &name, const rgb &col) |
add a new to me monitored item | |
unsigned | get_buffer_size () const |
return the size of the buffer to store frame data | |
void | start_frame () |
start performance measurement of a new frame | |
unsigned | get_frame_id () const |
return the current frame id | |
void | start_task (int task_id) |
add a measurement for starting given task | |
void | finish_task (int task_id) |
add a measurement for finishing given task | |
void | finish_frame () |
finish measurement of a frame, if this is not called by hand, it is called automatically in the next call to start_frame. | |
drawing configuration | |
void | clear_bar () |
removes all items of the bar config and hides the bar | |
void | add_bar_item (PerformanceMonitoringBar item) |
add a bar item to the bar config | |
void | set_placement (const ibox2 &rectangle) |
place the performance monitor on screen in pixel coordinates | |
ibox2 | get_placement () const |
return placement of performance monitor | |
void | set_nr_display_cycles (unsigned _nr_cycles) |
set the number of display cycles to by drawn for the performance monitor | |
unsigned | get_nr_display_cycles () const |
return the number of display cycles to by drawn for the performance monitor | |
Protected Member Functions | |
void | compute_colors (const frame_data &fdata) |
void | compute_positions (int x, int y, int dx, int dy, const frame_data &fdata) |
frame_data & | current_frame () |
void | add_measurement (const performance_measurement &pm) |
Protected Attributes | |
bool | enabled |
double | fps_alpha |
double | fps |
ibox2 | placement |
int | nr_display_cycles |
int | bar_line_width |
rgb | plot_color |
std::string | file_name |
std::vector< performance_task > | tasks |
std::deque< frame_data > | data |
std::vector< PerformanceMonitoringBar > | bar_config |
cgv::utils::stopwatch | watch |
float | time_scale |
std::vector< ivec2 > | positions |
std::vector< rgb > | colors |
This class allows to monitor the performance of a set of tasks that are repeatedly executed over time.
Each repetition is called a frame. The performance monitor supports storage of performance information in a file and prepares everything for rendering performance measurements, where the actually rendering is implemented in libs/cgv_gl/gl/gl_performance_monitor.
Definition at line 42 of file performance_monitor.h.
typedef std::vector<performance_measurement> cgv::render::performance_monitor::frame_data |
Definition at line 45 of file performance_monitor.h.
cgv::render::performance_monitor::performance_monitor | ( | ) |
construct performance monitor with standard configuration
Definition at line 19 of file performance_monitor.cxx.
References init_tasks(), cgv::media::axis_aligned_box< T, N >::ref_max_pnt(), cgv::media::axis_aligned_box< T, N >::ref_min_pnt(), and cgv::math::fvec< T, N >::set().
void cgv::render::performance_monitor::add_bar_item | ( | PerformanceMonitoringBar | item | ) |
add a bar item to the bar config
Definition at line 76 of file performance_monitor.cxx.
|
protected |
Definition at line 14 of file performance_monitor.cxx.
int cgv::render::performance_monitor::add_task | ( | const std::string & | name, |
const rgb & | col | ||
) |
add a new to me monitored item
Definition at line 94 of file performance_monitor.cxx.
Referenced by init_tasks().
void cgv::render::performance_monitor::clear_bar | ( | ) |
removes all items of the bar config and hides the bar
Definition at line 71 of file performance_monitor.cxx.
|
protected |
Definition at line 170 of file performance_monitor.cxx.
|
protected |
Definition at line 188 of file performance_monitor.cxx.
|
protected |
Definition at line 9 of file performance_monitor.cxx.
void cgv::render::performance_monitor::disable | ( | ) |
disable performance monitoring
Definition at line 43 of file performance_monitor.cxx.
void cgv::render::performance_monitor::enable | ( | ) |
enable performance monitoring
Definition at line 38 of file performance_monitor.cxx.
void cgv::render::performance_monitor::finish_frame | ( | ) |
finish measurement of a frame, if this is not called by hand, it is called automatically in the next call to start_frame.
Definition at line 135 of file performance_monitor.cxx.
References cgv::utils::stopwatch::get_elapsed_time().
Referenced by start_frame().
void cgv::render::performance_monitor::finish_task | ( | int | task_id | ) |
add a measurement for finishing given task
Definition at line 127 of file performance_monitor.cxx.
References cgv::utils::stopwatch::get_elapsed_time().
|
inline |
return the size of the buffer to store frame data
Definition at line 96 of file performance_monitor.h.
References cgv::media::axis_aligned_box< T, N >::get_extent().
Referenced by start_frame().
|
inline |
Definition at line 80 of file performance_monitor.h.
|
inline |
return the current frame id
Definition at line 100 of file performance_monitor.h.
|
inline |
return the number of display cycles to by drawn for the performance monitor
Definition at line 122 of file performance_monitor.h.
|
inline |
return placement of performance monitor
Definition at line 118 of file performance_monitor.h.
void cgv::render::performance_monitor::init_tasks | ( | ) |
initialize the list of tasks to one for the frame and one for each default rendering pass
Definition at line 56 of file performance_monitor.cxx.
References add_task().
Referenced by performance_monitor().
|
inline |
return whether performance monitoring is enabled
Definition at line 86 of file performance_monitor.h.
void cgv::render::performance_monitor::set_file_name | ( | const std::string & | _file_name | ) |
Definition at line 49 of file performance_monitor.cxx.
void cgv::render::performance_monitor::set_nr_display_cycles | ( | unsigned | _nr_cycles | ) |
set the number of display cycles to by drawn for the performance monitor
Definition at line 88 of file performance_monitor.cxx.
void cgv::render::performance_monitor::set_placement | ( | const ibox2 & | rectangle | ) |
place the performance monitor on screen in pixel coordinates
Definition at line 82 of file performance_monitor.cxx.
void cgv::render::performance_monitor::start_frame | ( | ) |
start performance measurement of a new frame
Definition at line 101 of file performance_monitor.cxx.
References finish_frame(), get_buffer_size(), cgv::utils::stopwatch::get_elapsed_time(), and cgv::utils::stopwatch::restart().
void cgv::render::performance_monitor::start_task | ( | int | task_id | ) |
add a measurement for starting given task
Definition at line 119 of file performance_monitor.cxx.
References cgv::utils::stopwatch::get_elapsed_time().
|
protected |
Definition at line 60 of file performance_monitor.h.
|
protected |
Definition at line 55 of file performance_monitor.h.
|
protected |
Definition at line 65 of file performance_monitor.h.
|
protected |
Definition at line 59 of file performance_monitor.h.
|
protected |
Definition at line 50 of file performance_monitor.h.
|
protected |
Definition at line 57 of file performance_monitor.h.
|
protected |
Definition at line 52 of file performance_monitor.h.
|
protected |
Definition at line 51 of file performance_monitor.h.
|
protected |
Definition at line 54 of file performance_monitor.h.
|
protected |
Definition at line 53 of file performance_monitor.h.
|
protected |
Definition at line 56 of file performance_monitor.h.
|
protected |
Definition at line 64 of file performance_monitor.h.
|
protected |
Definition at line 58 of file performance_monitor.h.
|
protected |
Definition at line 63 of file performance_monitor.h.
|
protected |
Definition at line 62 of file performance_monitor.h.