This is an abstract class that presents the interface for drawing a basic strip-chart, showing the relative value over an interval of time for several different collectors, differentiated by bands of color. More...
#include "pStatStripChart.h"
Public Member Functions | |
PStatStripChart (PStatMonitor *monitor, PStatView &view, int thread_index, int collector_index, int xsize, int ysize) | |
bool | first_data () const |
Returns true if the chart has seen its first data appear on it, false if it is still a virgin chart. More... | |
bool | get_average_mode () const |
Returns the current state of the average_mode flag. More... | |
int | get_collector_index () const |
Returns the particular collector whose data this strip chart reflects. More... | |
int | get_collector_under_pixel (int xpoint, int ypoint) |
Return the collector index associated with the particular band of color at the indicated pixel location, or -1 if no band of color was at the pixel. More... | |
double | get_horizontal_scale () const |
Returns the amount of total time the width of the horizontal axis represents. More... | |
bool | get_scroll_mode () const |
Returns the current state of the scroll_mode flag. More... | |
string | get_title_text () |
Returns the text suitable for the title label on the top line. More... | |
double | get_vertical_scale () const |
Returns total value the height of the vertical axis represents. More... | |
PStatView & | get_view () const |
Returns the View this chart represents. More... | |
int | height_to_pixel (double value) const |
Converts a value (i.e. More... | |
bool | is_title_unknown () const |
Returns true if get_title_text() has never yet returned an answer, false if it has. More... | |
void | new_data (int frame_number) |
Indicates that new data has become available. More... | |
double | pixel_to_height (int y) const |
Converts a vertical pixel offset to a value (a "height" in the strip chart). More... | |
double | pixel_to_timestamp (int x) const |
Converts a horizontal pixel offset to a timestamp. More... | |
void | set_auto_vertical_scale () |
Sets the vertical scale to make all the data visible. More... | |
void | set_average_mode (bool average_mode) |
Changes the average_mode flag. More... | |
void | set_collector_index (int collector_index) |
Changes the collector represented by this strip chart. More... | |
void | set_default_vertical_scale () |
Sets the vertical scale according to the suggested scale of the base collector, if any, or to center the target frame rate bar otherwise. More... | |
void | set_horizontal_scale (double time_width) |
Changes the amount of time the width of the horizontal axis represents. More... | |
void | set_scroll_mode (bool scroll_mode) |
Changes the scroll_mode flag. More... | |
void | set_vertical_scale (double value_height) |
Changes the value the height of the vertical axis represents. More... | |
int | timestamp_to_pixel (double time) const |
Converts a timestamp to a horizontal pixel offset. More... | |
void | update () |
Updates the chart with the latest data. More... | |
![]() | |
PStatGraph (PStatMonitor *monitor, int xsize, int ysize) | |
int | add_user_guide_bar (double height) |
Creates a new user guide bar and returns its index number. More... | |
int | find_user_guide_bar (double from_height, double to_height) const |
Returns the index number of the first user guide bar found whose height is within the indicated range, or -1 if no user guide bars fall within the range. More... | |
const GuideBar & | get_guide_bar (int n) const |
Returns the nth horizontal guide bar. More... | |
const string & | get_guide_bar_unit_name () const |
Returns the name of the units to be used for the guide bars if the units type is set to GBU_named | GBU_show_units. More... | |
int | get_guide_bar_units () const |
Returns the units that are displayed for the guide bar labels. More... | |
int | get_label_collector (int n) const |
Returns the collector index associated with the nth label. More... | |
LRGBColor | get_label_color (int n) const |
Returns the color associated with the nth label. More... | |
string | get_label_name (int n) const |
Returns the text associated with the nth label. More... | |
PStatMonitor * | get_monitor () const |
Returns the monitor associated with this chart. More... | |
int | get_num_guide_bars () const |
Returns the number of horizontal guide bars that should be drawn, based on the indicated target frame rate. More... | |
int | get_num_labels () const |
Returns the number of labels to be drawn for this chart. More... | |
int | get_num_user_guide_bars () const |
Returns the current number of user-defined guide bars. More... | |
double | get_target_frame_rate () const |
Returns the indicated target frame rate in Hz. More... | |
GuideBar | get_user_guide_bar (int n) const |
Returns the nth user-defined guide bar. More... | |
int | get_xsize () const |
Returns the width of the chart in pixels. More... | |
int | get_ysize () const |
Returns the height of the chart in pixels. More... | |
void | move_user_guide_bar (int n, double height) |
Adjusts the height of the nth user-defined guide bar. More... | |
void | remove_user_guide_bar (int n) |
Removes the user guide bar with the indicated index number. More... | |
void | set_guide_bar_unit_name (const string &unit_name) |
Sets the name of the units to be used for the guide bars if the units type is set to GBU_named | GBU_show_units. More... | |
void | set_guide_bar_units (int unit_mask) |
Sets the units that are displayed for the guide bar labels. More... | |
void | set_target_frame_rate (double frame_rate) |
Sets the target frame rate of the application in Hz. More... | |
Additional Inherited Members | |
![]() | |
enum | GuideBarStyle { GBS_normal, GBS_target, GBS_user } |
enum | GuideBarUnits { GBU_hz = 0x0001, GBU_ms = 0x0002, GBU_named = 0x0004, GBU_show_units = 0x0008 } |
![]() | |
static string | format_number (double value) |
Returns a string representing the value nicely formatted for its range. More... | |
static string | format_number (double value, int guide_bar_units, const string &unit_name=string()) |
Returns a string representing the value nicely formatted for its range, including the units as indicated. More... | |
This is an abstract class that presents the interface for drawing a basic strip-chart, showing the relative value over an interval of time for several different collectors, differentiated by bands of color.
This class just manages all the strip-chart logic; the actual nuts and bolts of drawing pixels is left to a user-derived class.
Definition at line 42 of file pStatStripChart.h.
bool PStatStripChart::first_data | ( | ) | const |
Returns true if the chart has seen its first data appear on it, false if it is still a virgin chart.
Definition at line 135 of file pStatStripChart.cxx.
|
inline |
Returns the current state of the average_mode flag.
When true, the strip chart will average out the color values over pstats_average_time seconds, which hides spikes and makes the overall trends easier to read. When false, the strip chart shows the actual data as it is happening.
Definition at line 151 of file pStatStripChart.I.
|
inline |
Returns the particular collector whose data this strip chart reflects.
Definition at line 33 of file pStatStripChart.I.
Referenced by GtkStatsStripChart::clicked_label(), and WinStatsStripChart::clicked_label().
int PStatStripChart::get_collector_under_pixel | ( | int | xpoint, |
int | ypoint | ||
) |
Return the collector index associated with the particular band of color at the indicated pixel location, or -1 if no band of color was at the pixel.
Definition at line 219 of file pStatStripChart.cxx.
References PStatThreadData::get_frame_number_at_time(), PStatView::get_thread_data(), PStatGraph::get_ysize(), height_to_pixel(), and pixel_to_timestamp().
|
inline |
Returns the amount of total time the width of the horizontal axis represents.
Definition at line 62 of file pStatStripChart.I.
|
inline |
Returns the current state of the scroll_mode flag.
When true, the strip chart will update itself by scrolling to the left; when false, the strip chart will wrap around at the right and restart at the left end without scrolling.
Definition at line 118 of file pStatStripChart.I.
string PStatStripChart::get_title_text | ( | ) |
Returns the text suitable for the title label on the top line.
Definition at line 276 of file pStatStripChart.cxx.
References PStatClientData::get_collector_def(), PStatClientData::get_collector_fullname(), PStatView::get_show_level(), PStatClientData::get_thread_name(), PStatClientData::has_collector(), and PStatClientData::has_thread().
Referenced by GtkStatsStripChart::new_data(), and WinStatsStripChart::new_data().
|
inline |
Returns total value the height of the vertical axis represents.
Definition at line 88 of file pStatStripChart.I.
|
inline |
Returns the View this chart represents.
Definition at line 22 of file pStatStripChart.I.
Referenced by GtkStatsStripChart::clicked_label(), and WinStatsStripChart::clicked_label().
|
inline |
Converts a value (i.e.
a "height" in the strip chart) to a vertical pixel offset.
Definition at line 182 of file pStatStripChart.I.
References PStatGraph::get_ysize().
Referenced by get_collector_under_pixel().
bool PStatStripChart::is_title_unknown | ( | ) | const |
Returns true if get_title_text() has never yet returned an answer, false if it has.
Definition at line 314 of file pStatStripChart.cxx.
Referenced by GtkStatsStripChart::new_data(), and WinStatsStripChart::new_data().
void PStatStripChart::new_data | ( | int | frame_number | ) |
Indicates that new data has become available.
Definition at line 77 of file pStatStripChart.cxx.
|
inline |
Converts a vertical pixel offset to a value (a "height" in the strip chart).
Definition at line 193 of file pStatStripChart.I.
References PStatGraph::get_ysize().
|
inline |
Converts a horizontal pixel offset to a timestamp.
Definition at line 171 of file pStatStripChart.I.
References PStatGraph::get_xsize().
Referenced by get_collector_under_pixel(), and set_auto_vertical_scale().
void PStatStripChart::set_auto_vertical_scale | ( | ) |
Sets the vertical scale to make all the data visible.
Definition at line 185 of file pStatStripChart.cxx.
References PStatThreadData::get_frame_number_at_time(), PStatView::get_thread_data(), PStatThreadData::has_frame(), pixel_to_timestamp(), and set_vertical_scale().
|
inline |
Changes the average_mode flag.
When true, the strip chart will average out the color values over pstats_average_time seconds, which hides spikes and makes the overall trends easier to read. When false, the strip chart shows the actual data as it is happening.
Definition at line 133 of file pStatStripChart.I.
void PStatStripChart::set_collector_index | ( | int | collector_index | ) |
Changes the collector represented by this strip chart.
This may force a redraw.
Definition at line 146 of file pStatStripChart.cxx.
Referenced by GtkStatsStripChart::clicked_label(), and WinStatsStripChart::clicked_label().
void PStatStripChart::set_default_vertical_scale | ( | ) |
Sets the vertical scale according to the suggested scale of the base collector, if any, or to center the target frame rate bar otherwise.
Definition at line 165 of file pStatStripChart.cxx.
References PStatClientData::get_collector_def(), PStatGraph::get_target_frame_rate(), PStatClientData::has_collector(), and set_vertical_scale().
|
inline |
Changes the amount of time the width of the horizontal axis represents.
This may force a redraw.
Definition at line 44 of file pStatStripChart.I.
Referenced by GtkStatsStripChart::set_scroll_speed(), and WinStatsStripChart::set_scroll_speed().
|
inline |
Changes the scroll_mode flag.
When true, the strip chart will update itself by scrolling to the left; when false, the strip chart will wrap around at the right and restart at the left end without scrolling.
Definition at line 101 of file pStatStripChart.I.
|
inline |
Changes the value the height of the vertical axis represents.
This may force a redraw.
Definition at line 73 of file pStatStripChart.I.
Referenced by set_auto_vertical_scale(), set_default_vertical_scale(), WinStatsStripChart::set_vertical_scale(), and GtkStatsStripChart::set_vertical_scale().
|
inline |
Converts a timestamp to a horizontal pixel offset.
Definition at line 161 of file pStatStripChart.I.
References PStatGraph::get_xsize().
void PStatStripChart::update | ( | ) |
Updates the chart with the latest data.
Definition at line 90 of file pStatStripChart.cxx.
References PStatMonitor::get_client_data(), PStatThreadData::get_frame(), PStatThreadData::get_latest_frame_number(), PStatView::get_level_index(), PStatGraph::get_monitor(), PStatClientData::get_num_collectors(), PStatClientData::get_num_threads(), PStatFrameData::get_start(), PStatView::get_thread_data(), and PStatThreadData::is_empty().
Referenced by GtkStatsStripChart::new_data(), and WinStatsStripChart::new_data().