26 _outStream = outStream;
27 _show_raw_data = show_raw_data;
66 int server_major,
int server_minor) {
70 <<
". Client uses PStats version "
71 << client_major <<
"." << client_minor
72 <<
", while server expects PStats version "
73 << server_major <<
"." << server_minor <<
".\n";
83new_data(
int thread_index,
int frame_number) {
93 (*_outStream) <<
"\rThread "
95 <<
" frame " << frame_number <<
", "
101 (*_outStream) <<
"raw data:\n";
103 for (
int i = 0; i < num_events; ++i) {
106 sprintf(formatted,
"%15.06lf", frame_data.
get_time(i));
107 (*_outStream) << formatted;
110 (*_outStream) <<
" start ";
112 (*_outStream) <<
" stop ";
122 for (
int i = 0; i < num_children; i++) {
127 for (
int tc = 0; tc < num_toplevel_collectors; tc++) {
135 show_level(level, 2);
151 nout <<
"Lost connection.\n";
177 indent((*_outStream), indent_level)
178 << def._name <<
" = " << level->
get_net_value() * 1000.0 <<
" ms\n" ;
181 for (
int i = 0; i < num_children; i++) {
182 show_ms(level->
get_child(i), indent_level + 2);
196 indent((*_outStream), indent_level)
198 << def._level_units <<
"\n";
201 for (
int i = 0; i < num_children; i++) {
202 show_level(level->
get_child(i), indent_level + 2);
The data associated with a particular client, but not with any one particular frame or thread: the li...
std::string get_collector_fullname(int index) const
Returns the "full name" of the indicated collector.
const PStatCollectorDef & get_collector_def(int index) const
Returns the nth collector definition.
std::string get_thread_name(int index) const
Returns the name of the indicated thread.
int get_num_toplevel_collectors() const
Returns the total number of collectors that are toplevel collectors.
bool has_collector(int index) const
Returns true if the indicated collector has been defined by the client already, false otherwise.
int get_toplevel_collector(int index) const
Returns the collector index of the nth toplevel collector.
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...
Defines the details about the Collectors: the name, the suggested color, etc.
Contains the raw timing and level data for a single frame.
double get_time(size_t n) const
Returns the timestamp of the nth event, in seconds elapsed since some undefined epoch (which is guara...
int get_time_collector(size_t n) const
Returns the index of the collector associated with the nth event.
bool is_start(size_t n) const
Returns true if the nth event represents a start event, or false if it represents a stop event.
size_t get_num_events() const
Returns the number of individual events stored in the FrameData.
This is an abstract class that presents the interface to any number of different front-ends for the s...
std::string get_client_progname() const
Returns the program name of the client we're connected to, if known.
PStatView & get_level_view(int collector_index, int thread_index)
Returns a view on the level value (as opposed to elapsed time) for the given collector over the given...
std::string get_client_hostname() const
Returns the hostname of the client we're connected to, if known.
const PStatClientData * get_client_data() const
Returns the client data associated with this monitor.
PStatView & get_view(int thread_index)
Returns a view on the given thread index.
PStatServer * get_server()
Returns the server that owns this monitor.
A collection of FrameData structures for recently-received frames within a particular thread.
double get_frame_rate() const
Computes the average frame rate over the past pstats_average_time seconds, by counting up the number ...
const PStatFrameData & get_frame(int frame_number) const
Returns a FrameData structure associated with the indicated frame number.
int get_latest_frame_number() const
Returns the frame number of the most recent frame stored in the data.
This is a single level value, or band of color, within a View.
const PStatViewLevel * get_child(int n) const
Returns the nth child of this Level/Collector.
double get_net_value() const
Returns the total level value (or elapsed time) represented by this Collector, including all values i...
int get_num_children() const
Returns the number of children of this Level/Collector.
int get_collector() const
Returns the Collector index associated with this level.
A View boils down the frame data to a linear list of times spent in a number of different Collectors,...
double get_net_value() const
Returns the total value accounted for by the frame (or by whatever Collector we are constrained to).
const PStatViewLevel * get_top_level()
Returns a pointer to the level that corresponds to the Collector we've constrained to.
void set_to_frame(const PStatFrameData &frame_data)
Supplies the View with the data for the current frame.
const PStatThreadData * get_thread_data()
Returns the current PStatThreadData associated with the view.
bool all_collectors_known() const
After a call to set_to_frame(), this returns true if all collectors in the FrameData are known by the...
virtual void lost_connection()
Called whenever the connection to the client has been lost.
virtual void got_bad_version(int client_major, int client_minor, int server_major, int server_minor)
Like got_hello(), this is called when the "hello" message has been received from the client.
virtual void new_data(int thread_index, int frame_number)
Called as each frame's data is made available.
TextStats * get_server()
Returns the server that owns this monitor.
virtual void got_hello()
Called when the "hello" message has been received from the client.
virtual std::string get_monitor_name()
Should be redefined to return a descriptive name for the type of PStatsMonitor this is.
virtual bool is_thread_safe()
Should be redefined to return true if this monitor class can handle running in a sub-thread.
A simple, scrolling-text stats server.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
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.