-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[scudo] Add tracing framework #156112
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
[scudo] Add tracing framework #156112
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| //===-- tracing.h -----------------------------------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef SCUDO_TRACING_H_ | ||
| #define SCUDO_TRACING_H_ | ||
|
|
||
| #if defined(SCUDO_ENABLE_TRACING) | ||
|
|
||
| // This file must include definitions for all of the functions below. | ||
| #include "custom_scudo_tracing.h" | ||
|
|
||
| #else | ||
|
|
||
| // Should start a trace in the given scope, and end the trace when going out of | ||
| // scope. | ||
| #define SCUDO_SCOPED_TRACE(Name) | ||
|
|
||
| // Create a trace name for the call to releaseToOS. | ||
| static inline const char *GetReleaseToOSTraceName(scudo::ReleaseToOS) { | ||
| return nullptr; | ||
| } | ||
|
|
||
| // Create a trace name for the call to releaseToOSMaybe in the primary. | ||
| static inline const char * | ||
| GetPrimaryReleaseToOSMaybeTraceName(scudo::ReleaseToOS) { | ||
| return nullptr; | ||
| } | ||
|
|
||
| static inline const char *GetPrimaryReleaseToOSTraceName(scudo::ReleaseToOS) { | ||
| return nullptr; | ||
| } | ||
|
|
||
| // Create a trace name for the call to releaseToOS in the secondary. | ||
| static inline const char *GetSecondaryReleaseToOSTraceName(scudo::ReleaseToOS) { | ||
| return nullptr; | ||
| } | ||
|
|
||
| // Create a trace name for the call to releaseOlderThan in the secondary. | ||
| static inline const char *GetSecondaryReleaseOlderThan() { return nullptr; } | ||
|
||
|
|
||
| #endif | ||
|
|
||
| #endif // SCUDO_TRACING_H_ | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
qq, are we able to log the ClassId in trace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that helps as an inspiration, Fuchsia's tracing system lets you attach arbitrary arguments (including integers) to trace events. But it relies on sophisticated C preprocessing (example and implementation).
Maybe we could expose individual trace points directly as macros to give maximum flexibility? For instance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can work on getting better trace data after this. I would like a better way to generate the names that can happen at compile time. I'll definitely look at that for a follow-on cl.