60 void set_client_name(
const std::string &name);
61 std::string get_client_name()
const;
62 void set_max_rate(
double rate);
63 double get_max_rate()
const;
65 INLINE
int get_num_collectors()
const;
67 MAKE_SEQ(get_collectors, get_num_collectors, get_collector);
69 std::string get_collector_name(
int index)
const;
70 std::string get_collector_fullname(
int index)
const;
72 INLINE
int get_num_threads()
const;
74 MAKE_SEQ(get_threads, get_num_threads, get_thread);
75 INLINE std::string get_thread_name(
int index)
const;
76 INLINE std::string get_thread_sync_name(
int index)
const;
77 INLINE PT(
Thread) get_thread_object(
int index)
const;
82 double get_real_time()
const;
84 MAKE_PROPERTY(client_name, get_client_name, set_client_name);
85 MAKE_PROPERTY(max_rate, get_max_rate, set_max_rate);
86 MAKE_SEQ_PROPERTY(collectors, get_num_collectors, get_collector);
87 MAKE_SEQ_PROPERTY(threads, get_num_threads, get_thread);
88 MAKE_PROPERTY(main_thread, get_main_thread);
89 MAKE_PROPERTY(current_thread, get_current_thread);
90 MAKE_PROPERTY(real_time, get_real_time);
92 EXTEND INLINE
static bool connect(
const std::string &hostname = std::string(),
int port = -1);
93 EXTEND INLINE
static void disconnect();
96 INLINE
static void resume_after_pause();
98 static void main_tick();
99 static void thread_tick(
const std::string &sync_name);
101 void client_main_tick();
102 void client_thread_tick(
const std::string &sync_name);
103 EXTEND
bool client_connect(std::string hostname,
int port);
104 EXTEND
void client_disconnect();
105 bool client_is_connected()
const;
107 void client_resume_after_pause();
112 INLINE
bool has_impl()
const;
113 INLINE PStatClientImpl *get_impl();
114 INLINE
const PStatClientImpl *get_impl()
const;
115 void make_impl()
const;
117 PStatCollector make_collector_with_relname(
int parent_index, std::string relname);
118 PStatCollector make_collector_with_name(
int parent_index,
const std::string &name);
122 PStatThread make_gpu_thread(
const std::string &name);
124 bool is_active(
int collector_index,
int thread_index)
const;
125 bool is_started(
int collector_index,
int thread_index)
const;
127 void start(
int collector_index,
int thread_index);
128 void start(
int collector_index,
int thread_index,
double as_of);
129 void stop(
int collector_index,
int thread_index);
130 void stop(
int collector_index,
int thread_index,
double as_of);
132 void clear_level(
int collector_index,
int thread_index);
133 void set_level(
int collector_index,
int thread_index,
double level);
134 void add_level(
int collector_index,
int thread_index,
double increment);
135 double get_level(
int collector_index,
int thread_index)
const;
137 static void start_clock_wait();
138 static void start_clock_busy_wait();
139 static void stop_clock_wait();
142 class InternalThread;
143 void add_collector(Collector *collector);
144 void add_thread(InternalThread *thread);
146 INLINE Collector *get_collector_ptr(
int collector_index)
const;
147 INLINE InternalThread *get_thread_ptr(
int thread_index)
const;
158 MultiThingsByName _threads_by_name, _threads_by_sync_name;
162 class PerThreadData {
173 class EXPCL_PANDA_PSTATCLIENT Collector {
175 INLINE Collector(
int parent_index,
const std::string &name);
176 INLINE
int get_parent_index()
const;
177 INLINE
const std::string &get_name()
const;
178 INLINE
bool is_active()
const;
182 void make_def(
const PStatClient *client,
int this_index);
195 ThingsByName _children;
196 PerThread _per_thread;
198 typedef Collector *CollectorPointer;
199 AtomicAdjust::Pointer _collectors;
200 AtomicAdjust::Integer _collectors_size;
201 AtomicAdjust::Integer _num_collectors;
206 class InternalThread {
208 InternalThread(
Thread *thread);
209 InternalThread(
const std::string &name,
const std::string &sync_name =
"Main");
213 std::string _sync_name;
227 typedef InternalThread *ThreadPointer;
228 AtomicAdjust::Pointer _threads;
229 AtomicAdjust::Integer _threads_size;
230 AtomicAdjust::Integer _num_threads;
232 mutable PStatClientImpl *_impl;
253 friend class Collector;
256 friend class PStatClientImpl;
271 void set_client_name(
const std::string &name);
272 std::string get_client_name()
const;
273 void set_max_rate(
double rate);
274 double get_max_rate()
const;
277 std::string get_collector_name(
int index)
const;
278 std::string get_collector_fullname(
int index)
const;
284 INLINE PT(
Thread) get_thread_object(
int index)
const {
return nullptr; }
289 double get_real_time()
const;
292 INLINE
static bool connect(
const std::string & = std::string(),
int = -1) {
return false; }
297 static void main_tick();
298 static void thread_tick(
const std::string &);
301 void client_main_tick();
302 void client_thread_tick(
const std::string &sync_name);
303 bool client_connect(std::string hostname,
int port);
304 void client_disconnect();
305 bool client_is_connected()
const;
307 void client_resume_after_pause();
314 PStatCollector make_collector_with_relname(
int parent_index, std::string relname);
317 bool is_active(
int collector_index,
int thread_index)
const;
318 bool is_started(
int collector_index,
int thread_index)
const;
320 void start(
int collector_index,
int thread_index);
321 void start(
int collector_index,
int thread_index,
double as_of);
322 void stop(
int collector_index,
int thread_index);
323 void stop(
int collector_index,
int thread_index,
double as_of);
325 void clear_level(
int collector_index,
int thread_index);
326 void set_level(
int collector_index,
int thread_index,
double level);
327 void add_level(
int collector_index,
int thread_index,
double increment);
328 double get_level(
int collector_index,
int thread_index)
const;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A dynamic array with an unlimited number of bits.
The default class template does not define any methods.
Encapsulates all the communication with a particular instance of a given rendering backend.
This is a standard, non-reentrant mutex, similar to the Mutex class.
Manages the communications to report statistics via a network connection to a remote PStatServer.
std::string get_thread_sync_name(int index) const
Returns the sync_name of the indicated thread.
static void resume_after_pause()
Resumes the PStatClient after the simulation has been paused for a while.
static void disconnect()
Closes the connection previously established.
int get_num_threads() const
Returns the total number of threads the Client knows about.
static bool is_connected()
Returns true if the client believes it is connected to a working PStatServer, false otherwise.
std::string get_thread_name(int index) const
Returns the name of the indicated thread.
Defines the details about the Collectors: the name, the suggested color, etc.
A lightweight class that represents a single element that may be timed and/or counted via stats.
Contains the raw timing and level data for a single frame.
A lightweight class that represents a single thread of execution to PStats.
virtual void deactivate_hook(Thread *thread)
Called when the thread is deactivated (swapped for another running thread).
virtual void activate_hook(Thread *thread)
Called when the thread is activated (resumes execution).
A thread; that is, a lightweight process.
get_main_thread
Returns a pointer to the "main" Thread object–this is the Thread that started the whole process.
bool start(ThreadPriority priority, bool joinable)
Starts the thread executing.
get_current_thread
Returns a pointer to the currently-executing Thread object.
is_started
Returns true if the thread has been started, false if it has not, or if join() has already been calle...
This is our own Panda specialization on the default STL map.
This is our own Panda specialization on the default STL vector.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool is_connected(MObject &node, const string &attribute_name)
Returns true if the named connection exists on the node and is connected to anything,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.