<br />

Added: 7

## **PROTOCOLS**

## Counter

*Defined in [fuchsia.kernel/kernel-counter.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/kernel-counter.fidl;l=11)*

Protocol for retrieving kcounter information.

<br />

### GetInspectVmo

Retrives a VMO containining summarized kcounter data. The vmo returned
in `buffer` is in "inspect-vmo" format, documented elsewhere.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `status` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Result` |
| `buffer` | `https://fuchsia.dev/reference/fuchsia.mem//https://fuchsia.dev/reference/fuchsia.mem#Buffer` |

### UpdateInspectVmo

Request that the previously-returned VMO buffer's data be updated. The
data may not be updated if it was already recently updated (updates are
limited to an unspecified rate, but approximately every few seconds).

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `status` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Result` |

## CpuResource

*Defined in [fuchsia.kernel/cpu-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/cpu-resource.fidl;l=11)*

Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
`ZX_RSRC_SYSTEM_CPU_BASE`.

<br />

### Get

Get a CPU resource handle.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## DebugBroker

*Defined in [fuchsia.kernel/kernel-debug.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/kernel-debug.fidl;l=13)*

Acts on behalf of the caller to interact with privileged debug system calls.

<br />

### SendDebugCommand

Pass debug command through to the kernel shell.
Look at zx_debug_send_command syscall handling to find valid values.

#### Request

| Name | Type |
|---|---|
| `command` | `string:1024` |

#### Response

| Name | Type |
|---|---|
| `status` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Result` |

### SetTracingEnabled

Sets whether kernel tracing (ktrace) is enabled or disabled.

#### Request

| Name | Type |
|---|---|
| `enabled` | `bool` |

#### Response

| Name | Type |
|---|---|
| `status` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Result` |

## DebugResource

*Defined in [fuchsia.kernel/debug-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/debug-resource.fidl;l=11)*

Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
`ZX_RSRC_SYSTEM_DEBUG_BASE`.

<br />

### Get

Get a debug resource handle.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## DebuglogResource

*Defined in [fuchsia.kernel/debuglog-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/debuglog-resource.fidl;l=12)*

Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
`ZX_RSRC_SYSTEM_DEBUGLOG_BASE`.
Added: HEAD

<br />

### Get

Get a debuglog resource handle.
Added: HEAD

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## EnergyInfoResource

*Defined in [fuchsia.kernel/energy-info-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/energy-info-resource.fidl;l=12)*

Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
`ZX_RSRC_SYSTEM_ENERGY_INFO_BASE`.
Added: HEAD

<br />

### Get

Get an EnergyInfo resource handle.
Added: HEAD

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## HypervisorResource

*Defined in [fuchsia.kernel/hypervisor-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/hypervisor-resource.fidl;l=10)*

Protocol for providing the hypervisor resource.

<br />

### Get

Get a hypervisor resource handle.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## InfoResource

*Defined in [fuchsia.kernel/info-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/info-resource.fidl;l=11)*

Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
`ZX_RSRC_SYSTEM_INFO_BASE`.

<br />

### Get

Get an info resource handle.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## IommuResource

*Defined in [fuchsia.kernel/iommu-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/iommu-resource.fidl;l=12)*

Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
`ZX_RSRC_SYSTEM_IOMMU_BASE`.
Added: HEAD

<br />

### Get

Get an iommu resource handle.
Added: HEAD

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## IoportResource

*Defined in [fuchsia.kernel/ioport-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/ioport-resource.fidl;l=10)*

Protocol for providing an IO Port resource with access to all valid ranges.

<br />

### Get

Get an IO Port resource handle.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## IrqResource

*Defined in [fuchsia.kernel/irq-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/irq-resource.fidl;l=10)*

Protocol for providing an IRQ resource with access to all valid ranges.

<br />

### Get

Get an IRQ resource handle.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## MmioResource

*Defined in [fuchsia.kernel/mmio-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/mmio-resource.fidl;l=10)*

Protocol for providing an MMIO resource with access to all valid ranges.

<br />

### Get

Get an MMIO resource handle.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## MsiResource

*Defined in [fuchsia.kernel/msi-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/msi-resource.fidl;l=12)*

Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
`ZX_RSRC_SYSTEM_MSI_BASE`.
Added: HEAD

<br />

### Get

Get an msi resource handle.
Added: HEAD

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## PowerResource

*Defined in [fuchsia.kernel/power-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/power-resource.fidl;l=12)*

Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
`ZX_RSRC_SYSTEM_POWER_BASE`.

<br />

### Get

Get a power resource handle.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## ProfileResource

*Defined in [fuchsia.kernel/profile-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/profile-resource.fidl;l=13)*

Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
`ZX_RSRC_SYSTEM_PROFILE_BASE`.
Added: HEAD

<br />

### Get

Get a profile resource handle.
Added: HEAD

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## RootJob

*Defined in [fuchsia.kernel/root-job.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/root-job.fidl;l=12)*

Protocol for providing the root job.

TODO(https://fxbug.dev/42109098): Do not use this without first consulting the Zircon team.

<br />

### Get

Get the root `job`.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `job` | `handle<job>` |

## RootJobForInspect

*Defined in [fuchsia.kernel/root-job.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/root-job.fidl;l=22)*

Protocol for providing the root job with restricted rights, specifically:
INSPECT \| ENUMERATE \| DUPLICATE \| TRANSFER

<br />

### Get

Get the root `job`.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `job` | `handle<job>` |

## SamplingResource

*Defined in [fuchsia.kernel/sampling-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/sampling-resource.fidl;l=12)*

Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
`ZX_RSRC_SYSTEM_SAMPLING_BASE`.
Added: HEAD

<br />

### Get

Get a sampling resource handle.
Added: HEAD

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## SmcResource

*Defined in [fuchsia.kernel/smc-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/smc-resource.fidl;l=10)*

Protocol for providing an SMC resource with access to all valid ranges.

<br />

### Get

Get an SMC resource handle.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## StallResource

*Defined in [fuchsia.kernel/stall-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/stall-resource.fidl;l=13)*

Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
`ZX_RSRC_SYSTEM_STALL_BASE` to programs that should be able to measure and
be notified of stalls.
Added: HEAD

<br />

### Get

Get a stall resource handle.
Added: HEAD

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## Stats

*Defined in [fuchsia.kernel/kernel-stats.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/kernel-stats.fidl;l=122)*

Protocol for providing kernel stats. This is roughly a wrapper around zx_object_get_info for
the ZX_INFO_KMEM_STATS and ZX_INFO_CPU_STATS topics, which today require the very powerful
'Root Resource' capability to obtain. Instead of vending out that capability, programs that
just want stats should use this service instead. If for some reason the protocol fails to
retrieve stats, which will be an un-recoverable error, it will close the channel.

<br />

### GetCpuLoad

Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
duration.

Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
PerCpuStats) over a time duration.

#### Request

| Name | Type |
|---|---|
| `duration` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Duration` |

#### Response

| Name | Type |
|---|---|
| `per_cpu_load` | `vector<float32>:512` |

### GetCpuStats

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `stats` | `https://fuchsia.dev/reference/fidl/fuchsia.kernel#CpuStats` |

### GetMemoryStats

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `stats` | `https://fuchsia.dev/reference/fidl/fuchsia.kernel#MemoryStats` |

### GetMemoryStatsCompression

Added: 16

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.kernel#MemoryStatsCompression` |

### GetMemoryStatsExtended

**DEPRECATED**

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `stats` | `https://fuchsia.dev/reference/fidl/fuchsia.kernel#MemoryStatsExtended` |

## TracingResource

*Defined in [fuchsia.kernel/tracing-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/tracing-resource.fidl;l=13)*

Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
`ZX_RSRC_SYSTEM_TRACING_BASE`.
Added: HEAD

<br />

### Get

Get a tracing resource handle.
Added: HEAD

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## VmexResource

*Defined in [fuchsia.kernel/vmex-resource.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/vmex-resource.fidl;l=12)*

Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
`ZX_RSRC_SYSTEM_VMEX_BASE` to programs that should be able to mark VMOs as
executable.

<br />

### Get

Get a VMEX resource handle.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `resource` | `handle<resource>` |

## **STRUCTS**

### CpuStats

*Defined in [fuchsia.kernel/kernel-stats.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/kernel-stats.fidl;l=108)*

| Field | Type | Description | Default |
|---|---|---|---|
| `actual_num_cpus` | `uint64` | This is the total number of CPUs on the actual device. This may not be the same as the length of the vector `per_cpu_stats` as it is possible the underlying syscall will not return stats for all CPUs. | No default |
| `per_cpu_stats` | `vector<https://fuchsia.dev/reference/fidl/fuchsia.kernel#PerCpuStats>:512?` |   | No default |

## **TABLES**

### MemoryStats

*Defined in [fuchsia.kernel/kernel-stats.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/kernel-stats.fidl;l=10)*

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `total_bytes` | `uint64` |   |
| ### 2 | `free_bytes` | `uint64` |   |
| ### 3 | `wired_bytes` | `uint64` |   |
| ### 4 | `total_heap_bytes` | `uint64` |   |
| ### 5 | `free_heap_bytes` | `uint64` |   |
| ### 6 | `vmo_bytes` | `uint64` |   |
| ### 7 | `mmu_overhead_bytes` | `uint64` |   |
| ### 8 | `ipc_bytes` | `uint64` |   |
| ### 9 | `other_bytes` | `uint64` |   |
| ### 10 | `free_loaned_bytes` | `uint64` | Added: HEAD |
| ### 11 | `cache_bytes` | `uint64` | Added: HEAD |
| ### 12 | `slab_bytes` | `uint64` | Added: HEAD |
| ### 13 | `zram_bytes` | `uint64` | Added: HEAD |
| ### 14 | `vmo_reclaim_total_bytes` | `uint64` | Added: HEAD |
| ### 15 | `vmo_reclaim_newest_bytes` | `uint64` | Added: HEAD |
| ### 16 | `vmo_reclaim_oldest_bytes` | `uint64` | Added: HEAD |
| ### 17 | `vmo_reclaim_disabled_bytes` | `uint64` | Added: HEAD |
| ### 18 | `vmo_discardable_locked_bytes` | `uint64` | Added: HEAD |
| ### 19 | `vmo_discardable_unlocked_bytes` | `uint64` | Added: HEAD |

### MemoryStatsCompression

*Defined in [fuchsia.kernel/kernel-stats.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/kernel-stats.fidl;l=65)*
Added: 16

<br />

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `uncompressed_storage_bytes` | `uint64` |   |
| ### 2 | `compressed_storage_bytes` | `uint64` |   |
| ### 3 | `compressed_fragmentation_bytes` | `uint64` |   |
| ### 4 | `compression_time` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Duration` |   |
| ### 5 | `decompression_time` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Duration` |   |
| ### 6 | `total_page_compression_attempts` | `uint64` |   |
| ### 7 | `failed_page_compression_attempts` | `uint64` |   |
| ### 8 | `total_page_decompressions` | `uint64` |   |
| ### 9 | `compressed_page_evictions` | `uint64` |   |
| ### 10 | `eager_page_compressions` | `uint64` |   |
| ### 11 | `memory_pressure_page_compressions` | `uint64` |   |
| ### 12 | `critical_memory_page_compressions` | `uint64` |   |
| ### 13 | `pages_decompressed_unit_ns` | `uint64` |   |
| ### 14 | `pages_decompressed_within_log_time` | `array<uint64, 8>` |   |

### MemoryStatsExtended

*Defined in [fuchsia.kernel/kernel-stats.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/kernel-stats.fidl;l=45)*

**DEPRECATED**

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `total_bytes` | `uint64` |   |
| ### 2 | `free_bytes` | `uint64` |   |
| ### 3 | `wired_bytes` | `uint64` |   |
| ### 4 | `total_heap_bytes` | `uint64` |   |
| ### 5 | `free_heap_bytes` | `uint64` |   |
| ### 6 | `vmo_bytes` | `uint64` |   |
| ### 7 | `vmo_pager_total_bytes` | `uint64` |   |
| ### 8 | `vmo_pager_newest_bytes` | `uint64` |   |
| ### 9 | `vmo_pager_oldest_bytes` | `uint64` |   |
| ### 10 | `vmo_discardable_locked_bytes` | `uint64` |   |
| ### 11 | `vmo_discardable_unlocked_bytes` | `uint64` |   |
| ### 12 | `mmu_overhead_bytes` | `uint64` |   |
| ### 13 | `ipc_bytes` | `uint64` |   |
| ### 14 | `other_bytes` | `uint64` |   |

<br />

### PerCpuStats

*Defined in [fuchsia.kernel/kernel-stats.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/kernel-stats.fidl;l=84)*

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `cpu_number` | `uint32` |   |
| ### 2 | `flags` | `uint32` |   |
| ### 3 | `idle_time` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Duration` |   |
| ### 4 | `reschedules` | `uint64` |   |
| ### 5 | `context_switches` | `uint64` |   |
| ### 6 | `irq_preempts` | `uint64` |   |
| ### 7 | `yields` | `uint64` |   |
| ### 8 | `ints` | `uint64` |   |
| ### 9 | `timer_ints` | `uint64` |   |
| ### 10 | `timers` | `uint64` |   |
| ### 11 | `page_faults` | `uint64` |   |
| ### 12 | `exceptions` | `uint64` |   |
| ### 13 | `syscalls` | `uint64` |   |
| ### 14 | `reschedule_ipis` | `uint64` |   |
| ### 15 | `generic_ipis` | `uint64` |   |
| ### 16 | `normalized_busy_time` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Duration` | Added: HEAD |
| ### 17 | `active_energy_consumption_nj` | `uint64` | Added: HEAD |
| ### 18 | `idle_energy_consumption_nj` | `uint64` | Added: HEAD |

## **CONSTANTS**

| Name | Value | Type | Description |
|---|---|---|---|
| [DEBUG_COMMAND_MAX](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.kernel/kernel-debug.fidl;l=9) | `1024` | `uint32` | Maximum number of bytes in a command string |