00001 // Filename: config_pstats.cxx 00002 // Created by: drose (09Jul00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "config_pstats.h" 00020 00021 #include <dconfig.h> 00022 00023 ConfigureDef(config_pstats); 00024 NotifyCategoryDef(pstats, ""); 00025 00026 ConfigureFn(config_pstats) { 00027 init_libpstatclient(); 00028 } 00029 00030 string get_pstats_name() { 00031 return config_pstats.GetString("pstats-name", "Panda Stats"); 00032 } 00033 00034 float get_pstats_max_rate() { 00035 return config_pstats.GetFloat("pstats-max-rate", 30.0); 00036 } 00037 00038 const string pstats_host = config_pstats.GetString("pstats-host", "localhost"); 00039 const int pstats_port = config_pstats.GetInt("pstats-port", 5180); 00040 const float pstats_target_frame_rate = config_pstats.GetFloat("pstats-target-frame-rate", 30.0); 00041 00042 // The rest are different in that they directly control the server, 00043 // not the client. 00044 const bool pstats_scroll_mode = config_pstats.GetBool("pstats-scroll-mode", true); 00045 const float pstats_history = config_pstats.GetFloat("pstats-history", 30.0); 00046 const bool pstats_threaded_write = config_pstats.GetBool("pstats-threaded-write", false); 00047 00048 //////////////////////////////////////////////////////////////////// 00049 // Function: init_libpstatclient 00050 // Description: Initializes the library. This must be called at 00051 // least once before any of the functions or classes in 00052 // this library can be used. Normally it will be 00053 // called by the static initializers and need not be 00054 // called explicitly, but special cases exist. 00055 //////////////////////////////////////////////////////////////////// 00056 void 00057 init_libpstatclient() { 00058 static bool initialized = false; 00059 if (initialized) { 00060 return; 00061 } 00062 initialized = true; 00063 } 00064