40 Collectors::const_iterator ci;
41 for (ci = _collectors.begin(); ci != _collectors.end(); ++ci) {
60 if (_is_alive && _reader !=
nullptr) {
72 return _collectors.size();
82 return (index >= 0 && index < (
int)_collectors.size() &&
83 _collectors[index]._def !=
nullptr);
92 return _null_collector;
94 return *_collectors[index]._def;
121 if (def->_parent_index == 0) {
136 bool any_changed =
false;
137 slot_collector(index);
138 nassertr(index >= 0 && index < (
int)_collectors.size(),
false);
140 if (_collectors[index]._is_level.get_bit(thread_index) != flag) {
142 _collectors[index]._is_level.set_bit_to(thread_index, flag);
149 if (def !=
nullptr && def->_parent_index != 0) {
166 return (index >= 0 && index < (
int)_collectors.size() &&
167 _collectors[index]._is_level.get_bit(thread_index));
176 return _toplevel_collectors.size();
186 nassertr(n >= 0 && n < (
int)_toplevel_collectors.size(), 0);
187 return _toplevel_collectors[n];
195 return _threads.size();
205 return (index >= 0 && index < (
int)_threads.size() &&
206 !_threads[index]._name.empty());
217 return _threads[index]._name;
227 nassertr(index >= 0 && index < (
int)_threads.size(),
nullptr);
228 return _threads[index]._data;
240 if (parent == child) {
263 slot_collector(def->_index);
264 nassertv(def->_index >= 0 && def->_index < (
int)_collectors.size());
266 if (_collectors[def->_index]._def !=
nullptr) {
268 delete _collectors[def->_index]._def;
271 _collectors[def->_index]._def = def;
272 update_toplevel_collectors();
276 const BitArray &is_level = _collectors[def->_index]._is_level;
278 for (
int thread_index = 0; thread_index < max_threads; ++thread_index) {
279 if (is_level.
get_bit(thread_index)) {
292 nassertv(thread_index < 1000);
295 while ((
int)_threads.size() <= thread_index) {
296 _threads.push_back(Thread());
300 _threads[thread_index]._name = name;
303 if (_threads[thread_index]._data.is_null()) {
320 nassertv(thread_index >= 0 && thread_index < (
int)_threads.size());
321 _threads[thread_index]._data->record_new_frame(frame_number, frame_data);
328 void PStatClientData::
329 slot_collector(
int collector_index) {
331 nassertv(collector_index < 100000);
333 while ((
int)_collectors.size() <= collector_index) {
335 collector._def =
nullptr;
336 _collectors.push_back(collector);
343 void PStatClientData::
344 update_toplevel_collectors() {
345 _toplevel_collectors.clear();
347 Collectors::const_iterator ci;
348 for (ci = _collectors.begin(); ci != _collectors.end(); ++ci) {
350 if (def !=
nullptr && def->_parent_index == 0) {
351 _toplevel_collectors.push_back(def->_index);
void add_collector(PStatCollectorDef *def)
Adds a new collector definition to the dataset.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int get_toplevel_collector(int index) const
Returns the collector index of the nth toplevel collector.
void close()
Closes the client connection if it is open.
bool get_bit(int index) const
Returns true if the nth bit is set, false if it is cleared.
bool set_collector_has_level(int index, int thread_index, bool flag)
Indicates whether the given collector has level data (and consequently, whether it should appear on t...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The data associated with a particular client, but not with any one particular frame or thread: the li...
int get_child_distance(int parent, int child) const
Returns the number of Collectors between the indicated parent and the child Collector in the relation...
const PStatCollectorDef & get_collector_def(int index) const
Returns the nth collector definition.
std::string get_collector_fullname(int index) const
Returns the "full name" of the indicated collector.
int get_num_threads() const
Returns the total number of threads the Data knows about.
void record_new_frame(int thread_index, int frame_number, PStatFrameData *frame_data)
Makes room for and stores a new frame's worth of data associated with some particular thread (which m...
std::string get_collector_name(int index) const
Returns the name of the indicated collector.
A dynamic array with an unlimited number of bits.
bool has_collector(int index) const
Returns true if the indicated collector has been defined by the client already, false otherwise.
This is the class that does all the work for handling communications from a single Panda client.
bool is_alive() const
Returns true if the data is actively getting filled by a connected client, or false if the client has...
bool has_thread(int index) const
Returns true if the indicated thread has been defined by the client already, false otherwise.
Contains the raw timing and level data for a single frame.
int get_num_collectors() const
Returns the total number of collectors the Data knows about.
A collection of FrameData structures for recently-received frames within a particular thread.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
const PStatThreadData * get_thread_data(int index) const
Returns the data associated with the indicated thread.
void define_thread(int thread_index, const std::string &name=std::string())
Adds a new thread definition to the dataset.
size_t get_num_bits() const
Returns the current number of possibly different bits in this array.
Defines the details about the Collectors: the name, the suggested color, etc.
int get_num_toplevel_collectors() const
Returns the total number of collectors that are toplevel collectors.
void close()
This will be called by the PStatClientData in response to its close() call.
std::string get_thread_name(int index) const
Returns the name of the indicated thread.
bool get_collector_has_level(int index, int thread_index) const
Returns whether the given collector has level data (and consequently, whether it should appear on the...