22 static bool user_interrupted =
false;
26 static void signal_handler(
int) {
27 user_interrupted =
true;
35 set_program_brief(
"text-based PStats client");
36 set_program_description
37 (
"This is a simple PStats server that listens on a TCP port for a " 38 "connection from a PStatClient in a Panda player. It will then report " 39 "frame rate and timing information sent by the player.");
43 "Specify the TCP port to listen for connections on. By default, this " 44 "is taken from the pstats-host Config variable.",
45 &TextStats::dispatch_int,
nullptr, &_port);
49 "Show the raw frame data, in addition to boiling it down to a total " 50 "time per collector.",
51 &TextStats::dispatch_none, &_show_raw_data,
nullptr);
55 "Filename where to print. If not given then stderr is being used.",
56 &TextStats::dispatch_string, &_got_outputFileName, &_outputFileName);
69 return new TextMonitor(
this, _outFile, _show_raw_data);
80 signal(SIGINT, &signal_handler);
83 nout <<
"Unable to open port.\n";
87 nout <<
"Listening for connections.\n";
89 if (_got_outputFileName) {
90 _outFile =
new std::ofstream(_outputFileName.c_str(), std::ios::out);
100 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_...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void main_loop(bool *interrupt_flag=nullptr)
An alternative to repeatedly calling poll(), this function yields control of the program to the PStat...
A simple, scrolling-text stats monitor.
bool listen(int port=-1)
Establishes a port number that the manager will listen on for TCP connections.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.