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