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);
const PStatViewLevel * get_top_level()
Returns a pointer to the level that corresponds to the Collector we've constrained to...
int get_num_events() const
Returns the number of individual events stored in the FrameData.
int get_toplevel_collector(int index) const
Returns the collector index of the nth toplevel collector.
void set_to_frame(const PStatFrameData &frame_data)
Supplies the View with the data for the current frame.
bool is_start(int n) const
Returns true if the nth event represents a start event, or false if it represents a stop event...
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...
const PStatViewLevel * get_child(int n) const
Returns the nth child of this Level/Collector.
const PStatFrameData & get_frame(int frame_number) const
Returns a FrameData structure associated with the indicated frame number.
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...
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.
virtual void lost_connection()
Called whenever the connection to the client has been lost.
TextStats * get_server()
Returns the server that owns this monitor.
double get_net_value() const
Returns the total value accounted for by the frame (or by whatever Collector we are constrained to)...
This is a single level value, or band of color, within a View.
A simple, scrolling-text stats server.
double get_net_value() const
Returns the total level value (or elapsed time) represented by this Collector, including all values i...
This is an abstract class that presents the interface to any number of different front-ends for the s...
bool has_collector(int index) const
Returns true if the indicated collector has been defined by the client already, false otherwise...
int get_time_collector(int n) const
Returns the index of the collector associated with the nth 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...
PStatServer * get_server()
Returns the server that owns this monitor.
Contains the raw timing and level data for a single frame.
double get_frame_rate() const
Computes the average frame rate over the past pstats_average_time seconds, by counting up the number ...
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...
const PStatThreadData * get_thread_data()
Returns the current PStatThreadData associated with the view.
int get_collector() const
Returns the Collector index associated with this level.
double get_time(int n) const
Returns the timestamp of the nth event, in seconds elapsed since some undefined epoch (which is guara...
string get_client_progname() const
Returns the program name of the client we're connected to, if known.
const PStatClientData * get_client_data() const
Returns the client data associated with this monitor.
int get_num_children() const
Returns the number of children of this Level/Collector.
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.
virtual void new_data(int thread_index, int frame_number)
Called as each frame's data is made available.
int get_latest_frame_number() const
Returns the frame number of the most recent frame stored in the data.
string get_client_hostname() const
Returns the hostname of the client we're connected to, if known.
int get_num_toplevel_collectors() const
Returns the total number of collectors that are toplevel collectors.
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...