mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Add Fuchsia support to memory_usage.
Implement GetProcessResidentSizeBytes for Fuchsia. Bug: webrtc:14825 Change-Id: I64582ce0da72d3bb0fa61ff64799a1a165e1192f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/290922 Commit-Queue: Sarah Pham <smpham@google.com> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/main@{#39154}
This commit is contained in:
parent
541024a588
commit
74f108a671
1 changed files with 13 additions and 2 deletions
|
@ -22,6 +22,9 @@
|
|||
#include <windows.h>
|
||||
#include <psapi.h> // must come after windows.h
|
||||
// clang-format on
|
||||
#elif defined(WEBRTC_FUCHSIA)
|
||||
#include <lib/zx/process.h>
|
||||
#include <zircon/status.h>
|
||||
#endif
|
||||
|
||||
#include "rtc_base/logging.h"
|
||||
|
@ -61,8 +64,16 @@ int64_t GetProcessResidentSizeBytes() {
|
|||
}
|
||||
return pmc.WorkingSetSize;
|
||||
#elif defined(WEBRTC_FUCHSIA)
|
||||
RTC_LOG_ERR(LS_ERROR) << "GetProcessResidentSizeBytes() not implemented";
|
||||
return 0;
|
||||
zx_info_task_stats_t task_stats;
|
||||
zx_status_t status = zx::process::self()->get_info(
|
||||
ZX_INFO_TASK_STATS, &task_stats, sizeof(task_stats), nullptr, nullptr);
|
||||
if (status == ZX_OK) {
|
||||
return task_stats.mem_mapped_bytes;
|
||||
} else {
|
||||
RTC_LOG_ERR(LS_ERROR) << "get_info() failed: "
|
||||
<< zx_status_get_string(status);
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
// Not implemented yet.
|
||||
static_assert(false,
|
||||
|
|
Loading…
Reference in a new issue