mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 00:32:57 -04:00
*** empty log message ***
This commit is contained in:
parent
1a05db3f46
commit
d01a189d8f
@ -49,6 +49,21 @@ get_leak_memory() {
|
|||||||
|
|
||||||
//const bool track_memory_usage = config_express.GetBool("track-memory-usage", false);
|
//const bool track_memory_usage = config_express.GetBool("track-memory-usage", false);
|
||||||
|
|
||||||
|
// Set this to false to avoid using the high-precision clock, even if
|
||||||
|
// it is available.
|
||||||
|
bool
|
||||||
|
get_use_high_res_clock() {
|
||||||
|
static bool got_use_high_res_clock = false;
|
||||||
|
static bool use_high_res_clock;
|
||||||
|
|
||||||
|
if (!got_use_high_res_clock) {
|
||||||
|
use_high_res_clock = config_express.GetBool("use-high-res-clock", true);
|
||||||
|
got_use_high_res_clock = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return use_high_res_clock;
|
||||||
|
}
|
||||||
|
|
||||||
const int patchfile_window_size =
|
const int patchfile_window_size =
|
||||||
config_express.GetInt("patchfile-window-size", 16);
|
config_express.GetInt("patchfile-window-size", 16);
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ NotifyCategoryDecl(express, EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS);
|
|||||||
//extern EXPCL_PANDAEXPRESS const bool track_memory_usage;
|
//extern EXPCL_PANDAEXPRESS const bool track_memory_usage;
|
||||||
|
|
||||||
bool get_leak_memory();
|
bool get_leak_memory();
|
||||||
|
bool get_use_high_res_clock();
|
||||||
|
|
||||||
extern const int patchfile_window_size;
|
extern const int patchfile_window_size;
|
||||||
extern const int patchfile_increment_size;
|
extern const int patchfile_increment_size;
|
||||||
|
@ -37,14 +37,6 @@ get_real_time() const {
|
|||||||
LARGE_INTEGER count;
|
LARGE_INTEGER count;
|
||||||
QueryPerformanceCounter(&count);
|
QueryPerformanceCounter(&count);
|
||||||
|
|
||||||
if (_init_count > count.QuadPart)
|
|
||||||
_init_count = count.QuadPart;
|
|
||||||
|
|
||||||
if (_frequency < 0) {
|
|
||||||
express_cat.error()
|
|
||||||
<< "TrueClock::get_real_time() - frequency is negative!" << endl;
|
|
||||||
QueryPerformanceFrequency((LARGE_INTEGER *)&_frequency);
|
|
||||||
}
|
|
||||||
return (double)(count.QuadPart - _init_count) / (double)_frequency;
|
return (double)(count.QuadPart - _init_count) / (double)_frequency;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -57,12 +49,25 @@ get_real_time() const {
|
|||||||
|
|
||||||
TrueClock::
|
TrueClock::
|
||||||
TrueClock() {
|
TrueClock() {
|
||||||
_has_high_res = QueryPerformanceFrequency((LARGE_INTEGER *)&_frequency);
|
_has_high_res = false;
|
||||||
|
if (get_use_high_res_clock()) {
|
||||||
|
_has_high_res = QueryPerformanceFrequency((LARGE_INTEGER *)&_frequency);
|
||||||
|
}
|
||||||
|
|
||||||
if (_has_high_res) {
|
if (_has_high_res) {
|
||||||
QueryPerformanceCounter((LARGE_INTEGER *)&_init_count);
|
LARGE_INTEGER count;
|
||||||
|
QueryPerformanceCounter(&count);
|
||||||
|
_init_count = count.QuadPart;
|
||||||
|
|
||||||
} else {
|
if (_frequency <= 0) {
|
||||||
|
express_cat.error()
|
||||||
|
<< "TrueClock::get_real_time() - frequency is negative!" << endl;
|
||||||
|
_has_high_res = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_has_high_res) {
|
||||||
express_cat.warning()
|
express_cat.warning()
|
||||||
<< "No high resolution clock available." << endl;
|
<< "No high resolution clock available." << endl;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user