PStatThread

class PStatThread

A lightweight class that represents a single thread of execution to PStats. It corresponds one-to-one with Panda’s Thread instance.

Inheritance diagram

Inheritance diagram of PStatThread

PStatThread(PStatClient *client, int index)
PStatThread(Thread *thread, PStatClient *client = nullptr)
PStatThread(PStatThread const &copy)

Normally, this constructor is called only from PStatClient. Use one of the constructors below to create your own Thread.

Normally, this constructor is called only from PStatClient. Use one of the constructors below to create your own Thread.

Creates a new named thread. This will be used to unify tasks that share a common thread, and differentiate tasks that occur in different threads.

void add_frame(PStatFrameData const &frame_data)

This is a slightly lower-level version of new_frame that also specifies the data to send for this frame.

int get_index(void) const

Returns the index number of this particular thread within the PStatClient.

Thread *get_thread(void) const

Returns the Panda Thread object associated with this particular PStatThread.

void new_frame(void)

This must be called at the start of every “frame”, whatever a frame may be deemed to be, to accumulate all the stats that have collected so far for the thread and ship them off to the server.

Calling PStatClient::thread_tick() will automatically call this for any threads with the indicated sync name.