()
| 3801 | } |
| 3802 | |
| 3803 | pub async fn fetch_admin_memory_profiler_overview() -> Result<MemoryProfilerOverview, String> { |
| 3804 | #[cfg(feature = "mock")] |
| 3805 | { |
| 3806 | Ok(MemoryProfilerOverview { |
| 3807 | generated_at_ms: Date::now() as i64, |
| 3808 | config: MemoryProfilerConfigSnapshot { |
| 3809 | enabled: true, |
| 3810 | sample_rate: 128, |
| 3811 | min_alloc_bytes: 256, |
| 3812 | max_tracked_allocations: 100_000, |
| 3813 | stack_skip: 6, |
| 3814 | max_stack_depth: 24, |
| 3815 | }, |
| 3816 | process_uptime_secs: 0, |
| 3817 | tracked_allocations: 0, |
| 3818 | distinct_stacks: 0, |
| 3819 | dropped_allocations: 0, |
| 3820 | sampled_alloc_events: 0, |
| 3821 | sampled_dealloc_events: 0, |
| 3822 | sampled_realloc_events: 0, |
| 3823 | total_live_bytes_estimate: 0, |
| 3824 | total_alloc_bytes_estimate: 0, |
| 3825 | process_rss_bytes: 0, |
| 3826 | process_virtual_bytes: 0, |
| 3827 | mimalloc: MiProcessMemoryInfo { |
| 3828 | elapsed_millis: 0, |
| 3829 | user_millis: 0, |
| 3830 | system_millis: 0, |
| 3831 | current_rss_bytes: 0, |
| 3832 | peak_rss_bytes: 0, |
| 3833 | current_commit_bytes: 0, |
| 3834 | peak_commit_bytes: 0, |
| 3835 | page_faults: 0, |
| 3836 | }, |
| 3837 | }) |
| 3838 | } |
| 3839 | |
| 3840 | #[cfg(not(feature = "mock"))] |
| 3841 | { |
| 3842 | let url = format!("{}/admin/runtime/memory/overview", admin_base()); |
| 3843 | let response = api_get(&url) |
| 3844 | .send() |
| 3845 | .await |
| 3846 | .map_err(|e| format!("Network error: {:?}", e))?; |
| 3847 | if !response.ok() { |
| 3848 | return Err(format!("HTTP error: {}", response.status())); |
| 3849 | } |
| 3850 | response |
| 3851 | .json() |
| 3852 | .await |
| 3853 | .map_err(|e| format!("Parse error: {:?}", e)) |
| 3854 | } |
| 3855 | } |
| 3856 | |
| 3857 | pub async fn fetch_admin_memory_profiler_stacks( |
| 3858 | top: Option<usize>, |
no test coverage detected