blob: 6131789866701f3ed6b7842d60f19046a3048abe [file] [log] [blame]
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.memory;
using fuchsia.memorypressure;
/// Interface used to register for memory notifications.
[Discoverable]
protocol Monitor {
Watch(Watcher watcher);
};
struct Stats {
/// The total amount of physical memory available to the system.
uint64 total_bytes;
/// The amount of unallocated memory.
uint64 free_bytes;
/// The amount of memory reserved by and mapped into the kernel for reasons
/// not covered by other fields in this struct. Typically for readonly data
/// like the ram disk and kernel image, and for early-boot dynamic memory.
uint64 wired_bytes;
/// The amount of memory allocated to the kernel heap.
uint64 total_heap_bytes;
/// The portion of `total_heap_bytes` that is not in use.
uint64 free_heap_bytes;
/// The amount of memory committed to VMOs, both kernel and user.
/// A superset of all userspace memory.
/// Does not include certain VMOs that fall under `wired_bytes`.
uint64 vmo_bytes;
/// The amount of memory used for architecture-specific MMU metadata
/// like page tables.
uint64 mmu_overhead_bytes;
/// The amount of memory in use by IPC.
uint64 ipc_bytes;
/// Non-free memory that isn't accounted for in any other field.
uint64 other_bytes;
};
/// A watcher for memory changes
protocol Watcher {
OnChange(Stats stats);
};
/// Interface used to debug the singleton memory_monitor instance.
[Discoverable]
protocol Debugger {
/// Signals registered watchers of the fuchsia.memorypressure service with
/// the specified memory pressure level. Intended for debugging only. Does
/// not affect the real memory pressure level on the system, or trigger any
/// kernel memory reclamation tasks.
SignalMemoryPressure(fuchsia.memorypressure.Level level);
};