#include <gtkStatsStripChart.h>
Inheritance diagram for GtkStatsStripChart:
Public Types | |
enum | GuideBarUnits { GBU_hz = 0x0001, GBU_ms = 0x0002, GBU_named = 0x0004, GBU_show_units = 0x0008 } |
Public Member Functions | |
GtkStatsStripChart (GtkStatsMonitor *monitor, PStatView &view, int collector_index, int xsize, int ysize) | |
void | mark_dead () |
Called when the client's connection has been lost, this should update the window in some obvious way to indicate that the window is no longer live. | |
Gtk::Alignment * | get_labels () |
Returns an alignment widget that contains all of the labels appropriate to this chart, already formatted and stacked up bottom-to-top. | |
GtkStatsGuide * | get_guide () |
Returns a widget that contains the numeric labels for the guide bars. | |
Gdk_GC | get_collector_gc (int collector_index) |
Returns a graphics context suitable for drawing in the indicated collector's color. | |
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. | |
Public Attributes | |
SigC::Signal1< void, int > | collector_picked |
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 | begin_draw (int from_x, int to_x) |
Should be overridden by the user class. | |
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 Types | |
typedef pmap< int, Gdk_GC > | GCs |
Private Member Functions | |
virtual void | clear_region () |
Erases the chart area. | |
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 | draw_slice (int x, int frame_number) |
Draws a single vertical slice of the strip chart, at the given pixel position, and corresponding to the indicated level data. | |
virtual void | draw_empty (int x) |
Draws a single vertical slice of background color. | |
virtual void | draw_cursor (int x) |
Draws a single vertical slice of foreground color. | |
virtual void | end_draw (int from_x, int to_x) |
Should be overridden by the user class. | |
virtual void | idle () |
Called at the end of the draw cycle. | |
virtual gint | configure_event_impl (GdkEventConfigure *event) |
Creates a new backing pixmap of the appropriate size. | |
virtual gint | expose_event_impl (GdkEventExpose *event) |
Redraw the screen from the backing pixmap. | |
virtual gint | button_press_event_impl (GdkEventButton *button) |
void | pack_labels () |
void | setup_white_gc () |
Sets the color on _white_gc to be either actually white (if the chart is still alive) or a light gray (if the chart is dead). | |
Private Attributes | |
Gdk_Pixmap | _pixmap |
Gdk_GC | _white_gc |
Gdk_GC | _black_gc |
Gdk_GC | _dark_gc |
Gdk_GC | _light_gc |
GCs | _gcs |
Gtk::Alignment * | _label_align |
Gtk::VBox * | _label_box |
GtkStatsGuide * | _guide |
bool | _is_dead |
Definition at line 47 of file gtkStatsStripChart.h.
|
Definition at line 95 of file pStatStripChart.h. |
|
Definition at line 94 of file pStatStripChart.h. |
|
Definition at line 93 of file gtkStatsStripChart.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 42 of file gtkStatsStripChart.cxx. References NULL. |
|
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(). |
|
Definition at line 413 of file gtkStatsStripChart.cxx. References _white_gc. |
|
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 PStatStripChart::_first_data, and PStatStripChart::clear_region(). |
|
Erases the chart area.
Reimplemented from PStatStripChart. Definition at line 166 of file gtkStatsStripChart.cxx. |
|
Creates a new backing pixmap of the appropriate size.
Definition at line 349 of file gtkStatsStripChart.cxx. References collector_picked, and PStatStripChart::get_collector_under_pixel(). |
|
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 from PStatStripChart. Definition at line 184 of file gtkStatsStripChart.cxx. References _pixmap, _white_gc, get_collector_gc(), PStatStripChart::get_frame_data(), PStatStripChart::get_vertical_scale(), PStatGraph::get_ysize(), PStatStripChart::height_to_pixel(), x, and y. |
|
Draws a single vertical slice of foreground color.
Reimplemented from PStatStripChart. Definition at line 272 of file gtkStatsStripChart.cxx. References _guide, PStatGraph::_guide_bars_changed, and pack_labels(). |
|
Draws a single vertical slice of background color.
Reimplemented from PStatStripChart. Definition at line 259 of file gtkStatsStripChart.cxx. |
|
Draws a single vertical slice of the strip chart, at the given pixel position, and corresponding to the indicated level data.
Reimplemented from PStatStripChart. Definition at line 222 of file gtkStatsStripChart.cxx. References _black_gc, _pixmap, PStatGraph::get_ysize(), and x. |
|
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 from PStatStripChart. Definition at line 291 of file gtkStatsStripChart.cxx. References _black_gc, _dark_gc, _light_gc, _pixmap, _white_gc, PStatGraph::get_xsize(), PStatGraph::get_ysize(), height, NULL, setup_white_gc(), and width. Referenced by get_collector_gc(). |
|
Redraw the screen from the backing pixmap.
Definition at line 396 of file gtkStatsStripChart.cxx. References _white_gc. |
|
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 PStatStripChart::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 PStatStripChart::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 a graphics context suitable for drawing in the indicated collector's color.
Definition at line 134 of file gtkStatsStripChart.cxx. References _pixmap, _white_gc, end_draw(), PStatGraph::get_xsize(), and PStatGraph::get_ysize(). Referenced by copy_region(). |
|
Returns the particular collector whose data this strip chart reflects.
Definition at line 47 of file pStatStripChart.I. References PStatStripChart::_start_time, PStatStripChart::_time_width, PStatStripChart::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, PStatStripChart::_collector_index, PStatStripChart::_data, PStatStripChart::ColorData::_net_value, PStatStripChart::_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 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 PStatStripChart::_cursor_pixel, PStatStripChart::_first_data, PStatStripChart::_start_time, PStatStripChart::_time_width, PStatGraph::_xsize, PStatGraph::_ysize, and PStatStripChart::draw_pixels(). Referenced by copy_region(), and PStatStripChart::set_default_vertical_scale(). |
|
Returns a widget that contains the numeric labels for the guide bars. The window should pack this widget suitably near the strip chart. Definition at line 118 of file gtkStatsStripChart.cxx. References _gcs. |
|
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 PStatStripChart::_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 an alignment widget that contains all of the labels appropriate to this chart, already formatted and stacked up bottom-to-top. The window should pack this widget suitably near the strip chart. Definition at line 101 of file gtkStatsStripChart.cxx. References _gcs, PStatMonitor::get_collector_color(), PStatGraph::get_monitor(), and RGBColorf. |
|
Returns the monitor associated with this chart.
Definition at line 32 of file pStatGraph.I. References PStatGraph::_labels, and INLINE. Referenced by get_labels(), and PStatStripChart::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 PStatStripChart::_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 PStatStripChart::_scroll_mode, and INLINE. Referenced by copy_region(). |
|
Returns the View this chart represents.
Definition at line 32 of file pStatStripChart.I. References PStatStripChart::_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 end_draw(), get_collector_gc(), GtkStatsStripWindow::menu_hscale(), and PStatStripChart::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 copy_region(), draw_slice(), end_draw(), get_collector_gc(), PStatStripChart::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 copy_region(). |
|
Called at the end of the draw cycle.
Reimplemented from PStatStripChart. Definition at line 325 of file gtkStatsStripChart.cxx. |
|
Makes a guide bar for the indicated elapsed time or level units.
Definition at line 289 of file pStatGraph.cxx. |
|
Called when the client's connection has been lost, this should update the window in some obvious way to indicate that the window is no longer live.
Definition at line 74 of file gtkStatsStripChart.cxx. |
|
Indicates that new data has become available.
Definition at line 91 of file pStatStripChart.cxx. References PStatStripChart::_next_frame, PStatStripChart::_view, PStatStripChart::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. |
|
Definition at line 431 of file gtkStatsStripChart.cxx. Referenced by draw_cursor(). |
|
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 PStatStripChart::set_default_vertical_scale(). |
|
Sets the vertical scale to make all the data visible.
Definition at line 195 of file pStatStripChart.cxx. References PStatStripChart::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, PStatStripChart::get_frame_data(), PStatThreadData::get_frame_number_at_time(), PStatThreadData::has_frame(), PStatStripChart::pixel_to_timestamp(), and x. Referenced by PStatStripChart::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 PStatStripChart::_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 PStatStripChart::_start_time, PStatStripChart::_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 PStatStripChart::_first_data, PStatStripChart::_scroll_mode, and INLINE. Referenced by PStatStripChart::first_data(), GtkStatsStripWindow::menu_new_window(), and PStatStripChart::set_auto_vertical_scale(). |
|
Sets the color on _white_gc to be either actually white (if the chart is still alive) or a light gray (if the chart is dead).
Definition at line 470 of file gtkStatsStripChart.cxx. Referenced by end_draw(). |
|
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 88 of file gtkStatsStripChart.h. Referenced by draw_slice(), and end_draw(). |
|
Definition at line 89 of file gtkStatsStripChart.h. Referenced by end_draw(). |
|
Definition at line 94 of file gtkStatsStripChart.h. Referenced by get_guide(), and get_labels(). |
|
Definition at line 98 of file gtkStatsStripChart.h. Referenced by draw_cursor(). |
|
Definition at line 117 of file pStatGraph.h. Referenced by PStatGraph::get_target_frame_rate(), PStatGraph::get_xsize(), PStatStripChart::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 draw_cursor(). |
|
Definition at line 99 of file gtkStatsStripChart.h. |
|
Definition at line 96 of file gtkStatsStripChart.h. |
|
Definition at line 97 of file gtkStatsStripChart.h. |
|
Definition at line 113 of file pStatGraph.h. Referenced by PStatStripChart::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 90 of file gtkStatsStripChart.h. Referenced by end_draw(). |
|
Definition at line 103 of file pStatGraph.h. Referenced by PStatGraph::GuideBar::GuideBar(), PStatPianoRoll::PStatPianoRoll(), and PStatStripChart::PStatStripChart(). |
|
Definition at line 82 of file gtkStatsStripChart.h. Referenced by copy_region(), draw_slice(), end_draw(), and get_collector_gc(). |
|
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 118 of file pStatGraph.h. Referenced by PStatGraph::get_ysize(), PStatStripChart::PStatStripChart(), PStatGraph::set_guide_bar_units(), and PStatGraph::update_guide_bars(). |
|
Definition at line 87 of file gtkStatsStripChart.h. Referenced by button_press_event_impl(), copy_region(), end_draw(), expose_event_impl(), and get_collector_gc(). |
|
|
Definition at line 108 of file pStatGraph.h. Referenced by PStatStripChart::get_frame_data(), PStatGraph::GuideBar::GuideBar(), and PStatPianoRoll::update(). |
|
Definition at line 62 of file gtkStatsStripChart.h. Referenced by configure_event_impl(). |