-
Notifications
You must be signed in to change notification settings - Fork 115
Add profiling_hooks feature exposing jemalloc's experimental sample hooks #172
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -42,6 +42,7 @@ cc = "^1.0.13" | |
| default = ["background_threads_runtime_support"] | ||
| profiling = [] | ||
| profiling_libunwind = ["profiling"] | ||
| profiling_hooks = ["profiling"] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems an extra feature is unnecessary. Guarding it under profiling should be enough? |
||
| debug = [] | ||
| background_threads_runtime_support = [] | ||
| background_threads = [ "background_threads_runtime_support" ] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -246,6 +246,23 @@ fn main() { | |
| malloc_conf += "background_thread:false"; | ||
| } | ||
|
|
||
| if env::var("CARGO_FEATURE_PROFILING_HOOKS").is_ok() { | ||
| info!("CARGO_FEATURE_PROFILING_HOOKS set"); | ||
| // Baking bare `prof:true` would also default `prof_active` and | ||
| // `prof_thread_active_init` to true. Since `links = "jemalloc"` | ||
| // unifies this build across every dependent in the graph, that would | ||
| // make the one shared jemalloc actively sample every allocation | ||
| // process-wide as soon as any dependent enables this feature, even | ||
| // if no hook is ever installed. Keep sampling installable | ||
| // (`opt_prof`) but inert until a consumer flips `prof.active` (or | ||
| // calls `tikv_jemalloc_ctl::profiling::prof_active::write(true)`) at | ||
| // runtime. | ||
| if !malloc_conf.is_empty() { | ||
| malloc_conf.push(','); | ||
| } | ||
| malloc_conf.push_str("prof:true,prof_active:false"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can do that by setting environment variables JEMALLOC_SYS_WITH_MALLOC_CONF at build time. |
||
| } | ||
|
|
||
| if let Ok(malloc_conf_opts) = read_and_watch_env("JEMALLOC_SYS_WITH_MALLOC_CONF") { | ||
| if !malloc_conf.is_empty() { | ||
| malloc_conf.push(','); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.