(
top: Option<usize>,
)
| 3889 | } |
| 3890 | |
| 3891 | pub async fn fetch_admin_memory_profiler_functions( |
| 3892 | top: Option<usize>, |
| 3893 | ) -> Result<MemoryFunctionReport, String> { |
| 3894 | #[cfg(feature = "mock")] |
| 3895 | { |
| 3896 | Ok(MemoryFunctionReport { |
| 3897 | generated_at_ms: Date::now() as i64, |
| 3898 | top: top.unwrap_or(20), |
| 3899 | total_live_bytes_estimate: 0, |
| 3900 | process_rss_bytes: 0, |
| 3901 | entries: vec![], |
| 3902 | }) |
| 3903 | } |
| 3904 | |
| 3905 | #[cfg(not(feature = "mock"))] |
| 3906 | { |
| 3907 | let mut url = format!("{}/admin/runtime/memory/functions", admin_base()); |
| 3908 | if let Some(top) = top { |
| 3909 | url.push_str(&format!("?top={top}")); |
| 3910 | } |
| 3911 | let response = api_get(&url) |
| 3912 | .send() |
| 3913 | .await |
| 3914 | .map_err(|e| format!("Network error: {:?}", e))?; |
| 3915 | if !response.ok() { |
| 3916 | return Err(format!("HTTP error: {}", response.status())); |
| 3917 | } |
| 3918 | response |
| 3919 | .json() |
| 3920 | .await |
| 3921 | .map_err(|e| format!("Parse error: {:?}", e)) |
| 3922 | } |
| 3923 | } |
| 3924 | |
| 3925 | pub async fn fetch_admin_memory_profiler_modules( |
| 3926 | top: Option<usize>, |
no test coverage detected