@@ -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 ( ) ,
@@ -405,6 +408,7 @@ pub(crate) enum ConfigId {
405408 ProfilingExperimentalCpuTimeEnabled ,
406409 ProfilingAllocationEnabled ,
407410 ProfilingAllocationSamplingDistance ,
411+ ProfilingHeapLiveEnabled ,
408412 ProfilingTimelineEnabled ,
409413 ProfilingExceptionEnabled ,
410414 ProfilingExceptionMessageEnabled ,
@@ -437,6 +441,7 @@ impl ConfigId {
437441 ProfilingExperimentalCpuTimeEnabled => b"DD_PROFILING_EXPERIMENTAL_CPU_TIME_ENABLED\0 " ,
438442 ProfilingAllocationEnabled => b"DD_PROFILING_ALLOCATION_ENABLED\0 " ,
439443 ProfilingAllocationSamplingDistance => b"DD_PROFILING_ALLOCATION_SAMPLING_DISTANCE\0 " ,
444+ ProfilingHeapLiveEnabled => b"DD_PROFILING_HEAP_LIVE_ENABLED\0 " ,
440445 ProfilingTimelineEnabled => b"DD_PROFILING_TIMELINE_ENABLED\0 " ,
441446 ProfilingExceptionEnabled => b"DD_PROFILING_EXCEPTION_ENABLED\0 " ,
442447 ProfilingExceptionMessageEnabled => b"DD_PROFILING_EXCEPTION_MESSAGE_ENABLED\0 " ,
@@ -475,6 +480,7 @@ static DEFAULT_SYSTEM_SETTINGS: SystemSettings = SystemSettings {
475480 profiling_allocation_enabled : true ,
476481 // SAFETY: value is > 0.
477482 profiling_allocation_sampling_distance : unsafe { NonZeroU32 :: new_unchecked ( 1024 * 4096 ) } ,
483+ profiling_heap_live_enabled : false ,
478484 profiling_timeline_enabled : true ,
479485 profiling_exception_enabled : true ,
480486 profiling_exception_message_enabled : false ,
@@ -553,6 +559,17 @@ unsafe fn profiling_allocation_sampling_distance() -> NonZeroU32 {
553559 unsafe { NonZeroU32 :: new_unchecked ( int) }
554560}
555561
562+ /// # Safety
563+ /// This function must only be called after config has been initialized in
564+ /// rinit, and before it is uninitialized in mshutdown.
565+ unsafe fn profiling_heap_live_enabled ( ) -> bool {
566+ profiling_allocation_enabled ( )
567+ && get_system_bool (
568+ ProfilingHeapLiveEnabled ,
569+ DEFAULT_SYSTEM_SETTINGS . profiling_heap_live_enabled ,
570+ )
571+ }
572+
556573/// # Safety
557574/// This function must only be called after config has been initialized in
558575/// rinit, and before it is uninitialized in mshutdown.
@@ -1014,6 +1031,18 @@ pub(crate) fn minit(module_number: libc::c_int) {
10141031 displayer : None ,
10151032 env_config_fallback : None ,
10161033 } ,
1034+ zai_config_entry {
1035+ id : transmute :: < ConfigId , u16 > ( ProfilingHeapLiveEnabled ) ,
1036+ name : ProfilingHeapLiveEnabled . env_var_name ( ) ,
1037+ type_ : ZAI_CONFIG_TYPE_BOOL ,
1038+ default_encoded_value : ZaiStr :: literal ( b"0\0 " ) ,
1039+ aliases : ptr:: null_mut ( ) ,
1040+ aliases_count : 0 ,
1041+ ini_change : Some ( zai_config_system_ini_change) ,
1042+ parser : None ,
1043+ displayer : None ,
1044+ env_config_fallback : None ,
1045+ } ,
10171046 zai_config_entry {
10181047 id : transmute :: < ConfigId , u16 > ( ProfilingTimelineEnabled ) ,
10191048 name : ProfilingTimelineEnabled . env_var_name ( ) ,
0 commit comments