|
|
|
This is an abstract class that presents the interface for drawing a basic strip-chart, showing the relative value over an interval of time for several different collectors, differentiated by bands of color.
More...
#include "pStatStripChart.h"
List of all members.
Classes |
| class | ColorData |
Public Member Functions |
|
| PStatStripChart (PStatMonitor *monitor, PStatView &view, int thread_index, int collector_index, int xsize, int ysize) |
| bool | first_data () const |
| | Returns true if the chart has seen its first data appear on it, false if it is still a virgin chart.
|
| bool | get_average_mode () const |
| | Returns the current state of the average_mode flag.
|
| int | get_collector_index () const |
| | Returns the particular collector whose data this strip chart reflects.
|
| int | get_collector_under_pixel (int xpoint, int ypoint) |
| | Return the collector index associated with the particular band of color at the indicated pixel location, or -1 if no band of color was at the pixel.
|
| double | get_horizontal_scale () const |
| | Returns the amount of total time the width of the horizontal axis represents.
|
| bool | get_scroll_mode () const |
| | Returns the current state of the scroll_mode flag.
|
| string | get_title_text () |
| | Returns the text suitable for the title label on the top line.
|
| double | get_vertical_scale () const |
| | Returns total value the height of the vertical axis represents.
|
| PStatView & | get_view () const |
| | Returns the View this chart represents.
|
| int | height_to_pixel (double value) const |
| | Converts a value (i.e.
|
| bool | is_title_unknown () const |
| | Returns true if get_title_text() has never yet returned an answer, false if it has.
|
| void | new_data (int frame_number) |
| | Indicates that new data has become available.
|
| double | pixel_to_height (int y) const |
| | Converts a vertical pixel offset to a value (a "height" in the strip chart).
|
| double | pixel_to_timestamp (int x) const |
| | Converts a horizontal pixel offset to a timestamp.
|
| void | set_auto_vertical_scale () |
| | Sets the vertical scale to make all the data visible.
|
| void | set_average_mode (bool average_mode) |
| | Changes the average_mode flag.
|
| void | set_collector_index (int collector_index) |
| | Changes the collector represented by this strip chart.
|
| void | set_default_vertical_scale () |
| | Sets the vertical scale according to the suggested scale of the base collector, if any, or to center the target frame rate bar otherwise.
|
| void | set_horizontal_scale (double time_width) |
| | Changes the amount of time the width of the horizontal axis represents.
|
| void | set_scroll_mode (bool scroll_mode) |
| | Changes the scroll_mode flag.
|
| void | set_vertical_scale (double value_height) |
| | Changes the value the height of the vertical axis represents.
|
| int | timestamp_to_pixel (double time) const |
| | Converts a timestamp to a horizontal pixel offset.
|
| void | update () |
| | Updates the chart with the latest data.
|
Protected Types |
|
typedef pmap< int, FrameData > | Data |
|
typedef pvector< ColorData > | FrameData |
Protected Member Functions |
| 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 () |
| | Should be overridden by the user class to wipe out the entire strip chart region.
|
| void | compute_average_pixel_data (PStatStripChart::FrameData &result, int &then_i, int &now_i, double now) |
| | Fills the indicated FrameData structure with the color data for the indicated pixel, averaged over the past pstats_average_time seconds.
|
| 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) |
| | 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 | draw_empty (int x, int w) |
| | 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_slice (int x, int w, const FrameData &fdata) |
| | 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 | end_draw (int from_x, int to_x) |
| | Should be overridden by the user class.
|
| 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.
|
| double | get_average_net_value () const |
| | Computes the average value of the chart's collector over the past pstats_average_time number of seconds.
|
| const FrameData & | get_frame_data (int frame_number) |
| | Returns the cached FrameData associated with the given frame number.
|
| double | get_net_value (int frame_number) const |
| | Returns the net value of the chart's collector for the indicated frame number.
|
| 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.
|
| virtual void | normal_guide_bars () |
| | Calls update_guide_bars with parameters suitable to this kind of graph.
|
| virtual void | update_labels () |
| | Resets the list of labels.
|
Static Protected Member Functions |
| static void | accumulate_frame_data (FrameData &fdata, const FrameData &additional, double weight) |
| | Adds the data from additional into the data from fdata, after applying the scale weight.
|
| static void | scale_frame_data (FrameData &fdata, double factor) |
| | Applies the indicated scale to all collector values in data.
|
Protected Attributes |
|
int | _thread_index |
Detailed Description
This is an abstract class that presents the interface for drawing a basic strip-chart, showing the relative value over an interval of time for several different collectors, differentiated by bands of color.
This class just manages all the strip-chart logic; the actual nuts and bolts of drawing pixels is left to a user-derived class.
Definition at line 42 of file pStatStripChart.h.
Member Function Documentation
| void PStatStripChart::accumulate_frame_data |
( |
FrameData & |
fdata, |
|
|
const FrameData & |
additional, |
|
|
double |
weight |
|
) |
| [static, protected] |
| void PStatStripChart::begin_draw |
( |
int |
from_x, |
|
|
int |
to_x |
|
) |
| [protected, virtual] |
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.
| void PStatStripChart::changed_size |
( |
int |
xsize, |
|
|
int |
ysize |
|
) |
| [protected] |
| void PStatStripChart::clear_region |
( |
| ) |
[protected, virtual] |
| void PStatStripChart::compute_average_pixel_data |
( |
PStatStripChart::FrameData & |
result, |
|
|
int & |
then_i, |
|
|
int & |
now_i, |
|
|
double |
now |
|
) |
| [protected] |
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 accumulate_frame_data(), PStatFrameData::get_end(), PStatThreadData::get_frame(), get_frame_data(), PStatThreadData::get_latest_frame_number(), PStatThreadData::get_oldest_time(), PStatFrameData::get_start(), PStatView::get_thread_data(), PStatThreadData::is_empty(), and scale_frame_data().
Referenced by get_collector_under_pixel().
| void PStatStripChart::copy_region |
( |
int |
start_x, |
|
|
int |
end_x, |
|
|
int |
dest_x |
|
) |
| [protected, virtual] |
| void PStatStripChart::draw_cursor |
( |
int |
x | ) |
[protected, virtual] |
| void PStatStripChart::draw_empty |
( |
int |
x, |
|
|
int |
w |
|
) |
| [protected, virtual] |
| void PStatStripChart::draw_slice |
( |
int |
x, |
|
|
int |
w, |
|
|
const FrameData & |
fdata |
|
) |
| [protected, virtual] |
| void PStatStripChart::end_draw |
( |
int |
from_x, |
|
|
int |
to_x |
|
) |
| [protected, virtual] |
| bool PStatStripChart::first_data |
( |
| ) |
const |
Returns true if the chart has seen its first data appear on it, false if it is still a virgin chart.
Definition at line 135 of file pStatStripChart.cxx.
| void PStatStripChart::force_redraw |
( |
| ) |
[protected] |
| void PStatStripChart::force_reset |
( |
| ) |
[protected] |
| bool PStatStripChart::get_average_mode |
( |
| ) |
const [inline] |
Returns the current state of the average_mode flag.
When true, the strip chart will average out the color values over pstats_average_time seconds, which hides spikes and makes the overall trends easier to read. When false, the strip chart shows the actual data as it is happening.
Definition at line 151 of file pStatStripChart.I.
| double PStatStripChart::get_average_net_value |
( |
| ) |
const [protected] |
| int PStatStripChart::get_collector_index |
( |
| ) |
const [inline] |
| int PStatStripChart::get_collector_under_pixel |
( |
int |
xpoint, |
|
|
int |
ypoint |
|
) |
| |
| const PStatStripChart::FrameData & PStatStripChart::get_frame_data |
( |
int |
frame_number | ) |
[protected] |
| double PStatStripChart::get_horizontal_scale |
( |
| ) |
const [inline] |
Returns the amount of total time the width of the horizontal axis represents.
Definition at line 62 of file pStatStripChart.I.
| double PStatStripChart::get_net_value |
( |
int |
frame_number | ) |
const [protected] |
| bool PStatStripChart::get_scroll_mode |
( |
| ) |
const [inline] |
Returns the current state of the scroll_mode flag.
When true, the strip chart will update itself by scrolling to the left; when false, the strip chart will wrap around at the right and restart at the left end without scrolling.
Definition at line 118 of file pStatStripChart.I.
| string PStatStripChart::get_title_text |
( |
| ) |
|
| double PStatStripChart::get_vertical_scale |
( |
| ) |
const [inline] |
| PStatView & PStatStripChart::get_view |
( |
| ) |
const [inline] |
| int PStatStripChart::height_to_pixel |
( |
double |
value | ) |
const [inline] |
| void PStatStripChart::idle |
( |
| ) |
[protected, virtual] |
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 update().
| bool PStatStripChart::is_label_used |
( |
int |
collector_index | ) |
const [inline, protected] |
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 update_labels().
| bool PStatStripChart::is_title_unknown |
( |
| ) |
const |
| void PStatStripChart::new_data |
( |
int |
frame_number | ) |
|
| void PStatStripChart::normal_guide_bars |
( |
| ) |
[protected, virtual] |
| double PStatStripChart::pixel_to_height |
( |
int |
y | ) |
const [inline] |
| double PStatStripChart::pixel_to_timestamp |
( |
int |
x | ) |
const [inline] |
| void PStatStripChart::scale_frame_data |
( |
FrameData & |
fdata, |
|
|
double |
factor |
|
) |
| [static, protected] |
| void PStatStripChart::set_auto_vertical_scale |
( |
| ) |
|
| void PStatStripChart::set_average_mode |
( |
bool |
average_mode | ) |
[inline] |
| void PStatStripChart::set_collector_index |
( |
int |
collector_index | ) |
|
| void PStatStripChart::set_default_vertical_scale |
( |
| ) |
|
| void PStatStripChart::set_horizontal_scale |
( |
double |
time_width | ) |
[inline] |
| void PStatStripChart::set_scroll_mode |
( |
bool |
scroll_mode | ) |
[inline] |
Changes the scroll_mode flag.
When true, the strip chart will update itself by scrolling to the left; when false, the strip chart will wrap around at the right and restart at the left end without scrolling.
Definition at line 101 of file pStatStripChart.I.
| void PStatStripChart::set_vertical_scale |
( |
double |
value_height | ) |
[inline] |
| int PStatStripChart::timestamp_to_pixel |
( |
double |
time | ) |
const [inline] |
| void PStatStripChart::update |
( |
| ) |
|
Updates the chart with the latest data.
Definition at line 90 of file pStatStripChart.cxx.
References PStatMonitor::get_client_data(), PStatThreadData::get_frame(), PStatThreadData::get_latest_frame_number(), PStatView::get_level_index(), PStatGraph::get_monitor(), PStatClientData::get_num_collectors(), PStatClientData::get_num_threads(), PStatFrameData::get_start(), PStatView::get_thread_data(), idle(), PStatThreadData::is_empty(), and update_labels().
Referenced by WinStatsStripChart::new_data(), and GtkStatsStripChart::new_data().
| void PStatStripChart::update_labels |
( |
| ) |
[protected, virtual] |
The documentation for this class was generated from the following files:
| | |