15 #include "pStatClientData.h" 16 #include "pStatReader.h" 18 #include "pStatCollectorDef.h" 43 Collectors::const_iterator ci;
44 for (ci = _collectors.begin(); ci != _collectors.end(); ++ci) {
83 return _collectors.size();
96 return (index >= 0 && index < (
int)_collectors.size() &&
108 return _null_collector;
110 return *_collectors[index]._def;
142 if (def->_parent_index == 0) {
161 bool any_changed =
false;
162 slot_collector(index);
163 nassertr(index >= 0 && index < (
int)_collectors.size(),
false);
165 if (_collectors[index]._is_level.get_bit(thread_index) != flag) {
167 _collectors[index]._is_level.set_bit_to(thread_index, flag);
194 return (index >= 0 && index < (
int)_collectors.size() &&
195 _collectors[index]._is_level.get_bit(thread_index));
207 return _toplevel_collectors.size();
220 nassertr(n >= 0 && n < (
int)_toplevel_collectors.size(), 0);
221 return _toplevel_collectors[n];
232 return _threads.size();
245 return (index >= 0 && index < (
int)_threads.size() &&
246 !_threads[index]._name.empty());
259 return _threads[index]._name;
272 nassertr(index >= 0 && index < (
int)_threads.size(), NULL);
273 return _threads[index]._data;
289 if (parent == child) {
315 slot_collector(def->_index);
316 nassertv(def->_index >= 0 && def->_index < (
int)_collectors.size());
320 delete _collectors[def->_index]._def;
323 _collectors[def->_index]._def = def;
324 update_toplevel_collectors();
328 const BitArray &is_level = _collectors[def->_index]._is_level;
330 for (
int thread_index = 0; thread_index < max_threads; ++thread_index) {
331 if (is_level.
get_bit(thread_index)) {
347 nassertv(thread_index < 1000);
350 while ((
int)_threads.size() <= thread_index) {
351 _threads.push_back(Thread());
355 _threads[thread_index]._name = name;
358 if (_threads[thread_index]._data.is_null()) {
378 nassertv(thread_index >= 0 && thread_index < (
int)_threads.size());
379 _threads[thread_index]._data->record_new_frame(frame_number, frame_data);
388 void PStatClientData::
389 slot_collector(
int collector_index) {
391 nassertv(collector_index < 100000);
393 while ((
int)_collectors.size() <= collector_index) {
396 _collectors.push_back(collector);
405 void PStatClientData::
406 update_toplevel_collectors() {
407 _toplevel_collectors.clear();
409 Collectors::const_iterator ci;
410 for (ci = _collectors.begin(); ci != _collectors.end(); ++ci) {
413 _toplevel_collectors.push_back(def->_index);
void add_collector(PStatCollectorDef *def)
Adds a new collector definition to the dataset.
int get_num_bits() const
Returns the current number of possibly different bits in this array.
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...
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.
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...
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...
const PStatThreadData * get_thread_data(int index) const
Returns the data associated with the indicated thread.
Defines the details about the Collectors: the name, the suggested color, etc.
void define_thread(int thread_index, const string &name=string())
Adds a new thread definition to the dataset.
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.
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...