15 #include "textStats.h" 16 #include "textMonitor.h" 18 #include "pStatServer.h" 19 #include "config_pstats.h" 24 static bool user_interrupted =
false;
28 static void signal_handler(
int) {
29 user_interrupted =
true;
39 set_program_brief(
"text-based PStats client");
40 set_program_description
41 (
"This is a simple PStats server that listens on a TCP port for a " 42 "connection from a PStatClient in a Panda player. It will then report " 43 "frame rate and timing information sent by the player.");
47 "Specify the TCP port to listen for connections on. By default, this " 48 "is taken from the pstats-host Config variable.",
49 &TextStats::dispatch_int, NULL, &_port);
53 "Show the raw frame data, in addition to boiling it down to a total " 54 "time per collector.",
55 &TextStats::dispatch_none, &_show_raw_data, NULL);
59 "Filename where to print. If not given then stderr is being used.",
60 &TextStats::dispatch_string, &_got_outputFileName, &_outputFileName);
75 return new TextMonitor(
this, _outFile, _show_raw_data);
88 signal(SIGINT, &signal_handler);
91 nout <<
"Unable to open port.\n";
95 nout <<
"Listening for connections.\n";
97 if (_got_outputFileName) {
98 _outFile =
new ofstream(_outputFileName.c_str(), ios::out);
104 nout <<
"Exiting.\n";
108 int main(
int argc,
char *argv[]) {
virtual void parse_command_line(int argc, char **argv)
Dispatches on each of the options on the command line, and passes the remaining parameters to handle_...
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...
A simple, scrolling-text stats monitor.
bool listen(int port=-1)
Establishes a port number that the manager will listen on for TCP connections.
void main_loop(bool *interrupt_flag=NULL)
An alternative to repeatedly calling poll(), this function yields control of the program to the PStat...