provide block device statistics for the block device on domain.

libvirt_connect
libvirt_domain_create_xml
Libvirt Functions
PHP Manual

# libvirt_domain_block_stats

(php-libvirt 0.3)

libvirt_domain_block_stats — provide block device statistics for the block device on domain.

### Description

array libvirt_domain_block_stats ( resource `$domain` , string `$path` )

This function returns block device (disk) stats for block devices attached to the domain. The path parameter is the name of the block device. Domains may have more than one block device. To get stats for each you should make multiple calls to this function. Individual fields within the stats structure may be returned as -1, which indicates that the hypervisor does not support that particular statistic.

The returned array contains members in accoridng to the libvirt structure virDomainBlockStatsStruct.

Members of the array returned by libvirt_domain_interface_stats
rd_req | number of read requests
rd_bytes | number of read bytes
wr_req | number of write requests
wr_bytes | number of written bytes
errs | In Xen this returns the mysterious 'oo_req'.

> Note: Warning
> . This function returns values that may be bigger than 32bit integer limit. Please read this note for more details.

### Parameters

`domain`

  Domain resource of domain the block device is attached to

`path`

  Path to the block device, i.e. "hda"

### Return Values

Array with statistics.

### Examples

Example #1 libvirt_domain_block_stats() example

Get interface statistics on blockdevice hda on domain test

`<?php
$dom=libvirt_domain_lookup_by_name($res,"test");
print_r(libvirt_domain_block_stats($dom,"hda"));
?>`

The above example will output something similar to:

    Array
    (
        [rd_req] => 0
        [rd_bytes] => 0
        [wr_req] => 0
        [wr_bytes] => 0
        [errs] => -1
    )

### See Also

- libvirt_domain_memory_stats() - provide memory statistics for the domain.
- libvirt_domain_interface_stats() - provide interface statistics for the virtual network interface on domain.

libvirt_connect
libvirt_domain_create_xml
Libvirt Functions
PHP Manual