Panda3D
Public Member Functions

PStatView Class Reference

A View boils down the frame data to a linear list of times spent in a number of different Collectors, within a particular thread. More...

#include "pStatView.h"

List of all members.

Public Member Functions

bool all_collectors_known () const
 After a call to set_to_frame(), this returns true if all collectors in the FrameData are known by the PStatsData object, or false if some are still unknown (even those that do not appear in the view).
void constrain (int collector, bool show_level)
 Changes the focus of the View.
const PStatClientDataget_client_data ()
 Returns the current PStatClientData associated with the view.
PStatViewLevelget_level (int collector)
 Returns a pointer to the level that corresponds to the indicated Collector.
int get_level_index () const
 Returns an index number that can be used to determine when the set of known levels has changed.
double get_net_value () const
 Returns the total value accounted for by the frame (or by whatever Collector we are constrained to).
bool get_show_level () const
 Returns true if we are showing level data, false if time data.
const PStatThreadDataget_thread_data ()
 Returns the current PStatThreadData associated with the view.
const PStatViewLevelget_top_level ()
 Returns a pointer to the level that corresponds to the Collector we've constrained to.
bool has_level (int collector) const
 Returns true if there is a level defined for the particular collector, false otherwise.
void set_thread_data (const PStatThreadData *thread_data)
void set_to_frame (int frame_number)
 Sets to a particular frame number (or the nearest available), extracted from the View's PStatThreadData pointer.
void set_to_frame (const PStatFrameData &frame_data)
 Supplies the View with the data for the current frame.
void set_to_time (double time)
 Sets to the frame that occurred at the indicated time (or the nearest available frame), extracted from the View's PStatThreadData pointer.
void unconstrain ()
 Restores the view to the full frame.

Detailed Description

A View boils down the frame data to a linear list of times spent in a number of different Collectors, within a particular thread.

This automatically accounts for overlapping start/stop times and nested Collectors in a sensible way.

Definition at line 34 of file pStatView.h.


Member Function Documentation

bool PStatView::all_collectors_known ( ) const

After a call to set_to_frame(), this returns true if all collectors in the FrameData are known by the PStatsData object, or false if some are still unknown (even those that do not appear in the view).

Definition at line 237 of file pStatView.cxx.

Referenced by TextMonitor::new_data().

void PStatView::constrain ( int  collector,
bool  show_level 
)

Changes the focus of the View.

By default, the View reports the entire time for the frame, and all of the Collectors that are directly parented to "Frame". By constraining the view to a particular collector, you cause the View to zoom in on that collector's data, reporting only the collector and its immediate parents.

When you constrain the view, you may also specify whether the view should show time data or level data for the indicated collector. If level data, it reports the levels for the collector, and all of its children; otherwise, it collects the elapsed time.

Changing the constraint causes the current frame's data to become invalidated; you must then call set_to_frame() again to get any useful data out.

Definition at line 170 of file pStatView.cxx.

Referenced by unconstrain().

const PStatClientData * PStatView::get_client_data ( ) [inline]

Returns the current PStatClientData associated with the view.

This was also set by a previous call to set_thread_data().

Definition at line 37 of file pStatView.I.

PStatViewLevel * PStatView::get_level ( int  collector)

Returns a pointer to the level that corresponds to the indicated Collector.

If there is no such level in the view, one will be created--use with caution. Check has_level() first if you don't want this behavior.

Definition at line 297 of file pStatView.cxx.

Referenced by PStatStripChart::get_frame_data(), get_top_level(), and PStatStripChart::update_labels().

int PStatView::get_level_index ( ) const [inline]

Returns an index number that can be used to determine when the set of known levels has changed.

Each time the set of levels in the view changes (because of new data arriving from the client, for instance), this number is incremented.

Definition at line 89 of file pStatView.I.

Referenced by WinStatsChartMenu::check_update(), GtkStatsChartMenu::check_update(), WinStatsChartMenu::do_update(), GtkStatsChartMenu::do_update(), PStatStripChart::update(), and PStatStripChart::update_labels().

double PStatView::get_net_value ( ) const

Returns the total value accounted for by the frame (or by whatever Collector we are constrained to).

This is the sum of all of the individual levels' get_net_value() value.

Definition at line 250 of file pStatView.cxx.

Referenced by TextMonitor::new_data().

bool PStatView::get_show_level ( ) const [inline]

Returns true if we are showing level data, false if time data.

Definition at line 75 of file pStatView.I.

Referenced by PStatStripChart::get_average_net_value(), and PStatStripChart::get_title_text().

const PStatThreadData * PStatView::get_thread_data ( ) [inline]
const PStatViewLevel * PStatView::get_top_level ( )

Returns a pointer to the level that corresponds to the Collector we've constrained to.

This is the top of a graph of levels; typically the next level down--the children of this level--will be the levels you want to display to the user.

Definition at line 270 of file pStatView.cxx.

References get_level().

Referenced by WinStatsChartMenu::do_update(), GtkStatsChartMenu::do_update(), and TextMonitor::new_data().

bool PStatView::has_level ( int  collector) const

Returns true if there is a level defined for the particular collector, false otherwise.

Definition at line 281 of file pStatView.cxx.

void PStatView::set_to_frame ( int  frame_number) [inline]

Sets to a particular frame number (or the nearest available), extracted from the View's PStatThreadData pointer.

See the comments in the other flavor of set_to_frame().

Definition at line 51 of file pStatView.I.

References set_to_frame().

void PStatView::set_to_frame ( const PStatFrameData frame_data)

Supplies the View with the data for the current frame.

This causes the View to update all of its internal data to reflect the frame's data, subject to the current constraint.

It is possible that calling this will increase the total number of reported levels (for instance, if this frame introduced a new collector that hadn't been active previously). In this case, the caller must update its display or whatever to account for the new level.

Definition at line 216 of file pStatView.cxx.

Referenced by PStatStripChart::get_frame_data(), TextMonitor::new_data(), set_to_frame(), and set_to_time().

void PStatView::set_to_time ( double  time) [inline]

Sets to the frame that occurred at the indicated time (or the nearest available frame), extracted from the View's PStatThreadData pointer.

See the comments in set_to_frame.

Definition at line 64 of file pStatView.I.

References set_to_frame().

void PStatView::unconstrain ( )

Restores the view to the full frame.

This is equivalent to calling constrain(0).

Definition at line 183 of file pStatView.cxx.

References constrain().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations