@@ -45,6 +45,7 @@ pub struct SystemSettings {
4545 pub profiling_experimental_cpu_time_enabled : bool ,
4646 pub profiling_allocation_enabled : bool ,
4747 pub profiling_allocation_sampling_distance : NonZeroU32 ,
48+ pub profiling_heap_live_enabled : bool ,
4849 pub profiling_timeline_enabled : bool ,
4950 pub profiling_exception_enabled : bool ,
5051 pub profiling_exception_message_enabled : bool ,
@@ -69,6 +70,7 @@ impl SystemSettings {
6970 profiling_experimental_cpu_time_enabled : false ,
7071 profiling_allocation_enabled : false ,
7172 profiling_allocation_sampling_distance : NonZeroU32 :: MAX ,
73+ profiling_heap_live_enabled : false ,
7274 profiling_timeline_enabled : false ,
7375 profiling_exception_enabled : false ,
7476 profiling_exception_message_enabled : false ,
@@ -98,6 +100,7 @@ impl SystemSettings {
98100 profiling_experimental_cpu_time_enabled : profiling_experimental_cpu_time_enabled ( ) ,
99101 profiling_allocation_enabled : profiling_allocation_enabled ( ) ,
100102 profiling_allocation_sampling_distance : profiling_allocation_sampling_distance ( ) ,
103+ profiling_heap_live_enabled : profiling_heap_live_enabled ( ) ,
101104 profiling_timeline_enabled : profiling_timeline_enabled ( ) ,
102105 profiling_exception_enabled : profiling_exception_enabled ( ) ,
103106 profiling_exception_message_enabled : profiling_exception_message_enabled ( ) ,
@@ -404,6 +407,7 @@ pub(crate) enum ConfigId {
404407 ProfilingExperimentalCpuTimeEnabled ,
405408 ProfilingAllocationEnabled ,
406409 ProfilingAllocationSamplingDistance ,
410+ ProfilingHeapLiveEnabled ,
407411 ProfilingTimelineEnabled ,
408412 ProfilingExceptionEnabled ,
409413 ProfilingExceptionMessageEnabled ,
@@ -436,6 +440,7 @@ impl ConfigId {
436440 ProfilingExperimentalCpuTimeEnabled => b"DD_PROFILING_EXPERIMENTAL_CPU_TIME_ENABLED\0 " ,
437441 ProfilingAllocationEnabled => b"DD_PROFILING_ALLOCATION_ENABLED\0 " ,
438442 ProfilingAllocationSamplingDistance => b"DD_PROFILING_ALLOCATION_SAMPLING_DISTANCE\0 " ,
443+ ProfilingHeapLiveEnabled => b"DD_PROFILING_HEAP_LIVE_ENABLED\0 " ,
439444 ProfilingTimelineEnabled => b"DD_PROFILING_TIMELINE_ENABLED\0 " ,
440445 ProfilingExceptionEnabled => b"DD_PROFILING_EXCEPTION_ENABLED\0 " ,
441446 ProfilingExceptionMessageEnabled => b"DD_PROFILING_EXCEPTION_MESSAGE_ENABLED\0 " ,
@@ -474,6 +479,7 @@ static DEFAULT_SYSTEM_SETTINGS: SystemSettings = SystemSettings {
474479 profiling_allocation_enabled : true ,
475480 // SAFETY: value is > 0.
476481 profiling_allocation_sampling_distance : unsafe { NonZeroU32 :: new_unchecked ( 1024 * 4096 ) } ,
482+ profiling_heap_live_enabled : false ,
477483 profiling_timeline_enabled : true ,
478484 profiling_exception_enabled : true ,
479485 profiling_exception_message_enabled : false ,
@@ -552,6 +558,17 @@ unsafe fn profiling_allocation_sampling_distance() -> NonZeroU32 {
552558 unsafe { NonZeroU32 :: new_unchecked ( int) }
553559}
554560
561+ /// # Safety
562+ /// This function must only be called after config has been initialized in
563+ /// rinit, and before it is uninitialized in mshutdown.
564+ unsafe fn profiling_heap_live_enabled ( ) -> bool {
565+ profiling_allocation_enabled ( )
566+ && get_system_bool (
567+ ProfilingHeapLiveEnabled ,
568+ DEFAULT_SYSTEM_SETTINGS . profiling_heap_live_enabled ,
569+ )
570+ }
571+
555572/// # Safety
556573/// This function must only be called after config has been initialized in
557574/// rinit, and before it is uninitialized in mshutdown.
@@ -1013,6 +1030,18 @@ pub(crate) fn minit(module_number: libc::c_int) {
10131030 displayer : None ,
10141031 env_config_fallback : None ,
10151032 } ,
1033+ zai_config_entry {
1034+ id : transmute :: < ConfigId , u16 > ( ProfilingHeapLiveEnabled ) ,
1035+ name : ProfilingHeapLiveEnabled . env_var_name ( ) ,
1036+ type_ : ZAI_CONFIG_TYPE_BOOL ,
1037+ default_encoded_value : ZaiStr :: literal ( b"0\0 " ) ,
1038+ aliases : ptr:: null_mut ( ) ,
1039+ aliases_count : 0 ,
1040+ ini_change : Some ( zai_config_system_ini_change) ,
1041+ parser : None ,
1042+ displayer : None ,
1043+ env_config_fallback : None ,
1044+ } ,
10161045 zai_config_entry {
10171046 id : transmute :: < ConfigId , u16 > ( ProfilingTimelineEnabled ) ,
10181047 name : ProfilingTimelineEnabled . env_var_name ( ) ,
0 commit comments