mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
Compatibility updates; Boost Regex is now statically linked, changed to <hunspell/hunspell.hxx>
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1286 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+15
-5
@@ -13,7 +13,9 @@
|
||||
#include <script/script.hpp>
|
||||
#include <script/context.hpp>
|
||||
|
||||
#ifndef USE_SCRIPT_PROFILING
|
||||
#define USE_SCRIPT_PROFILING 1
|
||||
#endif
|
||||
|
||||
#if USE_SCRIPT_PROFILING
|
||||
|
||||
@@ -23,7 +25,7 @@ DECLARE_POINTER_TYPE(FunctionProfile);
|
||||
|
||||
#ifdef WIN32
|
||||
typedef LONGLONG ProfileTime;
|
||||
|
||||
|
||||
inline ProfileTime timer_now() {
|
||||
LARGE_INTEGER i;
|
||||
QueryPerformanceCounter(&i);
|
||||
@@ -34,17 +36,25 @@ DECLARE_POINTER_TYPE(FunctionProfile);
|
||||
QueryPerformanceFrequency(&i);
|
||||
return i.QuadPart;
|
||||
}
|
||||
|
||||
inline const char * mangled_name(const type_info& t) {
|
||||
return t.raw_name();
|
||||
}
|
||||
#else
|
||||
// clock() has nanosecond resolution on Linux
|
||||
// on any other platform, stil the best way.
|
||||
typedef clock_t ProfileTime;
|
||||
|
||||
|
||||
inline ProfileTime timer_now() {
|
||||
return clock();
|
||||
}
|
||||
inline ProfileTime timer_resolution() {
|
||||
return CLOCKS_PER_SEC;
|
||||
}
|
||||
|
||||
inline const char * mangled_name(const type_info& t) {
|
||||
return t.name();
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Simple execution timer
|
||||
@@ -66,17 +76,17 @@ class Timer {
|
||||
class FunctionProfile : public IntrusivePtrBase<FunctionProfile> {
|
||||
public:
|
||||
FunctionProfile(const String& name) : name(name), time_ticks(0), calls(0) {}
|
||||
|
||||
|
||||
String name;
|
||||
ProfileTime time_ticks;
|
||||
UInt calls;
|
||||
/// for each id, called children
|
||||
/** we (ab)use the fact that all pointers are even to store both pointers and ids */
|
||||
map<size_t,FunctionProfileP> children;
|
||||
|
||||
|
||||
/// The children, sorted by time
|
||||
void get_children(vector<FunctionProfileP>& out) const;
|
||||
|
||||
|
||||
/// Time in seconds
|
||||
inline double time() const { return time_ticks / (double)timer_resolution(); }
|
||||
inline double avg_time() const { return time() / calls; }
|
||||
|
||||
Reference in New Issue
Block a user