Android knowledge 370 - storaged command, view usage of EMMC

Official website link  https://source.android.google.cn/devices/tech/debug/storaged

At the same time I can refer to the  eMMC life analysis 1-5

 

Android O added to  storaged support, it is an Android native daemon, you can collect and publish indicators stored on your Android device.

  • For everyday disk statistics, storaged resolves on a regular basis  /sys/block/mmcblk0/stat(eMMC storage devices) or  /sys/block/sda/stat(non eMMC devices).
  • For eMMC life cycle, storaged resolves  /d/mmc0/mmc0:001/ext_csd(if available).
  • For application I / O problems, storaged regularly traverse  /proc/uid_io/stats and maintains the parsed data, including data from all applications (not just the application is running) a. dumpsys You can call  storagedto record in the error report application I / O usage.

Disk Statistics (including disk statistics has been terminated) and eMMC information will be logged to the event log Android, while the platform registration service collects logs from here.

storaged Operation happens automatically and is completely handled by the Android framework, you do not need to perform any implementation work. This page describes  storaged(including a new interface) design and how it gets from the kernel I / O status.

storaged Design

For the calculation of authority and flexibility to consider, storaged as I will return the UID of each kernel module / O information implemented (rather than using the standard  proc/PID/io). Each I / O request of raw I / O data is still in the kernel  task_struct are stored and updated, and exit time of the recording process of the kernel, it will not be missed since the last time  storaged I / O usage since polling event.

Only when the situation on the module frame notice UID foreground / background switching or  storaged when the daemon request report, it will read and process raw data. By then, the module will export a file from the kernel node for the frame and  storaged communicate daemon.

storaged The introduction of  /proc/uid_io/stats interface that can return I / O system statistics information list for each UID. The format is:

<uid>: <foreground read bytes> <foreground write bytes> <foreground read chars> <foreground write chars> <background read bytes> <background write bytes> <background read chars> <background write chars>
  • Read / write byte I / O events from storage devices.
  • Read / write character (also in bytes) is read / write data to the system call request.

Get I / O status from the kernel

From a core dump I / O usage, please use with the  -u option of  storaged command.

command:storaged -u

Command output formats:name/uid fg_rchar fg_wchar fg_rbytes fg_wbytes bg_rchar bg_wchar bg_rbytes bg_wbytes fg_fsync bg_fsync

Note : This output is similar to  proc/uid_io/stats the output. This is because the  storaged handles from the  /proc/uid_io/stats data and generate their own data.

Output:

com.google.android.backuptransport  2269  60  0  0  1719845663  143912573  149065728  184180736
com.android.vending  2170  60  0  0  219904796  38693092  174436352  18944000

 

Published 112 original articles · won praise 3 · Views 9702

Guess you like

Origin blog.csdn.net/yush34/article/details/104949492