Device Status

We provide functions for reading device information, used to obtain the operational status of the device, including real-time information such as disk, battery, CPU, memory, and network. This allows you to understand the current state of the device in detail.

Get Status Instance

Obtain a Status instance for subsequent operations.

status = d.stub("Status")

Get Boot Time

Get the boot time of the current device.

status.get_boot_time()
>>> status.get_boot_time()
1234567890

Get Disk Usage

Get the disk usage of a specific mount directory.

status.get_disk_usage(mountpoint="/data")
>>> status.get_disk_usage(mountpoint="/data")
disk_total: 117153181696
disk_used: 8111099904
disk_free: 108907864064
disk_percent: 6.900000095367432
>>> result = status.get_disk_usage(mountpoint="/data")
>>> print(result.disk_free)
108907864064

Get Battery Info

Get the current battery level and temperature information of the device.

status.get_battery_info()
>>> status.get_battery_info()
batt_charging: True
batt_percent: 100
batt_temperature: 26.899999618530273
>>> result = status.get_battery_info()
>>> print(result.batt_charging)
True

Get CPU Usage

Get the current device's CPU and its usage.

status.get_cpu_info()
>>> status.get_cpu_info()
cpu_percent: 20.799999237060547
cpu_count: 8
cpu_freq_current: 823.2000122070312
cpu_freq_max: 1929.5999755859375
cpu_freq_min: 614.4000244140625
cpu_times_user: 13.699999809265137
cpu_times_system: 5.800000190734863
cpu_times_idle: 79.80000305175781
>>> result = status.get_cpu_info()
>>> print(result.cpu_percent)
20.799999237060547

Get Disk I/O (Overall)

Get the overall disk I/O status of the current device.

status.get_overall_disk_io_info()
>>> status.get_overall_disk_io_info()
disk_io_read_bytes: 11569016832
disk_io_read_count: 917667
disk_io_write_bytes: 6973407232
disk_io_write_count: 909946
disk_io_read_time: 364713
disk_io_write_time: 268013
disk_io_busy_time: 152621
>>> result = status.get_overall_disk_io_info()
>>> print(result.disk_io_write_bytes)
6973407232

Get Disk I/O (userdata)

Get the disk I/O status of the current device's userdata partition.

status.get_userdata_disk_io_info()
>>> status.get_userdata_disk_io_info()
disk_io_read_bytes: 2899529728
disk_io_read_count: 115970
disk_io_write_bytes: 1815506944
disk_io_write_count: 45254
disk_io_read_time: 152239
disk_io_write_time: 120825
disk_io_busy_time: 49127
>>> result = status.get_userdata_disk_io_info()
>>> print(result.disk_io_read_bytes)
2899529728

Get Network Traffic (Overall)

Get the overall network traffic statistics of the current device.

status.get_overall_net_io_info()
>>> status.get_overall_net_io_info()
net_io_bytes_sent: 65296119
net_io_packets_sent: 78793
net_io_bytes_recv: 60046396
net_io_packets_recv: 80745
>>> result = status.get_overall_net_io_info()
>>> print(result.net_io_bytes_recv)
60046396

Get Network Traffic (Specific Interface)

Get the data transmission and reception statistics for a specific network interface of the current device.

status.get_net_io_info("wlan0")
>>> status.get_net_io_info("wlan0")
net_io_bytes_sent: 36896321
net_io_packets_sent: 59869
net_io_bytes_recv: 58846862
net_io_packets_recv: 66759
>>> result = status.get_net_io_info("wlan0")
>>> print(result.net_io_bytes_recv)
58846862

Get Memory Usage

Get the current memory usage of the device.

status.get_mem_info()
>>> status.get_mem_info()
mem_total: 7823970304
mem_available: 3208761344
mem_percent: 59.0
mem_used: 4327931904
mem_free: 298639360
mem_active: 3535876096
mem_inactive: 1634873344
mem_buffers: 4243456
mem_cached: 3193155584
mem_shared: 34979840
mem_slab: 426651648
>>> result = status.get_mem_info()
>>> print(result.mem_total)
7823970304