Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tracing: use ‘real’ atomics #26156

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/tracing/trace_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "node_platform.h"
#include "v8-platform.h"
#include "trace_event_common.h"
#include <atomic>

// This header file defines implementation details of how the trace macros in
// trace_event_common.h collect and store trace events. Anything not
Expand Down Expand Up @@ -128,9 +129,10 @@ enum CategoryGroupEnabledFlags {
#define TRACE_EVENT_API_ADD_METADATA_EVENT node::tracing::AddMetadataEvent

// Defines atomic operations used internally by the tracing system.
#define TRACE_EVENT_API_ATOMIC_WORD intptr_t
#define TRACE_EVENT_API_ATOMIC_LOAD(var) (var)
#define TRACE_EVENT_API_ATOMIC_STORE(var, value) (var) = (value)
#define TRACE_EVENT_API_ATOMIC_WORD std::atomic<intptr_t>
#define TRACE_EVENT_API_ATOMIC_WORD_VALUE intptr_t
#define TRACE_EVENT_API_ATOMIC_LOAD(var) (var).load()
#define TRACE_EVENT_API_ATOMIC_STORE(var, value) (var).store(value)

////////////////////////////////////////////////////////////////////////////////

Expand All @@ -157,12 +159,12 @@ enum CategoryGroupEnabledFlags {
category_group_enabled = \
TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); \
TRACE_EVENT_API_ATOMIC_STORE( \
atomic, reinterpret_cast<TRACE_EVENT_API_ATOMIC_WORD>( \
atomic, reinterpret_cast<TRACE_EVENT_API_ATOMIC_WORD_VALUE>( \
category_group_enabled)); \
}

#define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group) \
static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) = 0; \
static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) {0}; \
const uint8_t* INTERNAL_TRACE_EVENT_UID(category_group_enabled); \
INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( \
category_group, INTERNAL_TRACE_EVENT_UID(atomic), \
Expand Down