#include <pStatStripChart.h>
Inheritance diagram for PStatStripChart:
Public Types | |
enum | GuideBarUnits { GBU_hz = 0x0001, GBU_ms = 0x0002, GBU_named = 0x0004, GBU_show_units = 0x0008 } |
Public Member Functions | |
PStatStripChart (PStatMonitor *monitor, PStatView &view, int collector_index, int xsize, int ysize) | |
virtual | ~PStatStripChart () |
void | new_data (int frame_number) |
Indicates that new data has become available. | |
void | update () |
Updates the chart with the latest data. | |
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. | |
PStatView & | get_view () const |
Returns the View this chart represents. | |
int | get_collector_index () const |
Returns the particular collector whose data this strip chart reflects. | |
void | set_horizontal_scale (float time_width) |
Changes the amount of time the width of the horizontal axis represents. | |
float | get_horizontal_scale () const |
Returns the amount of total time the width of the horizontal axis represents. | |
void | set_vertical_scale (float value_height) |
Changes the value the height of the vertical axis represents. | |
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_auto_vertical_scale () |
Sets the vertical scale to make all the data visible. | |
float | get_vertical_scale () const |
Returns total value the height of the vertical axis represents. | |
void | set_scroll_mode (bool scroll_mode) |
Changes the scroll_mode flag. | |
bool | get_scroll_mode () const |
Returns the current state of the scroll_mode flag. | |
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. | |
int | timestamp_to_pixel (float time) const |
Converts a timestamp to a horizontal pixel offset. | |
float | pixel_to_timestamp (int x) const |
Converts a horizontal pixel offset to a timestamp. | |
int | height_to_pixel (float value) const |
Converts a value (i.e. | |
float | pixel_to_height (int y) const |
Converts a vertical pixel offset to a value (a "height" in the strip chart). | |
PStatMonitor * | get_monitor () const |
Returns the monitor associated with this chart. | |
int | get_num_labels () const |
Returns the number of labels to be drawn for this chart. | |
int | get_label_collector (int n) const |
Returns the collector index associated with the nth label. | |
string | get_label_name (int n) const |
Returns the text associated with the nth label. | |
RGBColorf | get_label_color (int n) const |
Returns the color associated with the nth label. | |
void | set_target_frame_rate (float frame_rate) |
Sets the target frame rate of the application in Hz. | |
float | get_target_frame_rate () const |
Returns the indicated target frame rate in Hz. | |
int | get_xsize () const |
Returns the width of the chart in pixels. | |
int | get_ysize () const |
Returns the height of the chart in pixels. | |
int | get_num_guide_bars () const |
Returns the number of horizontal guide bars that should be drawn, based on the indicated target frame rate. | |
const GuideBar & | get_guide_bar (int n) const |
Returns the nth horizontal guide bar. | |
void | set_guide_bar_units (int unit_mask) |
Sets the units that are displayed for the guide bar labels. | |
int | get_guide_bar_units () const |
Returns the units that are displayed for the guide bar labels. | |
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. | |
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. | |
Static Public Member Functions | |
string | format_number (float value) |
Returns a string representing the value nicely formatted for its range. | |
string | format_number (float 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. | |
Protected Types | |
typedef pvector< ColorData > | FrameData |
typedef pmap< int, FrameData > | Data |
typedef vector_int | Labels |
typedef pvector< GuideBar > | GuideBars |
Protected Member Functions | |
const FrameData & | get_frame_data (int frame_number) |
Returns the cached FrameData associated with the given frame number. | |
void | changed_size (int xsize, int ysize) |
To be called by the user class when the widget size has changed. | |
void | force_redraw () |
To be called by the user class when the whole thing needs to be redrawn for some reason. | |
void | force_reset () |
To be called by the user class to cause the chart to reset to empty and start filling again. | |
void | update_labels () |
Resets the list of labels. | |
virtual void | normal_guide_bars () |
Calls update_guide_bars with parameters suitable to this kind of graph. | |
virtual void | clear_region () |
Should be overridden by the user class to wipe out the entire strip chart region. | |
virtual void | copy_region (int start_x, int end_x, int dest_x) |
Should be overridden by the user class to copy a region of the chart from one part of the chart to another. | |
virtual void | begin_draw (int from_x, int to_x) |
Should be overridden by the user class. | |
virtual void | draw_slice (int x, int frame_number) |
Should be overridden by the user class to draw a single vertical slice in the strip chart at the indicated pixel, with the data for the indicated frame. | |
virtual void | draw_empty (int x) |
This is similar to draw_slice(), except it should draw a vertical line of the background color to represent a portion of the chart that has no data. | |
virtual void | draw_cursor (int x) |
This is similar to draw_slice(), except that it should draw the black vertical stripe that represents the current position when not in scrolling mode. | |
virtual void | end_draw (int from_x, int to_x) |
Should be overridden by the user class. | |
virtual void | idle () |
Should be overridden by the user class to perform any other updates might be necessary after the color bars have been redrawn. | |
void | update_guide_bars (int num_bars, float scale) |
Resets the list of guide bars. | |
GuideBar | make_guide_bar (float value) const |
Makes a guide bar for the indicated elapsed time or level units. | |
Protected Attributes | |
bool | _labels_changed |
bool | _guide_bars_changed |
PointerTo< PStatMonitor > | _monitor |
float | _target_frame_rate |
int | _xsize |
int | _ysize |
Labels | _labels |
GuideBars | _guide_bars |
int | _guide_bar_units |
string | _unit_name |
Private Member Functions | |
void | draw_frames (int first_frame, int last_frame) |
Draws the levels for the indicated frame range. | |
void | draw_pixels (int first_pixel, int last_pixel) |
Draws the levels for the indicated pixel range. | |
Private Attributes | |
PStatView & | _view |
int | _collector_index |
bool | _scroll_mode |
Data | _data |
int | _next_frame |
bool | _first_data |
int | _cursor_pixel |
int | _level_index |
float | _time_width |
float | _start_time |
float | _value_height |
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 59 of file pStatStripChart.h.
|
Definition at line 95 of file pStatStripChart.h. |
|
Definition at line 94 of file pStatStripChart.h. |
|
Definition at line 115 of file pStatGraph.h. |
|
Definition at line 112 of file pStatGraph.h. |
|
Definition at line 76 of file pStatGraph.h. |
|
|
Definition at line 79 of file pStatStripChart.cxx. References _next_frame. |
|
Should be overridden by the user class. This hook will be called before drawing any color bars in the strip chart; it gives the pixel range that's about to be redrawn. Definition at line 440 of file pStatStripChart.cxx. References SortCollectorLabels2::_client_data, PStatCollectorDef::_sort, PStatClientData::get_collector_def(), SortCollectorLabels2::operator()(), and SortCollectorLabels2::SortCollectorLabels2(). |
|
To be called by the user class when the widget size has changed. This updates the chart's internal data and causes it to issue redraw commands to reflect the new size. Definition at line 335 of file pStatStripChart.cxx. References _first_data, and clear_region(). |
|
Should be overridden by the user class to wipe out the entire strip chart region.
Reimplemented in GtkStatsStripChart. Definition at line 406 of file pStatStripChart.cxx. Referenced by changed_size(). |
|
Should be overridden by the user class to copy a region of the chart from one part of the chart to another. This is used to implement scrolling. Reimplemented in GtkStatsStripChart. Definition at line 422 of file pStatStripChart.cxx. |
|
This is similar to draw_slice(), except that it should draw the black vertical stripe that represents the current position when not in scrolling mode.
Reimplemented in GtkStatsStripChart. Definition at line 496 of file pStatStripChart.cxx. References _cursor_pixel, _start_time, _time_width, _view, PStatThreadData::get_frame(), PStatThreadData::get_latest_frame_number(), PStatFrameData::get_start(), and PStatView::get_thread_data(). |
|
This is similar to draw_slice(), except it should draw a vertical line of the background color to represent a portion of the chart that has no data.
Reimplemented in GtkStatsStripChart. Definition at line 480 of file pStatStripChart.cxx. References _level_index, and _view. |
|
Draws the levels for the indicated frame range.
Definition at line 608 of file pStatStripChart.cxx. Referenced by new_data(). |
|
Draws the levels for the indicated pixel range.
Definition at line 683 of file pStatStripChart.cxx. Referenced by get_frame_data(). |
|
Should be overridden by the user class to draw a single vertical slice in the strip chart at the indicated pixel, with the data for the indicated frame. Call get_frame_data() to get the actual color data for the given frame_number. This call will only be made between a corresponding call to begin_draw() and end_draw(). Reimplemented in GtkStatsStripChart. Definition at line 464 of file pStatStripChart.cxx. References PStatGraph::_labels. |
|
Should be overridden by the user class. This hook will be called after drawing a series of color bars in the strip chart; it gives the pixel range that was just redrawn. Reimplemented in GtkStatsStripChart. Definition at line 514 of file pStatStripChart.cxx. |
|
Returns true if the chart has seen its first data appear on it, false if it is still a virgin chart.
Definition at line 155 of file pStatStripChart.cxx. References PStatCollectorDef::_suggested_scale, and set_vertical_scale(). |
|
To be called by the user class when the whole thing needs to be redrawn for some reason.
Definition at line 372 of file pStatStripChart.cxx. |
|
To be called by the user class to cause the chart to reset to empty and start filling again.
Definition at line 389 of file pStatStripChart.cxx. Referenced by get_collector_index(). |
|
Returns a string representing the value nicely formatted for its range, including the units as indicated.
Definition at line 182 of file pStatGraph.cxx. |
|
Returns a string representing the value nicely formatted for its range.
Definition at line 151 of file pStatGraph.cxx. References PStatGraph::GBU_show_units. Referenced by PStatGraph::update_guide_bars(). |
|
Returns the particular collector whose data this strip chart reflects.
Definition at line 47 of file pStatStripChart.I. References _start_time, _time_width, force_reset(), and INLINE. |
|
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 241 of file pStatStripChart.cxx. References PStatStripChart::ColorData::_collector_index, _collector_index, _data, PStatStripChart::ColorData::_net_value, _view, PStatViewLevel::get_child(), PStatViewLevel::get_collector(), PStatThreadData::get_frame(), PStatView::get_level(), PStatViewLevel::get_net_value(), PStatViewLevel::get_num_children(), PStatView::get_thread_data(), PStatViewLevel::get_value_alone(), and PStatView::set_to_frame(). Referenced by GtkStatsStripChart::configure_event_impl(). |
|
Returns the cached FrameData associated with the given frame number. This describes the lengths of the color bands for a single vertical stripe in the chart. Definition at line 284 of file pStatStripChart.cxx. References _cursor_pixel, _first_data, _start_time, _time_width, PStatGraph::_xsize, PStatGraph::_ysize, and draw_pixels(). Referenced by GtkStatsStripChart::copy_region(), and set_default_vertical_scale(). |
|
Returns the nth horizontal guide bar. This should be drawn as a horizontal line across the chart at the y pixel location determined by height_to_pixel(bar._height). It is possible that this bar will be off the top of the chart. Definition at line 131 of file pStatGraph.cxx. |
|
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.
Definition at line 223 of file pStatGraph.I. |
|
Returns the units that are displayed for the guide bar labels. This may be a union of one or more members of the GuideBarUnits enum. Definition at line 189 of file pStatGraph.I. |
|
Returns the amount of total time the width of the horizontal axis represents.
Definition at line 84 of file pStatStripChart.I. References _value_height, and INLINE. |
|
Returns the collector index associated with the nth label.
Definition at line 62 of file pStatGraph.I. Referenced by GtkStatsPianoRoll::begin_draw(). |
|
Returns the color associated with the nth label.
Definition at line 90 of file pStatGraph.I. References PStatGraph::_target_frame_rate, and INLINE. |
|
Returns the text associated with the nth label.
Definition at line 76 of file pStatGraph.I. References PStatGraph::_target_frame_rate, INLINE, and PStatGraph::normal_guide_bars(). |
|
Returns the monitor associated with this chart.
Definition at line 32 of file pStatGraph.I. References PStatGraph::_labels, and INLINE. Referenced by GtkStatsStripChart::get_labels(), and new_data(). |
|
Returns the number of horizontal guide bars that should be drawn, based on the indicated target frame rate. Not all of these may be visible; some may be off the top of the chart because of the vertical scale. Definition at line 108 of file pStatGraph.cxx. References PStatGraph::_guide_bars. |
|
Returns the number of labels to be drawn for this chart.
Definition at line 47 of file pStatGraph.I. References PStatGraph::_labels, INLINE, and nassertr. |
|
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 161 of file pStatStripChart.I. References _value_height, PStatGraph::get_ysize(), INLINE, and x. |
|
Returns the indicated target frame rate in Hz. Definition at line 126 of file pStatGraph.I. References PStatGraph::_guide_bar_units, INLINE, and PStatGraph::normal_guide_bars(). |
|
Returns total value the height of the vertical axis represents.
Definition at line 118 of file pStatStripChart.I. References _scroll_mode, and INLINE. Referenced by GtkStatsStripChart::copy_region(). |
|
Returns the View this chart represents.
Definition at line 32 of file pStatStripChart.I. References _collector_index, and INLINE. |
|
Returns the width of the chart in pixels.
Definition at line 139 of file pStatGraph.I. References PStatGraph::_guide_bar_units, and INLINE. Referenced by GtkStatsStripChart::end_draw(), GtkStatsStripChart::get_collector_gc(), GtkStatsStripWindow::menu_hscale(), and set_scroll_mode(). |
|
Returns the height of the chart in pixels.
Definition at line 152 of file pStatGraph.I. References PStatGraph::_unit_name, and INLINE. Referenced by GtkStatsStripChart::copy_region(), GtkStatsStripChart::draw_slice(), GtkStatsStripChart::end_draw(), GtkStatsStripChart::get_collector_gc(), get_scroll_mode(), and GtkStatsStripWindow::menu_hscale(). |
|
Converts a value (i.e. a "height" in the strip chart) to a vertical pixel offset. Definition at line 202 of file pStatStripChart.I. Referenced by GtkStatsStripChart::copy_region(). |
|
Should be overridden by the user class to perform any other updates might be necessary after the color bars have been redrawn. For instance, it could check the state of _labels_changed, and redraw the labels if it is true. Reimplemented in GtkStatsStripChart. Definition at line 534 of file pStatStripChart.cxx. References _start_time, _time_width, and PStatGraph::_xsize. |
|
Makes a guide bar for the indicated elapsed time or level units.
Definition at line 289 of file pStatGraph.cxx. |
|
Indicates that new data has become available.
Definition at line 91 of file pStatStripChart.cxx. References _next_frame, _view, draw_frames(), PStatMonitor::get_client_data(), PStatThreadData::get_latest_frame_number(), PStatGraph::get_monitor(), PStatClientData::get_num_collectors(), PStatClientData::get_num_threads(), PStatView::get_thread_data(), and PStatThreadData::is_empty(). |
|
Calls update_guide_bars with parameters suitable to this kind of graph.
Implements PStatGraph. Definition at line 594 of file pStatStripChart.cxx. |
|
Converts a vertical pixel offset to a value (a "height" in the strip chart).
Definition at line 217 of file pStatStripChart.I. |
|
Converts a horizontal pixel offset to a timestamp.
Definition at line 187 of file pStatStripChart.I. Referenced by set_default_vertical_scale(). |
|
Sets the vertical scale to make all the data visible.
Definition at line 195 of file pStatStripChart.cxx. References set_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 172 of file pStatStripChart.cxx. References PStatStripChart::ColorData::_net_value, PStatGraph::_xsize, get_frame_data(), PStatThreadData::get_frame_number_at_time(), PStatThreadData::has_frame(), pixel_to_timestamp(), and x. Referenced by PStatStripChart(). |
|
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.
Definition at line 206 of file pStatGraph.I. |
|
Sets the units that are displayed for the guide bar labels. This may be a union of one or more members of the GuideBarUnits enum. Definition at line 169 of file pStatGraph.I. References PStatGraph::_unit_name. |
|
Changes the amount of time the width of the horizontal axis represents. This may force a redraw. Definition at line 62 of file pStatStripChart.I. References _time_width, and 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 137 of file pStatStripChart.I. References _start_time, _time_width, PStatGraph::get_xsize(), INLINE, and x. |
|
Sets the target frame rate of the application in Hz. This only affects the choice of initial scale and the placement of guide bars. Definition at line 108 of file pStatGraph.I. References PStatGraph::_xsize. |
|
Changes the value the height of the vertical axis represents. This may force a redraw. Definition at line 99 of file pStatStripChart.I. References _first_data, _scroll_mode, and INLINE. Referenced by first_data(), GtkStatsStripWindow::menu_new_window(), and set_auto_vertical_scale(). |
|
Converts a timestamp to a horizontal pixel offset.
Definition at line 174 of file pStatStripChart.I. |
|
Updates the chart with the latest data.
Definition at line 107 of file pStatStripChart.cxx. |
|
Resets the list of guide bars.
Definition at line 247 of file pStatGraph.cxx. References PStatGraph::_guide_bar_units, PStatGraph::_target_frame_rate, PStatGraph::_unit_name, PStatGraph::format_number(), PStatGraph::GBU_named, and IS_NEARLY_EQUAL. |
|
Resets the list of labels.
Definition at line 562 of file pStatStripChart.cxx. |
|
Definition at line 119 of file pStatStripChart.h. Referenced by get_collector_under_pixel(), get_view(), and PStatStripChart(). |
|
Definition at line 126 of file pStatStripChart.h. Referenced by draw_cursor(), get_frame_data(), PStatStripChart(), and SortCollectorLabels2::SortCollectorLabels2(). |
|
Definition at line 122 of file pStatStripChart.h. Referenced by get_collector_under_pixel(). |
|
Definition at line 125 of file pStatStripChart.h. Referenced by changed_size(), get_frame_data(), PStatStripChart(), and set_vertical_scale(). |
|
Definition at line 117 of file pStatGraph.h. Referenced by PStatGraph::get_target_frame_rate(), PStatGraph::get_xsize(), PStatStripChart(), and PStatGraph::update_guide_bars(). |
|
Definition at line 116 of file pStatGraph.h. Referenced by PStatGraph::get_num_guide_bars(), and PStatGraph::~PStatGraph(). |
|
Definition at line 101 of file pStatGraph.h. Referenced by GtkStatsStripChart::draw_cursor(). |
|
Definition at line 113 of file pStatGraph.h. Referenced by draw_slice(), PStatPianoRoll::end_draw(), PStatGraph::get_monitor(), and PStatGraph::get_num_labels(). |
|
Definition at line 100 of file pStatGraph.h. Referenced by PStatPianoRoll::end_draw(). |
|
Definition at line 128 of file pStatStripChart.h. Referenced by draw_empty(), and PStatStripChart(). |
|
Definition at line 103 of file pStatGraph.h. Referenced by PStatGraph::GuideBar::GuideBar(), PStatPianoRoll::PStatPianoRoll(), and PStatStripChart(). |
|
Definition at line 124 of file pStatStripChart.h. Referenced by new_data(), PStatStripChart(), and ~PStatStripChart(). |
|
Definition at line 120 of file pStatStripChart.h. Referenced by get_vertical_scale(), PStatStripChart(), and set_vertical_scale(). |
|
Definition at line 131 of file pStatStripChart.h. Referenced by draw_cursor(), get_collector_index(), get_frame_data(), idle(), PStatStripChart(), and set_scroll_mode(). |
|
Definition at line 105 of file pStatGraph.h. Referenced by PStatGraph::get_label_color(), PStatGraph::get_label_name(), and PStatGraph::update_guide_bars(). |
|
Definition at line 130 of file pStatStripChart.h. Referenced by draw_cursor(), get_collector_index(), get_frame_data(), idle(), PStatStripChart(), set_horizontal_scale(), and set_scroll_mode(). |
|
Definition at line 118 of file pStatGraph.h. Referenced by PStatGraph::get_ysize(), PStatStripChart(), PStatGraph::set_guide_bar_units(), and PStatGraph::update_guide_bars(). |
|
Definition at line 132 of file pStatStripChart.h. Referenced by get_horizontal_scale(), get_scroll_mode(), and PStatStripChart(). |
|
Definition at line 118 of file pStatStripChart.h. Referenced by draw_cursor(), draw_empty(), get_collector_under_pixel(), and new_data(). |
|
Definition at line 107 of file pStatGraph.h. Referenced by get_frame_data(), PStatPianoRoll::get_horizontal_scale(), PStatGraph::GuideBar::GuideBar(), idle(), set_default_vertical_scale(), PStatGraph::set_target_frame_rate(), and PStatPianoRoll::update(). |
|
Definition at line 108 of file pStatGraph.h. Referenced by get_frame_data(), PStatGraph::GuideBar::GuideBar(), and PStatPianoRoll::update(). |