Make VL_LOCK_SPINS configurable
It's unlikely one value fits all use case, so making VL_LOCK_SPINS configurable at model build time. For testing, we reduce the value as we expect high contention.
This commit is contained in:
parent
eae942b91c
commit
b78ea06829
|
|
@ -164,7 +164,9 @@ inline constexpr size_t roundUpToMultipleOf(size_t value) {
|
||||||
// Return current thread ID (or 0), not super fast, cache if needed
|
// Return current thread ID (or 0), not super fast, cache if needed
|
||||||
extern uint32_t VL_THREAD_ID() VL_MT_SAFE;
|
extern uint32_t VL_THREAD_ID() VL_MT_SAFE;
|
||||||
|
|
||||||
|
#ifndef VL_LOCK_SPINS
|
||||||
#define VL_LOCK_SPINS 50000 /// Number of times to spin for a mutex before yielding
|
#define VL_LOCK_SPINS 50000 /// Number of times to spin for a mutex before yielding
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Mutex, wrapped to allow -fthread_safety checks
|
/// Mutex, wrapped to allow -fthread_safety checks
|
||||||
class VL_CAPABILITY("mutex") VerilatedMutex final {
|
class VL_CAPABILITY("mutex") VerilatedMutex final {
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,9 @@ CPPFLAGS += $(CPPFLAGS_DRIVER)
|
||||||
CPPFLAGS += $(CPPFLAGS_DRIVER2)
|
CPPFLAGS += $(CPPFLAGS_DRIVER2)
|
||||||
CPPFLAGS += $(CPPFLAGS_ADD)
|
CPPFLAGS += $(CPPFLAGS_ADD)
|
||||||
|
|
||||||
|
# Reduce spin count for faster testing
|
||||||
|
CPPFLAGS += -DVL_LOCK_SPINS=10000
|
||||||
|
|
||||||
ifeq ($(CFG_WITH_LONGTESTS),yes)
|
ifeq ($(CFG_WITH_LONGTESTS),yes)
|
||||||
ifeq ($(DRIVER_STD),newest)
|
ifeq ($(DRIVER_STD),newest)
|
||||||
CPPFLAGS += $(CFG_CXXFLAGS_STD)
|
CPPFLAGS += $(CFG_CXXFLAGS_STD)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue