diff --git a/core/Makefile b/core/Makefile index 5b4e3447..a49dc222 100644 --- a/core/Makefile +++ b/core/Makefile @@ -23,7 +23,7 @@ OBJECTS = AdminCache.cpp CDataPack.cpp ConCmdManager.cpp ConVarManager.cpp CoreC sm_autonatives.cpp sm_memtable.cpp sm_srvcmds.cpp sm_stringutil.cpp sm_trie.cpp \ sourcemm_api.cpp sourcemod.cpp MenuStyle_Base.cpp MenuStyle_Valve.cpp MenuManager.cpp \ MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp sm_crc32.cpp \ - frame_hooks.cpp concmd_cleaner.cpp + frame_hooks.cpp concmd_cleaner.cpp Profiler.cpp OBJECTS += smn_admin.cpp smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \ smn_datapacks.cpp smn_entities.cpp smn_events.cpp smn_fakenatives.cpp \ smn_filesystem.cpp smn_float.cpp smn_functions.cpp smn_gameconfigs.cpp smn_halflife.cpp \ diff --git a/core/Profiler.cpp b/core/Profiler.cpp index 7f119144..b69341da 100644 --- a/core/Profiler.cpp +++ b/core/Profiler.cpp @@ -33,6 +33,10 @@ #include "PluginSys.h" #include "sm_stringutil.h" #include "Logger.h" +#if defined PLATFORM_POSIX +#include +#include +#endif ProfileEngine g_Profiler; IProfiler *sm_profiler = &g_Profiler; @@ -123,14 +127,14 @@ inline double DiffProfPoints(const prof_point_t &start, const prof_point_t &end) #elif defined PLATFORM_POSIX seconds = (double)(end.value.tv_sec - start.value.tv_sec); - if (start.value.tv_usec > after.value.tv_usec) + if (start.value.tv_usec > end.value.tv_usec) { - seconds - 1.0; - seconds += (double)(1000000 - (before.value.tv_usec - after.tv_usec)) / 1000000.0; + seconds -= 1.0; + seconds += (double)(1000000 - (start.value.tv_usec - end.value.tv_usec)) / 1000000.0; } else { - seconds += (double)(after.value.tv_usec - before.value.tv_usec) / 1000000.0; + seconds += (double)(end.value.tv_usec - start.value.tv_usec) / 1000000.0; } #endif