Skip to content

Commit

Permalink
HPCC-30156 Instrument CriticalSection
Browse files Browse the repository at this point in the history
Enable automatically when PROFILING selected

Signed-off-by: Richard Chapman <[email protected]>
  • Loading branch information
richardkchapman committed Sep 6, 2023
1 parent b890cb7 commit 7bea2af
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmake_modules/commonSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
endif ()
if (PROFILING AND (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX))
add_definitions (-fno-omit-frame-pointer)
add_definitions (-D_PROFILING)
endif ()

if (WIN32)
Expand Down
2 changes: 2 additions & 0 deletions system/jlib/jmutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ int Mutex::unlockAll()
static SpinLock sl;
void InstrumentedCriticalSection::reportContended(bool destructor)
{
if (!queryLogMsgManager())
return;
if (contended*2 > uncontended && contended % 1000 == 0)
{
SpinBlock block(sl);
Expand Down
4 changes: 2 additions & 2 deletions system/jlib/jmutex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ extern jlib_decl void spinUntilReady(std::atomic_uint &value);
//#define SPINLOCK_USE_MUTEX // for testing
#define SPINLOCK_RR_CHECK // checks for realtime threads
#define _ASSERT_LOCK_SUPPORT
#define USE_INSTRUMENTED_CRITSECS
#elif defined(_PROFILE)
//#define USE_INSTRUMENTED_CRITSECS
#elif defined(_PROFILING)
#define USE_INSTRUMENTED_CRITSECS
#endif

Expand Down

0 comments on commit 7bea2af

Please sign in to comment.