15 #include "textMonitor.h"
16 #include "textStats.h"
17 #include "pStatCollectorDef.h"
18 #include "pStatFrameData.h"
29 _outStream = outStream;
30 _show_raw_data = show_raw_data;
80 int server_major,
int server_minor) {
84 <<
". Client uses PStats version "
85 << client_major <<
"." << client_minor
86 <<
", while server expects PStats version "
87 << server_major <<
"." << server_minor <<
".\n";
110 (*_outStream) <<
"\rThread "
112 <<
" frame " << frame_number <<
", "
116 if (_show_raw_data) {
118 (*_outStream) <<
"raw data:\n";
120 for (
int i = 0; i < num_events; ++i) {
123 sprintf(formatted,
"%15.06lf", frame_data.
get_time(i));
124 (*_outStream) << formatted;
127 (*_outStream) <<
" start ";
129 (*_outStream) <<
" stop ";
139 for (
int i = 0; i < num_children; i++) {
144 for (
int tc = 0; tc < num_toplevel_collectors; tc++) {
152 show_level(level, 2);
171 nout <<
"Lost connection.\n";
202 indent((*_outStream), indent_level)
203 << def._name <<
" = " << level->
get_net_value() * 1000.0 <<
" ms\n" ;
206 for (
int i = 0; i < num_children; i++) {
207 show_ms(level->
get_child(i), indent_level + 2);
223 indent((*_outStream), indent_level)
225 << def._level_units <<
"\n";
228 for (
int i = 0; i < num_children; i++) {
229 show_level(level->
get_child(i), indent_level + 2);
string get_thread_name(int index) const
Returns the name of the indicated thread.
const PStatViewLevel * get_top_level()
Returns a pointer to the level that corresponds to the Collector we've constrained to...
string get_client_progname() const
Returns the program name of the client we're connected to, if known.
const PStatViewLevel * get_child(int n) const
Returns the nth child of this Level/Collector.
void set_to_frame(const PStatFrameData &frame_data)
Supplies the View with the data for the current frame.
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...
The data associated with a particular client, but not with any one particular frame or thread: the li...
virtual string get_monitor_name()
Should be redefined to return a descriptive name for the type of PStatsMonitor this is...
string get_collector_fullname(int index) const
Returns the "full name" of the indicated collector.
virtual void lost_connection()
Called whenever the connection to the client has been lost.
int get_time_collector(int n) const
Returns the index of the collector associated with the nth event.
TextStats * get_server()
Returns the server that owns this monitor.
bool has_collector(int index) const
Returns true if the indicated collector has been defined by the client already, false otherwise...
This is a single level value, or band of color, within a View.
A simple, scrolling-text stats server.
This is an abstract class that presents the interface to any number of different front-ends for the s...
bool is_start(int n) const
Returns true if the nth event represents a start event, or false if it represents a stop event...
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...
int get_num_events() const
Returns the number of individual events stored in the FrameData.
string get_client_hostname() const
Returns the hostname of the client we're connected to, if known.
PStatServer * get_server()
Returns the server that owns this monitor.
const PStatCollectorDef & get_collector_def(int index) const
Returns the nth collector definition.
Contains the raw timing and level data for a single frame.
A View boils down the frame data to a linear list of times spent in a number of different Collectors...
PStatView & get_view(int thread_index)
Returns a view on the given thread index.
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...
A collection of FrameData structures for recently-received frames within a particular thread...
int get_toplevel_collector(int index) const
Returns the collector index of the nth toplevel collector.
const PStatClientData * get_client_data() const
Returns the client data associated with this monitor.
double get_net_value() const
Returns the total value accounted for by the frame (or by whatever Collector we are constrained to)...
const PStatThreadData * get_thread_data()
Returns the current PStatThreadData associated with the view.
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...
int get_num_children() const
Returns the number of children 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...
double get_time(int n) const
Returns the timestamp of the nth event, in seconds elapsed since some undefined epoch (which is guara...
int get_num_toplevel_collectors() const
Returns the total number of collectors that are toplevel collectors.
const PStatFrameData & get_frame(int frame_number) const
Returns a FrameData structure associated with the indicated frame number.
virtual void got_hello()
Called when the "hello" message has been received from the client.
Defines the details about the Collectors: the name, the suggested color, etc.
virtual bool is_thread_safe()
Should be redefined to return true if this monitor class can handle running in a sub-thread.
int get_collector() const
Returns the Collector index associated with this level.
virtual void new_data(int thread_index, int frame_number)
Called as each frame's data is made available.
double get_frame_rate() const
Computes the average frame rate over the past pstats_average_time seconds, by counting up the number ...
int get_latest_frame_number() const
Returns the frame number of the most recent frame stored in the data.