Panda3D
|
A window that draws a strip chart, given a view. More...
#include "gtkStatsStripChart.h"
Public Types | |
enum | DragMode { DM_none, DM_scale, DM_guide_bar, DM_new_guide_bar, DM_sizing } |
enum | GuideBarStyle { GBS_normal, GBS_target, GBS_user } |
enum | GuideBarUnits { GBU_hz = 0x0001, GBU_ms = 0x0002, GBU_named = 0x0004, GBU_show_units = 0x0008 } |
Public Member Functions | |
GtkStatsStripChart (GtkStatsMonitor *monitor, int thread_index, int collector_index, bool show_level) | |
int | add_user_guide_bar (float height) |
Creates a new user guide bar and returns its index number. | |
virtual void | changed_graph_size (int graph_xsize, int graph_ysize) |
Called when the user has resized the window, forcing a resize of the graph. | |
virtual void | clicked_label (int collector_index) |
Called when the user single-clicks on a label. | |
int | find_user_guide_bar (float from_height, float 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. | |
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. | |
virtual void | force_redraw () |
Called when it is necessary to redraw the entire graph. | |
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. | |
const GuideBar & | get_guide_bar (int n) const |
Returns the nth horizontal guide bar. | |
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. | |
int | get_guide_bar_units () const |
Returns the units that are displayed for the guide bar labels. | |
float | get_horizontal_scale () const |
Returns the amount of total time the width of the horizontal axis represents. | |
int | get_label_collector (int n) const |
Returns the collector index associated with the nth label. | |
RGBColorf | get_label_color (int n) const |
Returns the color associated with the nth label. | |
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. | |
bool | get_scroll_mode () const |
Returns the current state of the scroll_mode flag. | |
float | get_target_frame_rate () const |
Returns the indicated target frame rate in Hz. | |
string | get_title_text () |
Returns the text suitable for the title label on the top line. | |
GuideBar | get_user_guide_bar (int n) const |
Returns the nth user-defined guide bar. | |
float | 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 | get_xsize () const |
Returns the width of the chart in pixels. | |
int | get_ysize () const |
Returns the height of the chart in pixels. | |
int | height_to_pixel (float 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 | move_user_guide_bar (int n, float height) |
Adjusts the height of the nth user-defined guide bar. | |
virtual void | new_collector (int collector_index) |
Called whenever a new Collector definition is received from the client. | |
virtual void | new_data (int thread_index, int frame_number) |
Called as each frame's data is made available. | |
void | new_data (int frame_number) |
Indicates that new data has become available. | |
float | pixel_to_height (int y) const |
Converts a vertical pixel offset to a value (a "height" in the strip chart). | |
float | pixel_to_timestamp (int x) const |
Converts a horizontal pixel offset to a timestamp. | |
void | remove_user_guide_bar (int n) |
Removes the user guide bar with the indicated index number. | |
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_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. | |
void | set_guide_bar_units (int unit_mask) |
Sets the units that are displayed for the guide bar labels. | |
void | set_horizontal_scale (float time_width) |
Changes the amount of time the width of the horizontal axis represents. | |
void | set_pause (bool pause) |
Changes the pause flag for the graph. | |
void | set_scroll_mode (bool scroll_mode) |
Changes the scroll_mode flag. | |
virtual void | set_scroll_speed (float scroll_speed) |
Called when the user selects a new scroll speed from the monitor pulldown menu, this should adjust the speed for the graph to the indicated value. | |
void | set_target_frame_rate (float frame_rate) |
Sets the target frame rate of the application in Hz. | |
virtual void | set_time_units (int unit_mask) |
Called when the user selects a new time units from the monitor pulldown menu, this should adjust the units for the graph to the indicated mask if it is a time-based graph. | |
void | set_vertical_scale (float value_height) |
Changes the value the height of the vertical axis represents. | |
int | timestamp_to_pixel (float time) const |
Converts a timestamp to a horizontal pixel offset. | |
void | update () |
Updates the chart with the latest data. | |
void | user_guide_bars_changed () |
Called when the user guide bars have been changed. | |
Static Public Member Functions | |
static string | format_number (float value) |
Returns a string representing the value nicely formatted for its range. | |
static 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 pmap< int, GdkGC * > | Brushes |
typedef pmap< int, FrameData > | Data |
typedef pvector< ColorData > | FrameData |
typedef pvector< GuideBar > | GuideBars |
typedef vector_int | Labels |
Protected Member Functions | |
virtual void | additional_graph_window_paint () |
This is called during the servicing of expose_event; it gives a derived class opportunity to do some further painting into the graph window. | |
virtual void | begin_draw (int from_x, int to_x) |
Should be overridden by the user class. | |
void | changed_size (int xsize, int ysize) |
To be called by the user class when the widget size has changed. | |
virtual void | clear_region () |
Erases the chart area. | |
void | close () |
Should be called when the user closes the associated window. | |
void | compute_average_pixel_data (PStatStripChart::FrameData &result, int &then_i, int &now_i, float now) |
Fills the indicated FrameData structure with the color data for the indicated pixel, averaged over the past pstats_average_time seconds. | |
virtual DragMode | consider_drag_start (int graph_x, int graph_y) |
Based on the mouse position within the graph window, look for draggable things the mouse might be hovering over and return the appropriate DragMode enum or DM_none if nothing is indicated. | |
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_cursor (int x) |
Draws a single vertical slice of foreground color. | |
virtual void | draw_empty (int x, int w) |
Draws a single vertical slice of background color. | |
virtual void | draw_slice (int x, int w, const PStatStripChart::FrameData &fdata) |
Draws a single vertical slice of the strip chart, at the given pixel position, and corresponding to the indicated level data. | |
virtual void | end_draw (int from_x, int to_x) |
Should be overridden by the user class. | |
void | force_reset () |
To be called by the user class to cause the chart to reset to empty and start filling again. | |
float | get_average_net_value () const |
Computes the average value of the chart's collector over the past pstats_average_time number of seconds. | |
GdkGC * | get_collector_gc (int collector_index) |
Returns a GC suitable for drawing in the indicated collector's color. | |
const FrameData & | get_frame_data (int frame_number) |
Returns the cached FrameData associated with the given frame number. | |
float | get_net_value (int frame_number) const |
Returns the net value of the chart's collector for the indicated frame number. | |
virtual gboolean | handle_button_press (GtkWidget *widget, int graph_x, int graph_y, bool double_click) |
Called when the mouse button is depressed within the graph window. | |
virtual gboolean | handle_button_release (GtkWidget *widget, int graph_x, int graph_y) |
Called when the mouse button is released within the graph window. | |
virtual gboolean | handle_motion (GtkWidget *widget, int graph_x, int graph_y) |
Called when the mouse is moved within the graph window. | |
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. | |
bool | is_label_used (int collector_index) const |
Returns true if the indicated collector appears anywhere on the chart at the current time, false otherwise. | |
GuideBar | make_guide_bar (float value, GuideBarStyle style=GBS_normal) const |
Makes a guide bar for the indicated elapsed time or level units. | |
virtual void | normal_guide_bars () |
Calls update_guide_bars with parameters suitable to this kind of graph. | |
PT (PStatMonitor) _monitor | |
virtual void | set_drag_mode (DragMode drag_mode) |
This should be called whenever the drag mode needs to change state. | |
void | update_guide_bars (int num_bars, float scale) |
Resets the list of guide bars. | |
virtual void | update_labels () |
Resets the list of labels. | |
Static Protected Member Functions | |
static void | accumulate_frame_data (FrameData &fdata, const FrameData &additional, float weight) |
Adds the data from additional into the data from fdata, after applying the scale weight. | |
static gboolean | button_press_event_callback (GtkWidget *widget, GdkEventButton *event, gpointer data) |
Called when the mouse button is depressed within the graph window or main window. | |
static gboolean | button_release_event_callback (GtkWidget *widget, GdkEventButton *event, gpointer data) |
Called when the mouse button is released within the graph window or main window. | |
static gboolean | motion_notify_event_callback (GtkWidget *widget, GdkEventMotion *event, gpointer data) |
Called when the mouse is moved within the graph window or main window. | |
static void | scale_frame_data (FrameData &fdata, float factor) |
Applies the indicated scale to all collector values in data. | |
Protected Attributes | |
Brushes | _brushes |
int | _drag_guide_bar |
DragMode | _drag_mode |
float | _drag_scale_start |
int | _drag_start_x |
int | _drag_start_y |
GtkWidget * | _graph_hbox |
GtkWidget * | _graph_vbox |
GtkWidget * | _graph_window |
int | _guide_bar_units |
GuideBars | _guide_bars |
bool | _guide_bars_changed |
GdkCursor * | _hand_cursor |
GtkWidget * | _hpaned |
GtkStatsLabelStack | _label_stack |
Labels | _labels |
bool | _labels_changed |
GtkStatsMonitor * | _monitor |
GtkWidget * | _parent_window |
bool | _pause |
GdkPixmap * | _pixmap |
GdkGC * | _pixmap_gc |
int | _pixmap_xsize |
int | _pixmap_ysize |
DragMode | _potential_drag_mode |
GtkWidget * | _scale_area |
float | _target_frame_rate |
int | _thread_index |
string | _unit_name |
GtkWidget * | _window |
int | _xsize |
int | _ysize |
Static Protected Attributes | |
static const GdkColor | rgb_black |
static const GdkColor | rgb_dark_gray |
static const GdkColor | rgb_light_gray |
static const GdkColor | rgb_user_guide_bar |
static const GdkColor | rgb_white |
A window that draws a strip chart, given a view.
Definition at line 32 of file gtkStatsStripChart.h.
void PStatStripChart::accumulate_frame_data | ( | FrameData & | fdata, |
const FrameData & | additional, | ||
float | weight | ||
) | [static, protected, inherited] |
Adds the data from additional into the data from fdata, after applying the scale weight.
Definition at line 325 of file pStatStripChart.cxx.
Referenced by PStatStripChart::compute_average_pixel_data().
int PStatGraph::add_user_guide_bar | ( | float | height | ) | [inherited] |
Creates a new user guide bar and returns its index number.
Definition at line 148 of file pStatGraph.cxx.
Referenced by handle_motion().
void GtkStatsStripChart::additional_graph_window_paint | ( | ) | [protected, virtual] |
This is called during the servicing of expose_event; it gives a derived class opportunity to do some further painting into the graph window.
Reimplemented from GtkStatsGraph.
Definition at line 388 of file gtkStatsStripChart.cxx.
References PStatGraph::get_num_user_guide_bars(), PStatGraph::get_user_guide_bar(), and PStatGraph::get_xsize().
void PStatStripChart::begin_draw | ( | int | from_x, |
int | to_x | ||
) | [protected, virtual, inherited] |
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 719 of file pStatStripChart.cxx.
gboolean GtkStatsGraph::button_press_event_callback | ( | GtkWidget * | widget, |
GdkEventButton * | event, | ||
gpointer | data | ||
) | [static, protected, inherited] |
Called when the mouse button is depressed within the graph window or main window.
Definition at line 491 of file gtkStatsGraph.cxx.
gboolean GtkStatsGraph::button_release_event_callback | ( | GtkWidget * | widget, |
GdkEventButton * | event, | ||
gpointer | data | ||
) | [static, protected, inherited] |
Called when the mouse button is released within the graph window or main window.
Definition at line 511 of file gtkStatsGraph.cxx.
void GtkStatsStripChart::changed_graph_size | ( | int | graph_xsize, |
int | graph_ysize | ||
) | [virtual] |
Called when the user has resized the window, forcing a resize of the graph.
Reimplemented from GtkStatsGraph.
Definition at line 159 of file gtkStatsStripChart.cxx.
References PStatStripChart::changed_size().
void PStatStripChart::changed_size | ( | int | xsize, |
int | ysize | ||
) | [protected, inherited] |
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 635 of file pStatStripChart.cxx.
Referenced by WinStatsStripChart::changed_graph_size(), and changed_graph_size().
void GtkStatsStripChart::clear_region | ( | ) | [protected, virtual] |
Erases the chart area.
Reimplemented from PStatStripChart.
Definition at line 268 of file gtkStatsStripChart.cxx.
References PStatGraph::get_xsize(), and PStatGraph::get_ysize().
void GtkStatsStripChart::clicked_label | ( | int | collector_index | ) | [virtual] |
Called when the user single-clicks on a label.
Reimplemented from GtkStatsGraph.
Definition at line 204 of file gtkStatsStripChart.cxx.
References PStatMonitor::get_client_data(), PStatClientData::get_collector_def(), PStatStripChart::get_collector_index(), PStatStripChart::get_view(), PStatClientData::has_collector(), and PStatStripChart::set_collector_index().
Referenced by handle_button_press().
void GtkStatsGraph::close | ( | ) | [protected, inherited] |
Should be called when the user closes the associated window.
This tells the monitor to remove the graph.
Definition at line 255 of file gtkStatsGraph.cxx.
References GtkStatsLabelStack::clear_labels().
void PStatStripChart::compute_average_pixel_data | ( | PStatStripChart::FrameData & | result, |
int & | then_i, | ||
int & | now_i, | ||
float | now | ||
) | [protected, inherited] |
Fills the indicated FrameData structure with the color data for the indicated pixel, averaged over the past pstats_average_time seconds.
now is the timestamp for which we are computing the data; then_i and now_i are the frame numbers that bound (now - pstats_average_time) and now. At function initialization time, these should be at or below the actual values; they will be incremented as needed by this function. This allows the function to be called repeatedly for successive pixels.
Definition at line 493 of file pStatStripChart.cxx.
References PStatStripChart::accumulate_frame_data(), PStatFrameData::get_end(), PStatThreadData::get_frame(), PStatStripChart::get_frame_data(), PStatThreadData::get_latest_frame_number(), PStatThreadData::get_oldest_time(), PStatFrameData::get_start(), PStatView::get_thread_data(), PStatThreadData::is_empty(), and PStatStripChart::scale_frame_data().
Referenced by PStatStripChart::get_collector_under_pixel().
GtkStatsGraph::DragMode GtkStatsStripChart::consider_drag_start | ( | int | graph_x, |
int | graph_y | ||
) | [protected, virtual] |
Based on the mouse position within the graph window, look for draggable things the mouse might be hovering over and return the appropriate DragMode enum or DM_none if nothing is indicated.
Reimplemented from GtkStatsGraph.
Definition at line 404 of file gtkStatsStripChart.cxx.
References PStatGraph::find_user_guide_bar(), PStatGraph::get_xsize(), PStatGraph::get_ysize(), and PStatStripChart::pixel_to_height().
void GtkStatsStripChart::copy_region | ( | int | start_x, |
int | end_x, | ||
int | dest_x | ||
) | [protected, virtual] |
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 282 of file gtkStatsStripChart.cxx.
References PStatGraph::get_ysize().
void GtkStatsStripChart::draw_cursor | ( | int | x | ) | [protected, virtual] |
Draws a single vertical slice of foreground color.
Reimplemented from PStatStripChart.
Definition at line 353 of file gtkStatsStripChart.cxx.
References PStatGraph::get_ysize().
void GtkStatsStripChart::draw_empty | ( | int | x, |
int | w | ||
) | [protected, virtual] |
Draws a single vertical slice of background color.
Reimplemented from PStatStripChart.
Definition at line 341 of file gtkStatsStripChart.cxx.
References PStatGraph::get_ysize().
void GtkStatsStripChart::draw_slice | ( | int | x, |
int | w, | ||
const PStatStripChart::FrameData & | fdata | ||
) | [protected, virtual] |
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 306 of file gtkStatsStripChart.cxx.
References GtkStatsGraph::get_collector_gc(), PStatStripChart::get_vertical_scale(), PStatGraph::get_ysize(), and PStatStripChart::height_to_pixel().
void GtkStatsStripChart::end_draw | ( | int | from_x, |
int | to_x | ||
) | [protected, virtual] |
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 367 of file gtkStatsStripChart.cxx.
References PStatGraph::get_guide_bar(), PStatGraph::get_num_guide_bars(), and PStatGraph::get_ysize().
int PStatGraph::find_user_guide_bar | ( | float | from_height, |
float | to_height | ||
) | const [inherited] |
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.
Definition at line 172 of file pStatGraph.cxx.
Referenced by WinStatsStripChart::consider_drag_start(), and consider_drag_start().
bool PStatStripChart::first_data | ( | ) | const [inherited] |
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.
void GtkStatsStripChart::force_redraw | ( | ) | [virtual] |
Called when it is necessary to redraw the entire graph.
Reimplemented from GtkStatsGraph.
Definition at line 148 of file gtkStatsStripChart.cxx.
void PStatStripChart::force_reset | ( | ) | [protected, inherited] |
To be called by the user class to cause the chart to reset to empty and start filling again.
Definition at line 683 of file pStatStripChart.cxx.
References PStatStripChart::clear_region().
Referenced by PStatStripChart::set_horizontal_scale().
string PStatGraph::format_number | ( | float | value | ) | [static, inherited] |
Returns a string representing the value nicely formatted for its range.
Definition at line 184 of file pStatGraph.cxx.
Referenced by PStatGraph::format_number(), PStatGraph::make_guide_bar(), WinStatsStripChart::new_data(), and new_data().
string PStatGraph::format_number | ( | float | value, |
int | guide_bar_units, | ||
const string & | unit_name = string() |
||
) | [static, inherited] |
Returns a string representing the value nicely formatted for its range, including the units as indicated.
Definition at line 210 of file pStatGraph.cxx.
References PStatGraph::format_number().
bool PStatStripChart::get_average_mode | ( | ) | const [inline, inherited] |
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.
float PStatStripChart::get_average_net_value | ( | ) | const [protected, inherited] |
Computes the average value of the chart's collector over the past pstats_average_time number of seconds.
Definition at line 571 of file pStatStripChart.cxx.
References PStatThreadData::get_elapsed_frames(), PStatFrameData::get_end(), PStatThreadData::get_frame(), PStatFrameData::get_net_time(), PStatStripChart::get_net_value(), PStatView::get_show_level(), PStatFrameData::get_start(), and PStatView::get_thread_data().
Referenced by WinStatsStripChart::new_data(), and new_data().
GdkGC * GtkStatsGraph::get_collector_gc | ( | int | collector_index | ) | [protected, inherited] |
Returns a GC suitable for drawing in the indicated collector's color.
Definition at line 275 of file gtkStatsGraph.cxx.
References PStatMonitor::get_collector_color().
Referenced by GtkStatsPianoRoll::draw_bar(), and draw_slice().
int PStatStripChart::get_collector_index | ( | ) | const [inline, inherited] |
Returns the particular collector whose data this strip chart reflects.
Definition at line 33 of file pStatStripChart.I.
Referenced by WinStatsStripChart::clicked_label(), and clicked_label().
int PStatStripChart::get_collector_under_pixel | ( | int | xpoint, |
int | ypoint | ||
) | [inherited] |
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 PStatStripChart::compute_average_pixel_data(), PStatStripChart::get_frame_data(), PStatThreadData::get_frame_number_at_time(), PStatView::get_thread_data(), PStatGraph::get_ysize(), PStatStripChart::height_to_pixel(), and PStatStripChart::pixel_to_timestamp().
Referenced by handle_button_press(), and handle_motion().
const PStatStripChart::FrameData & PStatStripChart::get_frame_data | ( | int | frame_number | ) | [protected, inherited] |
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 437 of file pStatStripChart.cxx.
References 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 PStatStripChart::compute_average_pixel_data(), and PStatStripChart::get_collector_under_pixel().
const PStatGraph::GuideBar & PStatGraph::get_guide_bar | ( | int | n | ) | const [inherited] |
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 101 of file pStatGraph.cxx.
Referenced by WinStatsStripChart::additional_window_paint(), WinStatsStripChart::end_draw(), and end_draw().
const string & PStatGraph::get_guide_bar_unit_name | ( | ) | const [inline, inherited] |
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 164 of file pStatGraph.I.
Referenced by WinStatsStripChart::new_data(), and new_data().
int PStatGraph::get_guide_bar_units | ( | ) | const [inline, inherited] |
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 140 of file pStatGraph.I.
Referenced by WinStatsStripChart::new_data(), new_data(), WinStatsStripChart::set_time_units(), and set_time_units().
float PStatStripChart::get_horizontal_scale | ( | ) | const [inline, inherited] |
Returns the amount of total time the width of the horizontal axis represents.
Definition at line 62 of file pStatStripChart.I.
int PStatGraph::get_label_collector | ( | int | n | ) | const [inline, inherited] |
Returns the collector index associated with the nth label.
Definition at line 44 of file pStatGraph.I.
Referenced by WinStatsStripChart::update_labels(), and update_labels().
RGBColorf PStatGraph::get_label_color | ( | int | n | ) | const [inline, inherited] |
Returns the color associated with the nth label.
Definition at line 66 of file pStatGraph.I.
string PStatGraph::get_label_name | ( | int | n | ) | const [inline, inherited] |
Returns the text associated with the nth label.
Definition at line 55 of file pStatGraph.I.
PStatMonitor * PStatGraph::get_monitor | ( | ) | const [inline, inherited] |
Returns the monitor associated with this chart.
Definition at line 22 of file pStatGraph.I.
Referenced by PStatStripChart::update(), and PStatStripChart::update_labels().
float PStatStripChart::get_net_value | ( | int | frame_number | ) | const [protected, inherited] |
Returns the net value of the chart's collector for the indicated frame number.
Definition at line 550 of file pStatStripChart.cxx.
Referenced by PStatStripChart::get_average_net_value(), and PStatStripChart::set_auto_vertical_scale().
int PStatGraph::get_num_guide_bars | ( | ) | const [inherited] |
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 86 of file pStatGraph.cxx.
Referenced by WinStatsStripChart::additional_window_paint(), WinStatsStripChart::end_draw(), and end_draw().
int PStatGraph::get_num_labels | ( | ) | const [inline, inherited] |
Returns the number of labels to be drawn for this chart.
Definition at line 33 of file pStatGraph.I.
Referenced by WinStatsStripChart::update_labels(), and update_labels().
int PStatGraph::get_num_user_guide_bars | ( | ) | const [inherited] |
Returns the current number of user-defined guide bars.
Not all of these may be visible.
Definition at line 116 of file pStatGraph.cxx.
Referenced by WinStatsStripChart::additional_graph_window_paint(), additional_graph_window_paint(), and WinStatsStripChart::additional_window_paint().
bool PStatStripChart::get_scroll_mode | ( | ) | const [inline, inherited] |
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.
float PStatGraph::get_target_frame_rate | ( | ) | const [inline, inherited] |
Returns the indicated target frame rate in Hz.
Definition at line 93 of file pStatGraph.I.
Referenced by PStatStripChart::set_default_vertical_scale().
string PStatStripChart::get_title_text | ( | ) | [inherited] |
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 WinStatsStripChart::new_data(), and new_data().
PStatGraph::GuideBar PStatGraph::get_user_guide_bar | ( | int | n | ) | const [inherited] |
Returns the nth user-defined guide bar.
Definition at line 126 of file pStatGraph.cxx.
References PStatGraph::make_guide_bar().
Referenced by WinStatsStripChart::additional_graph_window_paint(), additional_graph_window_paint(), and WinStatsStripChart::additional_window_paint().
float PStatStripChart::get_vertical_scale | ( | ) | const [inline, inherited] |
Returns total value the height of the vertical axis represents.
Definition at line 88 of file pStatStripChart.I.
Referenced by WinStatsStripChart::additional_window_paint(), WinStatsStripChart::draw_slice(), and draw_slice().
PStatView & PStatStripChart::get_view | ( | ) | const [inline, inherited] |
Returns the View this chart represents.
Definition at line 22 of file pStatStripChart.I.
Referenced by WinStatsStripChart::clicked_label(), and clicked_label().
int PStatGraph::get_xsize | ( | ) | const [inline, inherited] |
Returns the width of the chart in pixels.
Definition at line 103 of file pStatGraph.I.
Referenced by WinStatsStripChart::additional_graph_window_paint(), additional_graph_window_paint(), WinStatsStripChart::clear_region(), clear_region(), WinStatsStripChart::consider_drag_start(), consider_drag_start(), PStatPianoRoll::normal_guide_bars(), PStatStripChart::pixel_to_timestamp(), and PStatStripChart::timestamp_to_pixel().
int PStatGraph::get_ysize | ( | ) | const [inline, inherited] |
Returns the height of the chart in pixels.
Definition at line 113 of file pStatGraph.I.
Referenced by WinStatsStripChart::clear_region(), clear_region(), WinStatsStripChart::consider_drag_start(), consider_drag_start(), WinStatsStripChart::copy_region(), copy_region(), WinStatsStripChart::draw_cursor(), draw_cursor(), WinStatsStripChart::draw_empty(), draw_empty(), WinStatsStripChart::draw_slice(), draw_slice(), WinStatsStripChart::end_draw(), end_draw(), PStatStripChart::get_collector_under_pixel(), handle_button_release(), handle_motion(), PStatStripChart::height_to_pixel(), and PStatStripChart::pixel_to_height().
gboolean GtkStatsStripChart::handle_button_press | ( | GtkWidget * | widget, |
int | graph_x, | ||
int | graph_y, | ||
bool | double_click | ||
) | [protected, virtual] |
Called when the mouse button is depressed within the graph window.
Reimplemented from GtkStatsGraph.
Definition at line 461 of file gtkStatsStripChart.cxx.
References clicked_label(), PStatStripChart::get_collector_under_pixel(), PStatStripChart::pixel_to_height(), and set_drag_mode().
gboolean GtkStatsStripChart::handle_button_release | ( | GtkWidget * | widget, |
int | graph_x, | ||
int | graph_y | ||
) | [protected, virtual] |
Called when the mouse button is released within the graph window.
Reimplemented from GtkStatsGraph.
Definition at line 494 of file gtkStatsStripChart.cxx.
References PStatGraph::get_ysize(), handle_motion(), PStatGraph::move_user_guide_bar(), PStatStripChart::pixel_to_height(), PStatGraph::remove_user_guide_bar(), and set_drag_mode().
gboolean GtkStatsStripChart::handle_motion | ( | GtkWidget * | widget, |
int | graph_x, | ||
int | graph_y | ||
) | [protected, virtual] |
Called when the mouse is moved within the graph window.
Reimplemented from GtkStatsGraph.
Definition at line 521 of file gtkStatsStripChart.cxx.
References PStatGraph::add_user_guide_bar(), PStatStripChart::get_collector_under_pixel(), PStatGraph::get_ysize(), GtkStatsLabelStack::highlight_label(), PStatGraph::move_user_guide_bar(), PStatStripChart::pixel_to_height(), set_drag_mode(), and set_vertical_scale().
Referenced by handle_button_release().
int PStatStripChart::height_to_pixel | ( | float | value | ) | const [inline, inherited] |
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 WinStatsStripChart::draw_slice(), draw_slice(), and PStatStripChart::get_collector_under_pixel().
void PStatStripChart::idle | ( | ) | [protected, virtual, inherited] |
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.
Definition at line 778 of file pStatStripChart.cxx.
Referenced by PStatStripChart::update().
bool PStatStripChart::is_label_used | ( | int | collector_index | ) | const [inline, protected, inherited] |
Returns true if the indicated collector appears anywhere on the chart at the current time, false otherwise.
Definition at line 205 of file pStatStripChart.I.
Referenced by PStatStripChart::update_labels().
bool PStatStripChart::is_title_unknown | ( | ) | const [inherited] |
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 WinStatsStripChart::new_data(), and new_data().
PStatGraph::GuideBar PStatGraph::make_guide_bar | ( | float | value, |
PStatGraph::GuideBarStyle | style = GBS_normal |
||
) | const [protected, inherited] |
Makes a guide bar for the indicated elapsed time or level units.
Definition at line 295 of file pStatGraph.cxx.
References PStatGraph::format_number().
Referenced by WinStatsStripChart::additional_window_paint(), PStatGraph::get_user_guide_bar(), and PStatGraph::update_guide_bars().
gboolean GtkStatsGraph::motion_notify_event_callback | ( | GtkWidget * | widget, |
GdkEventMotion * | event, | ||
gpointer | data | ||
) | [static, protected, inherited] |
Called when the mouse is moved within the graph window or main window.
Definition at line 529 of file gtkStatsGraph.cxx.
void PStatGraph::move_user_guide_bar | ( | int | n, |
float | height | ||
) | [inherited] |
Adjusts the height of the nth user-defined guide bar.
Definition at line 137 of file pStatGraph.cxx.
Referenced by handle_button_release(), and handle_motion().
void GtkStatsStripChart::new_collector | ( | int | collector_index | ) | [virtual] |
Called whenever a new Collector definition is received from the client.
Reimplemented from GtkStatsGraph.
Definition at line 109 of file gtkStatsStripChart.cxx.
void PStatStripChart::new_data | ( | int | frame_number | ) | [inherited] |
Indicates that new data has become available.
Definition at line 77 of file pStatStripChart.cxx.
void GtkStatsStripChart::new_data | ( | int | thread_index, |
int | frame_number | ||
) | [virtual] |
Called as each frame's data is made available.
There is no gurantee the frames will arrive in order, or that all of them will arrive at all. The monitor should be prepared to accept frames received out-of-order or missing.
Reimplemented from GtkStatsGraph.
Definition at line 123 of file gtkStatsStripChart.cxx.
References PStatGraph::format_number(), PStatStripChart::get_average_net_value(), PStatGraph::get_guide_bar_unit_name(), PStatGraph::get_guide_bar_units(), PStatStripChart::get_title_text(), PStatStripChart::is_title_unknown(), and PStatStripChart::update().
void PStatStripChart::normal_guide_bars | ( | ) | [protected, virtual, inherited] |
Calls update_guide_bars with parameters suitable to this kind of graph.
Implements PStatGraph.
Definition at line 833 of file pStatStripChart.cxx.
References PStatGraph::update_guide_bars().
Referenced by PStatStripChart::set_vertical_scale().
float PStatStripChart::pixel_to_height | ( | int | y | ) | const [inline, inherited] |
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().
Referenced by WinStatsStripChart::consider_drag_start(), consider_drag_start(), handle_button_press(), handle_button_release(), and handle_motion().
float PStatStripChart::pixel_to_timestamp | ( | int | x | ) | const [inline, inherited] |
Converts a horizontal pixel offset to a timestamp.
Definition at line 171 of file pStatStripChart.I.
References PStatGraph::get_xsize().
Referenced by PStatStripChart::get_collector_under_pixel(), and PStatStripChart::set_auto_vertical_scale().
void PStatGraph::remove_user_guide_bar | ( | int | n | ) | [inherited] |
Removes the user guide bar with the indicated index number.
All subsequent index numbers are adjusted down one.
Definition at line 160 of file pStatGraph.cxx.
Referenced by handle_button_release().
void PStatStripChart::scale_frame_data | ( | FrameData & | fdata, |
float | factor | ||
) | [static, protected, inherited] |
Applies the indicated scale to all collector values in data.
Definition at line 420 of file pStatStripChart.cxx.
Referenced by PStatStripChart::compute_average_pixel_data().
void PStatStripChart::set_auto_vertical_scale | ( | ) | [inherited] |
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(), PStatStripChart::get_net_value(), PStatView::get_thread_data(), PStatThreadData::has_frame(), PStatStripChart::pixel_to_timestamp(), and PStatStripChart::set_vertical_scale().
void PStatStripChart::set_average_mode | ( | bool | average_mode | ) | [inline, inherited] |
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.
References PStatStripChart::force_redraw().
Referenced by WinStatsStripChart::set_drag_mode(), set_drag_mode(), and WinStatsStripChart::window_proc().
void PStatStripChart::set_collector_index | ( | int | collector_index | ) | [inherited] |
Changes the collector represented by this strip chart.
This may force a redraw.
Definition at line 146 of file pStatStripChart.cxx.
References PStatStripChart::force_redraw(), and PStatStripChart::update_labels().
Referenced by WinStatsStripChart::clicked_label(), and clicked_label().
void PStatStripChart::set_default_vertical_scale | ( | ) | [inherited] |
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 PStatStripChart::set_vertical_scale().
void GtkStatsStripChart::set_drag_mode | ( | GtkStatsGraph::DragMode | drag_mode | ) | [protected, virtual] |
This should be called whenever the drag mode needs to change state.
It provides hooks for a derived class to do something special.
Reimplemented from GtkStatsGraph.
Definition at line 434 of file gtkStatsStripChart.cxx.
References PStatStripChart::set_average_mode().
Referenced by handle_button_press(), handle_button_release(), and handle_motion().
void PStatGraph::set_guide_bar_unit_name | ( | const string & | unit_name | ) | [inline, inherited] |
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 152 of file pStatGraph.I.
void PStatGraph::set_guide_bar_units | ( | int | guide_bar_units | ) | [inline, inherited] |
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 125 of file pStatGraph.I.
Referenced by WinStatsStripChart::set_time_units(), and set_time_units().
void PStatStripChart::set_horizontal_scale | ( | float | time_width | ) | [inline, inherited] |
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.
References PStatStripChart::force_reset().
Referenced by WinStatsStripChart::set_scroll_speed(), and set_scroll_speed().
void GtkStatsGraph::set_pause | ( | bool | pause | ) | [inherited] |
Changes the pause flag for the graph.
When this flag is true, the graph does not update in response to new data.
Definition at line 222 of file gtkStatsGraph.cxx.
Referenced by GtkStatsMonitor::open_piano_roll(), GtkStatsMonitor::open_strip_chart(), and GtkStatsMonitor::set_pause().
void PStatStripChart::set_scroll_mode | ( | bool | scroll_mode | ) | [inline, inherited] |
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.
void GtkStatsStripChart::set_scroll_speed | ( | float | scroll_speed | ) | [virtual] |
Called when the user selects a new scroll speed from the monitor pulldown menu, this should adjust the speed for the graph to the indicated value.
Reimplemented from GtkStatsGraph.
Definition at line 191 of file gtkStatsStripChart.cxx.
References PStatStripChart::set_horizontal_scale().
Referenced by GtkStatsMonitor::open_strip_chart().
void PStatGraph::set_target_frame_rate | ( | float | frame_rate | ) | [inline, inherited] |
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 79 of file pStatGraph.I.
void GtkStatsStripChart::set_time_units | ( | int | unit_mask | ) | [virtual] |
Called when the user selects a new time units from the monitor pulldown menu, this should adjust the units for the graph to the indicated mask if it is a time-based graph.
Reimplemented from GtkStatsGraph.
Definition at line 172 of file gtkStatsStripChart.cxx.
References PStatGraph::get_guide_bar_units(), and PStatGraph::set_guide_bar_units().
Referenced by GtkStatsMonitor::open_strip_chart().
void GtkStatsStripChart::set_vertical_scale | ( | float | value_height | ) |
Changes the value the height of the vertical axis represents.
This may force a redraw.
Reimplemented from PStatStripChart.
Definition at line 238 of file gtkStatsStripChart.cxx.
Referenced by handle_motion().
int PStatStripChart::timestamp_to_pixel | ( | float | time | ) | const [inline, inherited] |
Converts a timestamp to a horizontal pixel offset.
Definition at line 161 of file pStatStripChart.I.
References PStatGraph::get_xsize().
void PStatStripChart::update | ( | ) | [inherited] |
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(), PStatStripChart::idle(), PStatThreadData::is_empty(), and PStatStripChart::update_labels().
Referenced by WinStatsStripChart::new_data(), and new_data().
void PStatGraph::update_guide_bars | ( | int | num_bars, |
float | scale | ||
) | [protected, inherited] |
Resets the list of guide bars.
Definition at line 257 of file pStatGraph.cxx.
References PStatGraph::make_guide_bar().
Referenced by PStatStripChart::normal_guide_bars(), and PStatPianoRoll::normal_guide_bars().
void GtkStatsStripChart::update_labels | ( | ) | [protected, virtual] |
Resets the list of labels.
Reimplemented from PStatStripChart.
Definition at line 251 of file gtkStatsStripChart.cxx.
References GtkStatsLabelStack::add_label(), GtkStatsLabelStack::clear_labels(), PStatGraph::get_label_collector(), and PStatGraph::get_num_labels().
void GtkStatsGraph::user_guide_bars_changed | ( | ) | [inherited] |
Called when the user guide bars have been changed.
Definition at line 232 of file gtkStatsGraph.cxx.
Referenced by GtkStatsMonitor::user_guide_bars_changed().
const GdkColor GtkStatsGraph::rgb_black [static, protected, inherited] |
{ 0, 0x0000, 0x0000, 0x0000 }
Definition at line 113 of file gtkStatsGraph.h.
const GdkColor GtkStatsGraph::rgb_dark_gray [static, protected, inherited] |
{ 0, 0x3333, 0x3333, 0x3333, }
Definition at line 112 of file gtkStatsGraph.h.
const GdkColor GtkStatsGraph::rgb_light_gray [static, protected, inherited] |
{ 0, 0x9a9a, 0x9a9a, 0x9a9a, }
Definition at line 111 of file gtkStatsGraph.h.
const GdkColor GtkStatsGraph::rgb_user_guide_bar [static, protected, inherited] |
{ 0, 0x8282, 0x9696, 0xffff }
Definition at line 114 of file gtkStatsGraph.h.
const GdkColor GtkStatsGraph::rgb_white [static, protected, inherited] |
{ 0, 0xffff, 0xffff, 0xffff }
Definition at line 110 of file gtkStatsGraph.h.