Commit d241d919 by Greg Falcon Committed by Copybara-Service

Fix the documentation of the atomic_hook.h registration functions to correctly…

Fix the documentation of the atomic_hook.h registration functions to correctly state that only the first registered hook will be honored.

The comments that imply otherwise were never true, and were a leftover artifact during initial development of the feature.

Also remove a TODO() I gave myself years ago; this is never going to happen and isn't worth the bother.

PiperOrigin-RevId: 495687371
Change-Id: I63f8ef57d659075bf290caae0617ea61ceb2c1db
parent e2416566
...@@ -1033,10 +1033,11 @@ inline Condition::Condition(const T *object, ...@@ -1033,10 +1033,11 @@ inline Condition::Condition(const T *object,
// measured by //absl/base/internal/cycleclock.h, and which may not // measured by //absl/base/internal/cycleclock.h, and which may not
// be real "cycle" counts.) // be real "cycle" counts.)
// //
// Calls to this function do not race or block, but there is no ordering // There is no ordering guarantee between when the hook is registered and when
// guaranteed between calls to this function and call to the provided hook. // callbacks will begin. Only a single profiler can be installed in a running
// In particular, the previously registered hook may still be called for some // binary; if this function is called a second time with a different function
// time after this function returns. // pointer, the value is ignored (and will cause an assertion failure in debug
// mode.)
void RegisterMutexProfiler(void (*fn)(int64_t wait_cycles)); void RegisterMutexProfiler(void (*fn)(int64_t wait_cycles));
// Register a hook for Mutex tracing. // Register a hook for Mutex tracing.
...@@ -1049,13 +1050,11 @@ void RegisterMutexProfiler(void (*fn)(int64_t wait_cycles)); ...@@ -1049,13 +1050,11 @@ void RegisterMutexProfiler(void (*fn)(int64_t wait_cycles));
// //
// The only event name currently sent is "slow release". // The only event name currently sent is "slow release".
// //
// This has the same memory ordering concerns as RegisterMutexProfiler() above. // This has the same ordering and single-use limitations as
// RegisterMutexProfiler() above.
void RegisterMutexTracer(void (*fn)(const char *msg, const void *obj, void RegisterMutexTracer(void (*fn)(const char *msg, const void *obj,
int64_t wait_cycles)); int64_t wait_cycles));
// TODO(gfalcon): Combine RegisterMutexProfiler() and RegisterMutexTracer()
// into a single interface, since they are only ever called in pairs.
// Register a hook for CondVar tracing. // Register a hook for CondVar tracing.
// //
// The function pointer registered here will be called here on various CondVar // The function pointer registered here will be called here on various CondVar
...@@ -1066,7 +1065,8 @@ void RegisterMutexTracer(void (*fn)(const char *msg, const void *obj, ...@@ -1066,7 +1065,8 @@ void RegisterMutexTracer(void (*fn)(const char *msg, const void *obj,
// Events that can be sent are "Wait", "Unwait", "Signal wakeup", and // Events that can be sent are "Wait", "Unwait", "Signal wakeup", and
// "SignalAll wakeup". // "SignalAll wakeup".
// //
// This has the same memory ordering concerns as RegisterMutexProfiler() above. // This has the same ordering and single-use limitations as
// RegisterMutexProfiler() above.
void RegisterCondVarTracer(void (*fn)(const char *msg, const void *cv)); void RegisterCondVarTracer(void (*fn)(const char *msg, const void *cv));
// Register a hook for symbolizing stack traces in deadlock detector reports. // Register a hook for symbolizing stack traces in deadlock detector reports.
...@@ -1076,7 +1076,8 @@ void RegisterCondVarTracer(void (*fn)(const char *msg, const void *cv)); ...@@ -1076,7 +1076,8 @@ void RegisterCondVarTracer(void (*fn)(const char *msg, const void *cv));
// false if symbolizing failed, or true if a NUL-terminated symbol was written // false if symbolizing failed, or true if a NUL-terminated symbol was written
// to 'out.' // to 'out.'
// //
// This has the same memory ordering concerns as RegisterMutexProfiler() above. // This has the same ordering and single-use limitations as
// RegisterMutexProfiler() above.
// //
// DEPRECATED: The default symbolizer function is absl::Symbolize() and the // DEPRECATED: The default symbolizer function is absl::Symbolize() and the
// ability to register a different hook for symbolizing stack traces will be // ability to register a different hook for symbolizing stack traces will be
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment