Panda3D
config_pstats.cxx
1 // Filename: config_pstats.cxx
2 // Created by: drose (09Jul00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "config_pstats.h"
16 
17 #include "dconfig.h"
18 
19 ConfigureDef(config_pstats);
20 NotifyCategoryDef(pstats, "");
21 
22 ConfigureFn(config_pstats) {
23  init_libpstatclient();
24 }
25 
26 ConfigVariableString pstats_name
27 ("pstats-name", "Panda Stats");
28 
29 ConfigVariableDouble pstats_max_rate
30 ("pstats-max-rate", 1000.0,
31  PRC_DESC("The maximum number of packets per second, per thread, to send "
32  "to the remote PStats server. A packet is defined as a single "
33  "UDP packet, or each 1024 bytes of a TCP message."));
34 
35 ConfigVariableBool pstats_threaded_write
36 ("pstats-threaded-write", true,
37  PRC_DESC("Set this true to write to the PStats channel in a sub-thread, if "
38  "threading is available. Can't think of any reason why you "
39  "wouldn't want this set true, unless you suspect something is "
40  "broken with the threaded network interfaces."));
41 
42 ConfigVariableInt pstats_max_queue_size
43 ("pstats-max-queue-size", 1,
44  PRC_DESC("If pstats-threaded-write is true, this specifies the maximum "
45  "number of packets (generally, frames of data) that may be queued "
46  "up for the thread to process. If this is large, the writer "
47  "thread may fall behind and the output of PStats will lag. Keep "
48  "this small to drop missed packets on the floor instead, and "
49  "ensure that the frame data does not grow stale."));
50 
51 ConfigVariableDouble pstats_tcp_ratio
52 ("pstats-tcp-ratio", 0.01,
53  PRC_DESC("This specifies the ratio of frame update messages that are eligible "
54  "for UDP that are sent via TCP instead. It does not count messages "
55  "that are too large for UDP and must be sent via TCP anyway. 1.0 "
56  "means all messages are sent TCP; 0.0 means all are sent UDP."));
57 
58 ConfigVariableString pstats_host
59 ("pstats-host", "localhost");
60 
61 // The default port for PStats used to be 5180, but that's used by AIM.
62 ConfigVariableInt pstats_port
63 ("pstats-port", 5185);
64 
65 ConfigVariableDouble pstats_target_frame_rate
66 ("pstats-target-frame-rate", 30.0,
67  PRC_DESC("Specify the target frame rate to highlight on the PStats graph. "
68  "This frame rate is marked with a different-colored line; "
69  "otherwise, this setting has no effect."));
70 
71 ConfigVariableBool pstats_gpu_timing
72 ("pstats-gpu-timing", false,
73  PRC_DESC("Set this true to query the graphics library for the actual time "
74  "that graphics operations take to execute on the video card. "
75  "Enabling this will harm performance, but this information can "
76  "be more useful than the regular Draw information in tracking "
77  "down bottlenecks, because the CPU-based Draw collectors only "
78  "measure how long it takes for the API call to complete, which "
79  "is not usually an accurate reflectino of how long the actual "
80  "operation takes on the video card."));
81 
82 // The rest are different in that they directly control the server,
83 // not the client.
84 ConfigVariableBool pstats_scroll_mode
85 ("pstats-scroll-mode", true);
86 ConfigVariableDouble pstats_history
87 ("pstats-history", 60.0);
88 ConfigVariableDouble pstats_average_time
89 ("pstats-average-time", 3.0);
90 
91 ConfigVariableBool pstats_mem_other
92 ("pstats-mem-other", true,
93  PRC_DESC("Set this true to collect memory categories smaller than 0.1% of "
94  "the total into a single \"Other\" category, or false to show "
95  "each nonzero memory category."));
96 
97 ////////////////////////////////////////////////////////////////////
98 // Function: init_libpstatclient
99 // Description: Initializes the library. This must be called at
100 // least once before any of the functions or classes in
101 // this library can be used. Normally it will be
102 // called by the static initializers and need not be
103 // called explicitly, but special cases exist.
104 ////////////////////////////////////////////////////////////////////
105 void
106 init_libpstatclient() {
107  static bool initialized = false;
108  if (initialized) {
109  return;
110  }
111  initialized = true;
112 }
113 
This is a convenience class to specialize ConfigVariable as a boolean type.
This is a convenience class to specialize ConfigVariable as a floating-point type.
This is a convenience class to specialize ConfigVariable as a string type.
This is a convenience class to specialize ConfigVariable as an integer type.