Panda3D

config_pstats.cxx

00001 // Filename: config_pstats.cxx
00002 // Created by:  drose (09Jul00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "config_pstats.h"
00016 
00017 #include "dconfig.h"
00018 
00019 ConfigureDef(config_pstats);
00020 NotifyCategoryDef(pstats, "");
00021 
00022 ConfigureFn(config_pstats) {
00023   init_libpstatclient();
00024 }
00025 
00026 ConfigVariableString pstats_name
00027 ("pstats-name", "Panda Stats");
00028 
00029 ConfigVariableDouble pstats_max_rate
00030 ("pstats-max-rate", 1000.0,
00031  PRC_DESC("The maximum number of packets per second, per thread, to send "
00032           "to the remote PStats server.  A packet is defined as a single "
00033           "UDP packet, or each 1024 bytes of a TCP message."));
00034 
00035 ConfigVariableBool pstats_threaded_write
00036 ("pstats-threaded-write", true,
00037  PRC_DESC("Set this true to write to the PStats channel in a sub-thread, if "
00038           "threading is available.  Can't think of any reason why you "
00039           "wouldn't want this set true, unless you suspect something is "
00040           "broken with the threaded network interfaces."));
00041 
00042 ConfigVariableInt pstats_max_queue_size
00043 ("pstats-max-queue-size", 1,
00044  PRC_DESC("If pstats-threaded-write is true, this specifies the maximum "
00045           "number of packets (generally, frames of data) that may be queued "
00046           "up for the thread to process.  If this is large, the writer "
00047           "thread may fall behind and the output of PStats will lag.  Keep "
00048           "this small to drop missed packets on the floor instead, and "
00049           "ensure that the frame data does not grow stale."));
00050 
00051 ConfigVariableDouble pstats_tcp_ratio
00052 ("pstats-tcp-ratio", 0.01,
00053  PRC_DESC("This specifies the ratio of frame update messages that are eligible "
00054           "for UDP that are sent via TCP instead.  It does not count messages "
00055           "that are too large for UDP and must be sent via TCP anyway.  1.0 "
00056           "means all messages are sent TCP; 0.0 means all are sent UDP."));
00057 
00058 ConfigVariableString pstats_host
00059 ("pstats-host", "localhost");
00060 
00061 // The default port for PStats used to be 5180, but that's used by AIM.
00062 ConfigVariableInt pstats_port
00063 ("pstats-port", 5185);
00064 
00065 ConfigVariableDouble pstats_target_frame_rate
00066 ("pstats-target-frame-rate", 30.0,
00067  PRC_DESC("Specify the target frame rate to highlight on the PStats graph.  "
00068           "This frame rate is marked with a different-colored line; "
00069           "otherwise, this setting has no effect."));
00070 
00071 // The rest are different in that they directly control the server,
00072 // not the client.
00073 ConfigVariableBool pstats_scroll_mode
00074 ("pstats-scroll-mode", true);
00075 ConfigVariableDouble pstats_history
00076 ("pstats-history", 60.0);
00077 ConfigVariableDouble pstats_average_time
00078 ("pstats-average-time", 3.0);
00079 
00080 ConfigVariableBool pstats_mem_other
00081 ("pstats-mem-other", true,
00082  PRC_DESC("Set this true to collect memory categories smaller than 0.1% of "
00083           "the total into a single \"Other\" category, or false to show "
00084           "each nonzero memory category."));
00085 
00086 ////////////////////////////////////////////////////////////////////
00087 //     Function: init_libpstatclient
00088 //  Description: Initializes the library.  This must be called at
00089 //               least once before any of the functions or classes in
00090 //               this library can be used.  Normally it will be
00091 //               called by the static initializers and need not be
00092 //               called explicitly, but special cases exist.
00093 ////////////////////////////////////////////////////////////////////
00094 void
00095 init_libpstatclient() {
00096   static bool initialized = false;
00097   if (initialized) {
00098     return;
00099   }
00100   initialized = true;
00101 }
00102 
 All Classes Functions Variables Enumerations