Panda3D
Public Member Functions | List of all members
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"

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). More...
 
void constrain (int collector, bool show_level)
 Changes the focus of the View. More...
 
const PStatClientDataget_client_data ()
 Returns the current PStatClientData associated with the view. More...
 
PStatViewLevelget_level (int collector)
 Returns a pointer to the level that corresponds to the indicated Collector. More...
 
int get_level_index () const
 Returns an index number that can be used to determine when the set of known levels has changed. More...
 
double get_net_value () const
 Returns the total value accounted for by the frame (or by whatever Collector we are constrained to). More...
 
bool get_show_level () const
 Returns true if we are showing level data, false if time data. More...
 
const PStatThreadDataget_thread_data ()
 Returns the current PStatThreadData associated with the view. More...
 
const PStatViewLevelget_top_level ()
 Returns a pointer to the level that corresponds to the Collector we've constrained to. More...
 
bool has_level (int collector) const
 Returns true if there is a level defined for the particular collector, false otherwise. More...
 
void set_thread_data (const PStatThreadData *thread_data)
 
void set_to_frame (const PStatFrameData &frame_data)
 Supplies the View with the data for the current frame. More...
 
void set_to_frame (int frame_number)
 Sets to a particular frame number (or the nearest available), extracted from the View's PStatThreadData pointer. More...
 
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. More...
 
void unconstrain ()
 Restores the view to the full frame. More...
 

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 31 of file pStatView.h.

Member Function Documentation

◆ all_collectors_known()

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 212 of file pStatView.cxx.

Referenced by TextMonitor::new_data().

◆ constrain()

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 157 of file pStatView.cxx.

Referenced by unconstrain().

◆ get_client_data()

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 28 of file pStatView.I.

◆ get_level()

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 260 of file pStatView.cxx.

Referenced by get_top_level().

◆ get_level_index()

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 68 of file pStatView.I.

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

◆ get_net_value()

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 222 of file pStatView.cxx.

Referenced by TextMonitor::new_data().

◆ get_show_level()

bool PStatView::get_show_level ( ) const
inline

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

Definition at line 57 of file pStatView.I.

Referenced by PStatStripChart::get_title_text().

◆ get_thread_data()

const PStatThreadData * PStatView::get_thread_data ( )
inline

Returns the current PStatThreadData associated with the view.

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

Definition at line 19 of file pStatView.I.

Referenced by PStatStripChart::get_collector_under_pixel(), TextMonitor::new_data(), PStatStripChart::set_auto_vertical_scale(), and PStatStripChart::update().

◆ get_top_level()

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 239 of file pStatView.cxx.

References get_level().

◆ has_level()

bool PStatView::has_level ( int  collector) const

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

Definition at line 248 of file pStatView.cxx.

◆ set_to_frame() [1/2]

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 194 of file pStatView.cxx.

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

◆ set_to_frame() [2/2]

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 39 of file pStatView.I.

References set_to_frame().

◆ 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 49 of file pStatView.I.

References set_to_frame().

◆ unconstrain()

void PStatView::unconstrain ( )

Restores the view to the full frame.

This is equivalent to calling constrain(0).

Definition at line 168 of file pStatView.cxx.

References constrain().


The documentation for this class was generated from the following files: