Skip to content

Commit

Permalink
Project: PROFILE_CRITICAL_SECTIONS -> CONFIG_PROFILE_LOCKS.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaffeine committed Nov 10, 2015
1 parent 21eb73a commit be47ce0
Show file tree
Hide file tree
Showing 32 changed files with 95 additions and 95 deletions.
4 changes: 2 additions & 2 deletions src/Layers/xrRender/SkeletonCustom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#endif
int psSkeletonUpdate = 32;
Lock UCalc_Mutex
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
(MUTEX_PROFILE_ID(UCalc_Mutex))
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
;

#ifndef _EDITOR
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/WallmarksEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ CWallmarksEngine::wm_slot* CWallmarksEngine::AppendSlot (ref_shader shader)
//////////////////////////////////////////////////////////////////////

CWallmarksEngine::CWallmarksEngine ()
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
:lock(MUTEX_PROFILE_ID(CWallmarksEngine))
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
{
static_pool.reserve (256);
marks.reserve (256);
Expand Down
4 changes: 2 additions & 2 deletions src/utils/xrAI/game_spawn_constructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ extern LPCSTR generate_temp_file_name (LPCSTR header0, LPCSTR header1, string_
#define NO_MULTITHREADING

CGameSpawnConstructor::CGameSpawnConstructor (LPCSTR name, LPCSTR output, LPCSTR start, bool no_separator_check) :
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
m_critical_section(MUTEX_PROFILE_ID(CGameSpawnConstructor)),
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
m_thread_manager(ProxyStatus, ProxyProgress)
{
load_spawns (name,no_separator_check);
Expand Down
4 changes: 2 additions & 2 deletions src/utils/xrLC/OGF_Face.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ void OGF::Optimize ()

// Make Progressive
Lock progressive_cs
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
(MUTEX_PROFILE_ID(progressive_cs))
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
;
void OGF::MakeProgressive (float metric_limit)
{
Expand Down
4 changes: 2 additions & 2 deletions src/utils/xrLC/xrLight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include "utils/xrLC_Light/lcnet_task_manager.h"
#include "utils/xrLC_Light/mu_model_light.h"
Lock task_CS
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
(MUTEX_PROFILE_ID(task_C_S))
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
;

xr_vector<int> task_pool;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/xrLC/xrPhase_GI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const u32 gi_maxlevel = 4;
//////////////////////////////////////////////////////////////////////////
static xr_vector<R_Light>* task;
Lock task_cs
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
(MUTEX_PROFILE_ID(task_cs))
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
;
static u32 task_it;

Expand Down
2 changes: 1 addition & 1 deletion src/utils/xrLCUtil/LevelCompilerLoggerWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class XRLCUTIL_API LevelCompilerLoggerWindow : public ILevelCompilerLogger
HWND hwPText = 0;
HWND hwPhaseTime = 0;
Lock csLog
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
(MUTEX_PROFILE_ID(csLog))
#endif
;
Expand Down
8 changes: 4 additions & 4 deletions src/utils/xrLC_Light/xrLightVertex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ typedef xr_multimap<float,vecVertex> mapVert;
typedef mapVert::iterator mapVertIt;
mapVert* g_trans;
Lock g_trans_CS
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
(MUTEX_PROFILE_ID(g_trans_CS))
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
;
extern XRLC_LIGHT_API void LightPoint (CDB::COLLIDER* DB, CDB::MODEL* MDL, base_color_c &C, Fvector &P, Fvector &N, base_lighting& lights, u32 flags, Face* skip);

Expand Down Expand Up @@ -67,9 +67,9 @@ class CVertexLightTasker
volatile u32 index;
public:
CVertexLightTasker () : index(0)
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
,cs(MUTEX_PROFILE_ID(CVertexLightTasker))
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
{};

void init ()
Expand Down
4 changes: 2 additions & 2 deletions src/xrCDB/ISpatial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ void ISpatial_NODE::_remove (ISpatial* S)
//////////////////////////////////////////////////////////////////////////

ISpatial_DB::ISpatial_DB(const char *name)
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
:cs(MUTEX_PROFILE_ID(ISpatial_DB))
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
{
m_root = NULL;
xr_strcpy(Name, name);
Expand Down
4 changes: 2 additions & 2 deletions src/xrCDB/xrCDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ BOOL APIENTRY DllMain( HANDLE hModule,

// Model building
MODEL::MODEL ()
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
:cs(MUTEX_PROFILE_ID(MODEL))
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
{
tree = 0;
tris = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/xrCDB/xr_area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ using namespace collide;
//----------------------------------------------------------------------
CObjectSpace::CObjectSpace ( ):
xrc()
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
,Lock(MUTEX_PROFILE_ID(CObjectSpace::Lock))
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
#ifdef DEBUG
,m_pRender(0)
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/xrCore/LocatorAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ XRCORE_API void _dump_open_files(int mode)
}

CLocatorAPI::CLocatorAPI()
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
:m_auth_lock(MUTEX_PROFILE_ID(CLocatorAPI::m_auth_lock))
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
{
m_Flags.zero();
// get page size
Expand Down
10 changes: 5 additions & 5 deletions src/xrCore/Threading/Lock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "Lock.hpp"
#include <windows.h>

#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
static add_profile_portion_callback add_profile_portion = 0;
void set_add_profile_portion(add_profile_portion_callback callback)
{
Expand Down Expand Up @@ -32,9 +32,9 @@ struct profiler
(*add_profile_portion)(m_timer_id, time - m_time);
}
};
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS

#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
Lock::Lock(const char *id) : id(id)
#else
Lock::Lock()
Expand All @@ -49,14 +49,14 @@ extern void OutputDebugStackTrace(const char *header);

void Lock::Enter()
{
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
# if 0//def DEBUG
static bool show_call_stack = false;
if (show_call_stack)
OutputDebugStackTrace("----------------------------------------------------");
# endif // DEBUG
profiler temp(id);
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
EnterCriticalSection(&cs);
}

Expand Down
8 changes: 4 additions & 4 deletions src/xrCore/Threading/Lock.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "xrCore/xrCore.h"

#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
typedef void(*add_profile_portion_callback) (LPCSTR id, const u64& time);
void XRCORE_API set_add_profile_portion(add_profile_portion_callback callback);

Expand All @@ -11,19 +11,19 @@ void XRCORE_API set_add_profile_portion(add_profile_portion_callback callback);
# define CONCATENIZE(a,b) CONCATENIZE_HELPER(a,b)
# define MUTEX_PROFILE_PREFIX_ID #mutexes/
# define MUTEX_PROFILE_ID(a) STRINGIZER(CONCATENIZE(MUTEX_PROFILE_PREFIX_ID,a))
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS

class XRCORE_API Lock
{
private:
friend class AutoLock;
CRITICAL_SECTION cs;
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
const char *id;
#endif

public:
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
Lock(const char *id);
#else
Lock();
Expand Down
6 changes: 3 additions & 3 deletions src/xrCore/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ extern BOOL LogExecCB = TRUE;
static string_path logFName = "engine.log";
static string_path log_file_name = "engine.log";
static BOOL no_log = TRUE;
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
static Lock logCS(MUTEX_PROFILE_ID(log));
#else // PROFILE_CRITICAL_SECTIONS
#else // CONFIG_PROFILE_LOCKS
static Lock logCS;
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
xr_vector<shared_str>* LogFile = NULL;
static LogCallback LogCB = 0;

Expand Down
4 changes: 2 additions & 2 deletions src/xrCore/xrDebugNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ void xrDebug::do_exit(const std::string& message)
void xrDebug::backend(const char* expression, const char* description, const char* argument0, const char* argument1, const char* file, int line, const char* function, bool& ignore_always)
{
static Lock CS
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
(MUTEX_PROFILE_ID(xrDebug::backend))
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
;

CS.Enter();
Expand Down
4 changes: 2 additions & 2 deletions src/xrCore/xrMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ XRCORE_API void dump_phase()

xrMemory::xrMemory()
#ifdef DEBUG_MEMORY_MANAGER
# ifdef PROFILE_CRITICAL_SECTIONS
# ifdef CONFIG_PROFILE_LOCKS
:debug_cs(MUTEX_PROFILE_ID(xrMemory))
# endif // PROFILE_CRITICAL_SECTIONS
# endif // CONFIG_PROFILE_LOCKS
#endif // DEBUG_MEMORY_MANAGER
{
#ifdef DEBUG_MEMORY_MANAGER
Expand Down
4 changes: 2 additions & 2 deletions src/xrCore/xrMemory_POOL.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class MEMPOOL
public:
void _initialize(u32 _element, u32 _sector, u32 _header);

#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
ICF MEMPOOL() : cs(MUTEX_PROFILE_ID(memory_pool)) {}
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS

ICF u32 get_block_count() { return block_count; }
ICF u32 get_element() { return s_element; }
Expand Down
4 changes: 2 additions & 2 deletions src/xrCore/xrsharedmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class XRCORE_API smem_container
void clean();
void dump();
u32 stat_economy();
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
smem_container ():cs(MUTEX_PROFILE_ID(smem_container)) {}
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
~smem_container();
};
XRCORE_API extern smem_container* g_pSharedMemoryContainer;
Expand Down
4 changes: 2 additions & 2 deletions src/xrCore/xrstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ class XRCORE_API str_container
void dump(IWriter* W);
void verify();
u32 stat_economy();
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
str_container ():cs(MUTEX_PROFILE_ID(str_container)) {}
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
};
XRCORE_API extern str_container* g_pStringContainer;

Expand Down
4 changes: 2 additions & 2 deletions src/xrEngine/EventAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class ENGINE_API CEventAPI
xr_vector<Deferred> Events_Deferred;
Lock CS;
public:
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
CEventAPI () : CS(MUTEX_PROFILE_ID(CEventAPI)) {}
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
EVENT Create(const char* N);
void Destroy(EVENT& E);

Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ u32 lvInterpSteps = 0;

CLevel::CLevel() :
IPureClient(Device.GetTimerGlobal())
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
, DemoCS(MUTEX_PROFILE_ID(DemoCS))
#endif
{
Expand Down
6 changes: 3 additions & 3 deletions src/xrGame/Level_Bullet_Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,16 @@ void SBullet::Init(const Fvector& position,


CBulletManager::CBulletManager()
#if 0//def PROFILE_CRITICAL_SECTIONS
#if 0//def CONFIG_PROFILE_LOCKS
: m_Lock(MUTEX_PROFILE_ID(CBulletManager))
# ifdef DEBUG
,m_thread_id(GetCurrentThreadId())
# endif // #ifdef DEBUG
#else // #ifdef PROFILE_CRITICAL_SECTIONS
#else // #ifdef CONFIG_PROFILE_LOCKS
# ifdef DEBUG
: m_thread_id(GetCurrentThreadId())
# endif // #ifdef DEBUG
#endif // #ifdef PROFILE_CRITICAL_SECTIONS
#endif // #ifdef CONFIG_PROFILE_LOCKS
{
m_Bullets.clear ();
m_Bullets.reserve (100);
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/game_cl_base_weapon_usage_statistic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ void Player_Statistic::net_load(NET_Packet* P)
};

WeaponUsageStatistic::WeaponUsageStatistic()
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
: m_mutex(MUTEX_PROFILE_ID(WeaponUsageStatistic)){}
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
{
Clear ();
m_dwUpdateTimeDelta = 30000; //30 seconds
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/game_sv_event_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

//
GameEventQueue::GameEventQueue()
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
:cs(MUTEX_PROFILE_ID(GameEventQueue))
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS
{
unused.reserve (128);
for (int i=0; i<16; i++)
Expand Down
8 changes: 4 additions & 4 deletions src/xrGame/gamespy/GameSpy_Browser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ void __cdecl SBCallback(ServerBrowser sb, SBCallbackReason reason, SBServer serv
EGameIDs ParseStringToGameType(LPCSTR str);

CGameSpy_Browser::CGameSpy_Browser()
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
:m_refresh_lock(MUTEX_PROFILE_ID(CGameSpy_Browser::m_refresh_lock))
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS

{
//-------------------------
Expand All @@ -37,9 +37,9 @@ CGameSpy_Browser::CGameSpy_Browser()
};

CGameSpy_Browser::CGameSpy_Browser(HMODULE hGameSpyDLL)
#ifdef PROFILE_CRITICAL_SECTIONS
#ifdef CONFIG_PROFILE_LOCKS
:m_refresh_lock(MUTEX_PROFILE_ID(CGameSpy_Browser::m_refresh_lock))
#endif // PROFILE_CRITICAL_SECTIONS
#endif // CONFIG_PROFILE_LOCKS

{
//-------------------------
Expand Down
Loading

0 comments on commit be47ce0

Please sign in to comment.