Panda3D
|
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. | |
bool | get_average_mode () const |
Returns the current state of the average_mode flag. | |
int | get_collector_index () const |
Returns the particular collector whose data this strip chart reflects. | |
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. | |
double | get_horizontal_scale () const |
Returns the amount of total time the width of the horizontal axis represents. | |
bool | get_scroll_mode () const |
Returns the current state of the scroll_mode flag. | |
std::string | get_title_text () |
Returns the text suitable for the title label on the top line. | |
std::string | get_total_text () |
Returns the text suitable for the total label above the graph. | |
double | get_vertical_scale () const |
Returns total value the height of the vertical axis represents. | |
PStatView & | get_view () const |
Returns the View this chart represents. | |
int | height_to_pixel (double value) const |
Converts a value (i.e. | |
bool | is_title_unknown () const |
Returns true if get_title_text() has never yet returned an answer, false if it has. | |
void | new_data (int frame_number) |
Indicates that new data has become available. | |
double | pixel_to_height (int y) const |
Converts a vertical pixel offset to a value (a "height" in the strip chart). | |
double | pixel_to_timestamp (int x) const |
Converts a horizontal pixel offset to a timestamp. | |
void | set_auto_vertical_scale () |
Sets the vertical scale to make all the data visible. | |
void | set_average_mode (bool average_mode) |
Changes the average_mode flag. | |
void | set_collector_index (int collector_index) |
Changes the collector represented by this strip chart. | |
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. | |
void | set_horizontal_scale (double time_width) |
Changes the amount of time the width of the horizontal axis represents. | |
void | set_scroll_mode (bool scroll_mode) |
Changes the scroll_mode flag. | |
void | set_vertical_scale (double value_height) |
Changes the value the height of the vertical axis represents. | |
int | timestamp_to_pixel (double time) const |
Converts a timestamp to a horizontal pixel offset. | |
void | update () |
Updates the chart with the latest data. | |
![]() | |
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. | |
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. | |
const GuideBar & | get_guide_bar (int n) const |
Returns the nth horizontal guide bar. | |
const std::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. | |
int | get_guide_bar_units () const |
Returns the units that are displayed for the guide bar labels. | |
int | get_label_collector (int n) const |
Returns the collector index associated with the nth label. | |
LRGBColor | get_label_color (int n) const |
Returns the color associated with the nth label. | |
std::string | get_label_name (int n) const |
Returns the text associated with the nth label. | |
PStatMonitor * | get_monitor () const |
Returns the monitor associated with this chart. | |
int | get_num_guide_bars () const |
Returns the number of horizontal guide bars that should be drawn, based on the indicated target frame rate. | |
int | get_num_labels () const |
Returns the number of labels to be drawn for this chart. | |
int | get_num_user_guide_bars () const |
Returns the current number of user-defined guide bars. | |
double | get_target_frame_rate () const |
Returns the indicated target frame rate in Hz. | |
GuideBar | get_user_guide_bar (int n) const |
Returns the nth user-defined guide bar. | |
int | get_xsize () const |
Returns the width of the chart in pixels. | |
int | get_ysize () const |
Returns the height of the chart in pixels. | |
void | move_user_guide_bar (int n, double height) |
Adjusts the height of the nth user-defined guide bar. | |
void | remove_user_guide_bar (int n) |
Removes the user guide bar with the indicated index number. | |
void | set_guide_bar_unit_name (const std::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. | |
void | set_guide_bar_units (int unit_mask) |
Sets the units that are displayed for the guide bar labels. | |
void | set_target_frame_rate (double frame_rate) |
Sets the target frame rate of the application in Hz. | |
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 std::string | format_number (double value) |
Returns a string representing the value nicely formatted for its range. | |
static std::string | format_number (double value, int guide_bar_units, const std::string &unit_name=std::string()) |
Returns a string representing the value nicely formatted for its range, including the units as indicated. | |
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 38 of file pStatStripChart.h.
PStatStripChart::PStatStripChart | ( | PStatMonitor * | monitor, |
PStatView & | view, | ||
int | thread_index, | ||
int | collector_index, | ||
int | xsize, | ||
int | ysize ) |
Definition at line 31 of file pStatStripChart.cxx.
|
virtual |
Definition at line 65 of file pStatStripChart.cxx.
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 126 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 120 of file pStatStripChart.I.
|
inline |
Returns the particular collector whose data this strip chart reflects.
Definition at line 25 of file pStatStripChart.I.
Referenced by WinStatsStripChart::clicked_label(), and get_total_text().
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 200 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 50 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 95 of file pStatStripChart.I.
std::string PStatStripChart::get_title_text | ( | ) |
Returns the text suitable for the title label on the top line.
Definition at line 254 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 WinStatsStripChart::new_data().
std::string PStatStripChart::get_total_text | ( | ) |
Returns the text suitable for the total label above the graph.
Definition at line 289 of file pStatStripChart.cxx.
References PStatGraph::format_number(), get_collector_index(), PStatViewLevel::get_count(), PStatGraph::get_guide_bar_unit_name(), PStatGraph::get_guide_bar_units(), PStatView::get_level(), and PStatView::get_show_level().
Referenced by WinStatsStripChart::new_data().
|
inline |
Returns total value the height of the vertical axis represents.
Definition at line 71 of file pStatStripChart.I.
|
inline |
Returns the View this chart represents.
Definition at line 17 of file pStatStripChart.I.
Referenced by WinStatsStripChart::clicked_label().
|
inline |
Converts a value (i.e.
a "height" in the strip chart) to a vertical pixel offset.
Definition at line 145 of file pStatStripChart.I.
References PStatGraph::get_ysize().
Referenced by get_collector_under_pixel().
|
inline |
Returns true if get_title_text() has never yet returned an answer, false if it has.
Definition at line 163 of file pStatStripChart.I.
Referenced by WinStatsStripChart::new_data().
void PStatStripChart::new_data | ( | int | frame_number | ) |
Indicates that new data has become available.
Definition at line 72 of file pStatStripChart.cxx.
|
inline |
Converts a vertical pixel offset to a value (a "height" in the strip chart).
Definition at line 154 of file pStatStripChart.I.
References PStatGraph::get_ysize().
|
inline |
Converts a horizontal pixel offset to a timestamp.
Definition at line 136 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 169 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 106 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 135 of file pStatStripChart.cxx.
Referenced by 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 151 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 34 of file pStatStripChart.I.
Referenced by 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 81 of file pStatStripChart.I.
|
inline |
Changes the value the height of the vertical axis represents.
This may force a redraw.
Definition at line 59 of file pStatStripChart.I.
Referenced by set_auto_vertical_scale(), set_default_vertical_scale(), and WinStatsStripChart::set_vertical_scale().
|
inline |
Converts a timestamp to a horizontal pixel offset.
Definition at line 128 of file pStatStripChart.I.
References PStatGraph::get_xsize().
void PStatStripChart::update | ( | ) |
Updates the chart with the latest data.
Definition at line 83 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 WinStatsStripChart::new_data().