cgv
Loading...
Searching...
No Matches
cgv::render::performance_monitor Class Reference

This class allows to monitor the performance of a set of tasks that are repeatedly executed over time. More...

#include <performance_monitor.h>

Inheritance diagram for cgv::render::performance_monitor:
cgv::render::gl::gl_performance_monitor

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

Detailed Description

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.

Member Typedef Documentation

◆ frame_data

typedef std::vector<performance_measurement> cgv::render::performance_monitor::frame_data

Definition at line 45 of file performance_monitor.h.

Constructor & Destructor Documentation

◆ performance_monitor()

cgv::render::performance_monitor::performance_monitor ( )

construct performance monitor with standard configuration

Definition at line 19 of file performance_monitor.cxx.

References init_tasks().

Member Function Documentation

◆ add_bar_item()

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.

◆ add_measurement()

void cgv::render::performance_monitor::add_measurement ( const performance_measurement & pm)
protected

Definition at line 14 of file performance_monitor.cxx.

◆ add_task()

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().

◆ clear_bar()

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.

◆ compute_colors()

void cgv::render::performance_monitor::compute_colors ( const frame_data & fdata)
protected

Definition at line 170 of file performance_monitor.cxx.

◆ compute_positions()

void cgv::render::performance_monitor::compute_positions ( int x,
int y,
int dx,
int dy,
const frame_data & fdata )
protected

Definition at line 188 of file performance_monitor.cxx.

◆ current_frame()

performance_monitor::frame_data & cgv::render::performance_monitor::current_frame ( )
protected

Definition at line 9 of file performance_monitor.cxx.

◆ disable()

void cgv::render::performance_monitor::disable ( )

disable performance monitoring

Definition at line 43 of file performance_monitor.cxx.

◆ enable()

void cgv::render::performance_monitor::enable ( )

enable performance monitoring

Definition at line 38 of file performance_monitor.cxx.

◆ finish_frame()

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.

Referenced by start_frame().

◆ finish_task()

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.

◆ get_buffer_size()

unsigned cgv::render::performance_monitor::get_buffer_size ( ) const
inline

return the size of the buffer to store frame data

Definition at line 96 of file performance_monitor.h.

Referenced by start_frame().

◆ get_file_name()

const std::string & cgv::render::performance_monitor::get_file_name ( ) const
inline

Definition at line 80 of file performance_monitor.h.

◆ get_frame_id()

unsigned cgv::render::performance_monitor::get_frame_id ( ) const
inline

return the current frame id

Definition at line 100 of file performance_monitor.h.

◆ get_nr_display_cycles()

unsigned cgv::render::performance_monitor::get_nr_display_cycles ( ) const
inline

return the number of display cycles to by drawn for the performance monitor

Definition at line 122 of file performance_monitor.h.

◆ get_placement()

ibox2 cgv::render::performance_monitor::get_placement ( ) const
inline

return placement of performance monitor

Definition at line 118 of file performance_monitor.h.

◆ init_tasks()

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().

◆ is_enabled()

bool cgv::render::performance_monitor::is_enabled ( ) const
inline

return whether performance monitoring is enabled

Definition at line 86 of file performance_monitor.h.

◆ set_file_name()

void cgv::render::performance_monitor::set_file_name ( const std::string & _file_name)

Definition at line 49 of file performance_monitor.cxx.

◆ set_nr_display_cycles()

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.

◆ set_placement()

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.

◆ start_frame()

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(), and get_buffer_size().

◆ start_task()

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.

Member Data Documentation

◆ bar_config

std::vector<PerformanceMonitoringBar> cgv::render::performance_monitor::bar_config
protected

Definition at line 60 of file performance_monitor.h.

◆ bar_line_width

int cgv::render::performance_monitor::bar_line_width
protected

Definition at line 55 of file performance_monitor.h.

◆ colors

std::vector<rgb> cgv::render::performance_monitor::colors
protected

Definition at line 65 of file performance_monitor.h.

◆ data

std::deque<frame_data> cgv::render::performance_monitor::data
protected

Definition at line 59 of file performance_monitor.h.

◆ enabled

bool cgv::render::performance_monitor::enabled
protected

Definition at line 50 of file performance_monitor.h.

◆ file_name

std::string cgv::render::performance_monitor::file_name
protected

Definition at line 57 of file performance_monitor.h.

◆ fps

double cgv::render::performance_monitor::fps
protected

Definition at line 52 of file performance_monitor.h.

◆ fps_alpha

double cgv::render::performance_monitor::fps_alpha
protected

Definition at line 51 of file performance_monitor.h.

◆ nr_display_cycles

int cgv::render::performance_monitor::nr_display_cycles
protected

Definition at line 54 of file performance_monitor.h.

◆ placement

ibox2 cgv::render::performance_monitor::placement
protected

Definition at line 53 of file performance_monitor.h.

◆ plot_color

rgb cgv::render::performance_monitor::plot_color
protected

Definition at line 56 of file performance_monitor.h.

◆ positions

std::vector<ivec2> cgv::render::performance_monitor::positions
protected

Definition at line 64 of file performance_monitor.h.

◆ tasks

std::vector<performance_task> cgv::render::performance_monitor::tasks
protected

Definition at line 58 of file performance_monitor.h.

◆ time_scale

float cgv::render::performance_monitor::time_scale
protected

Definition at line 63 of file performance_monitor.h.

◆ watch

cgv::utils::stopwatch cgv::render::performance_monitor::watch
protected

Definition at line 62 of file performance_monitor.h.


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