00001 // Filename: pStatView.h 00002 // Created by: drose (10Jul00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef PSTATVIEW_H 00020 #define PSTATVIEW_H 00021 00022 #include <pandatoolbase.h> 00023 00024 #include "pStatClientData.h" 00025 #include "pStatThreadData.h" 00026 #include "pStatViewLevel.h" 00027 00028 #include <pointerTo.h> 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Class : PStatView 00032 // Description : A View boils down the frame data to a linear list of 00033 // times spent in a number of different Collectors, 00034 // within a particular thread. This automatically 00035 // accounts for overlapping start/stop times and nested 00036 // Collectors in a sensible way. 00037 //////////////////////////////////////////////////////////////////// 00038 class PStatView { 00039 public: 00040 PStatView(); 00041 ~PStatView(); 00042 00043 void constrain(int collector, bool show_level); 00044 void unconstrain(); 00045 00046 void set_thread_data(const PStatThreadData *thread_data); 00047 INLINE const PStatThreadData *get_thread_data(); 00048 INLINE const PStatClientData *get_client_data(); 00049 00050 void set_to_frame(const PStatFrameData &frame_data); 00051 INLINE void set_to_frame(int frame_number); 00052 INLINE void set_to_time(float time); 00053 00054 bool all_collectors_known() const; 00055 float get_net_value() const; 00056 00057 const PStatViewLevel *get_top_level(); 00058 00059 bool has_level(int collector) const; 00060 PStatViewLevel *get_level(int collector); 00061 00062 INLINE int get_level_index() const; 00063 00064 private: 00065 void update_time_data(const PStatFrameData &frame_data); 00066 void update_level_data(const PStatFrameData &frame_data); 00067 00068 void clear_levels(); 00069 bool reset_level(PStatViewLevel *level); 00070 00071 int _constraint; 00072 bool _show_level; 00073 bool _all_collectors_known; 00074 00075 typedef pmap<int, PStatViewLevel *> Levels; 00076 Levels _levels; 00077 00078 int _level_index; 00079 00080 CPT(PStatClientData) _client_data; 00081 CPT(PStatThreadData) _thread_data; 00082 }; 00083 00084 #include "pStatView.I" 00085 00086 #endif 00087