Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File 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>

List of all members.

Public Member Functions

 PStatView ()
 ~PStatView ()
void constrain (int collector, bool show_level)
 Changes the focus of the View.

void unconstrain ()
 Restores the view to the full frame.

void set_thread_data (const PStatThreadData *thread_data)
const PStatThreadDataget_thread_data ()
 Returns the current PStatThreadData associated with the view.

const PStatClientDataget_client_data ()
 Returns the current PStatClientData associated with the view.

void set_to_frame (const PStatFrameData &frame_data)
 Supplies the View with the data for the current frame.

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_time (float time)
 Sets to the frame that occurred at the indicated time (or the nearest available frame), extracted from the View's PStatThreadData pointer.

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).

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

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.

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.


Private Types

typedef pmap< int, PStatViewLevel * > Levels

Private Member Functions

void update_time_data (const PStatFrameData &frame_data)
 The implementation of set_to_frame() for views that show elapsed time.

void update_level_data (const PStatFrameData &frame_data)
 The implementation of set_to_frame() for views that show level values.

void clear_levels ()
 Resets all the levels that have been defined so far.

bool reset_level (PStatViewLevel *level)
 Resets the total value of the Level to zero, and also makes sure it is parented to the right Level corresponding to its Collector's parent.


Private Attributes

int _constraint
bool _show_level
bool _all_collectors_known
Levels _levels
int _level_index
ConstPointerTo< PStatClientData_client_data
ConstPointerTo< PStatThreadData_thread_data


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


Member Typedef Documentation

typedef pmap<int, PStatViewLevel *> PStatView::Levels [private]
 

Definition at line 85 of file pStatView.h.


Constructor & Destructor Documentation

PStatView::PStatView  ) 
 

Definition at line 146 of file pStatView.cxx.

References clear_levels().

PStatView::~PStatView  ) 
 

Definition at line 161 of file pStatView.cxx.

References _constraint, _show_level, and clear_levels().


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

References PStatViewLevel::_collector, _levels, PStatViewLevel::_parent, NULL, and reset_level().

void PStatView::clear_levels  )  [private]
 

Resets all the levels that have been defined so far.

Definition at line 626 of file pStatView.cxx.

Referenced by PStatView(), and ~PStatView().

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

References _client_data, _thread_data, ConstPointerTo< PStatClientData >::is_null(), ConstPointerTo< PStatThreadData >::is_null(), and nassertv.

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

References _thread_data, INLINE, and set_to_frame().

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

References _levels.

Referenced by PStatStripChart::get_collector_under_pixel(), and set_to_frame().

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

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

References _all_collectors_known, _client_data, PStatFrameData::get_num_events(), PStatFrameData::get_time_collector(), and PStatFrameData::is_start().

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

References _client_data, and INLINE.

Referenced by PStatStripChart::draw_cursor(), PStatStripChart::get_collector_under_pixel(), and PStatStripChart::new_data().

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

References _all_collectors_known, and _client_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 359 of file pStatView.cxx.

bool PStatView::reset_level PStatViewLevel level  )  [private]
 

Resets the total value of the Level to zero, and also makes sure it is parented to the right Level corresponding to its Collector's parent.

Since the client might change its mind from time to time about who the Collector is parented to, we have to update this dynamically.

Returns true if any change was made to the level's hierarchy, false otherwise.

Definition at line 659 of file pStatView.cxx.

Referenced by all_collectors_known().

void PStatView::set_thread_data const PStatThreadData thread_data  ) 
 

Definition at line 235 of file pStatView.cxx.

References _all_collectors_known.

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

References _level_index, and INLINE.

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

References _constraint, and get_level().

Referenced by get_client_data(), and PStatStripChart::get_collector_under_pixel().

void PStatView::set_to_time float  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 93 of file pStatView.I.

void PStatView::unconstrain  ) 
 

Restores the view to the full frame.

This is equivalent to calling constrain(0).

Definition at line 223 of file pStatView.cxx.

References update_level_data().

void PStatView::update_level_data const PStatFrameData frame_data  )  [private]
 

The implementation of set_to_frame() for views that show level values.

Definition at line 520 of file pStatView.cxx.

Referenced by unconstrain().

void PStatView::update_time_data const PStatFrameData frame_data  )  [private]
 

The implementation of set_to_frame() for views that show elapsed time.

Definition at line 409 of file pStatView.cxx.


Member Data Documentation

bool PStatView::_all_collectors_known [private]
 

Definition at line 83 of file pStatView.h.

Referenced by get_net_value(), get_top_level(), and set_thread_data().

ConstPointerTo< PStatClientData > PStatView::_client_data [private]
 

Definition at line 90 of file pStatView.h.

Referenced by constrain(), get_net_value(), get_thread_data(), and get_top_level().

int PStatView::_constraint [private]
 

Definition at line 81 of file pStatView.h.

Referenced by set_to_frame(), and ~PStatView().

int PStatView::_level_index [private]
 

Definition at line 88 of file pStatView.h.

Referenced by set_to_frame().

Levels PStatView::_levels [private]
 

Definition at line 86 of file pStatView.h.

Referenced by all_collectors_known(), and get_level().

bool PStatView::_show_level [private]
 

Definition at line 82 of file pStatView.h.

Referenced by ~PStatView().

ConstPointerTo< PStatThreadData > PStatView::_thread_data [private]
 

Definition at line 91 of file pStatView.h.

Referenced by constrain(), and get_client_data().


The documentation for this class was generated from the following files:
Generated on Fri May 2 03:27:54 2003 for Panda-Tool by doxygen1.3