1fb726d48Sopenharmony_ci# FileSystem 的抓取和展示说明
2fb726d48Sopenharmony_ci
3fb726d48Sopenharmony_ciFileSystem 分析文件系统的信息和活动,比如读和写操作等。
4fb726d48Sopenharmony_ci
5fb726d48Sopenharmony_ci## FileSystem 的抓取
6fb726d48Sopenharmony_ci
7fb726d48Sopenharmony_ci### FileSystem 抓取配置参数
8fb726d48Sopenharmony_ci
9fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/filesystemsetting.jpg)
10fb726d48Sopenharmony_ci配置项说明:
11fb726d48Sopenharmony_ci
12fb726d48Sopenharmony_ci-     Start FileSystem Record:配置项的总开关。
13fb726d48Sopenharmony_ci-     Process:默认配置的是整个系统的,也可选择单进程抓取。
14fb726d48Sopenharmony_ci-     Max Unwind Level:配置抓取调用栈的最大深度。
15fb726d48Sopenharmony_ci
16fb726d48Sopenharmony_ci再点击 Record setting,在 output file path 输入文件名 hiprofiler_data_filesystem.htrace,拖动滚动条设置 buffer size 大小是 64MB,抓取时长是 50s。
17fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/filesystemrecord.jpg)
18fb726d48Sopenharmony_ci点击 Trace command,就会根据上面的配置生成抓取命令,点击复制按钮,会将命令行复制。
19fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/FileSystemcommand.jpg)
20fb726d48Sopenharmony_ci输入 hdc shell,进入设备,执行命令。
21fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/FileSystemexcutecommand.jpg)
22fb726d48Sopenharmony_ci执行完成后,进入指定目录查看,在/data/local/tmp 下就会生成 trace 文件。
23fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/FileSystemfile.jpg)
24fb726d48Sopenharmony_ci
25fb726d48Sopenharmony_ci### FileSystem 展示说明
26fb726d48Sopenharmony_ci
27fb726d48Sopenharmony_ci将抓取的 trace 文件导入 smartperf 界面查看。
28fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/FileSystemsummary.jpg)
29fb726d48Sopenharmony_ci
30fb726d48Sopenharmony_ci界面布局介绍:FileSystem 整体界面布局分为 3 个部分:
31fb726d48Sopenharmony_ci
32fb726d48Sopenharmony_ci-     红色区域:泳道图。
33fb726d48Sopenharmony_ci-     绿色区域:详细信息。
34fb726d48Sopenharmony_ci-     黄色区域:辅助信息(Callstack)。
35fb726d48Sopenharmony_ci
36fb726d48Sopenharmony_ci### FileSystem 泳道图展示
37fb726d48Sopenharmony_ci
38fb726d48Sopenharmony_ciFileSystem 泳道图按照读操作和写操作展示,鼠标移动到泳道图上,悬浮框会以 10ms 为周期展示读,写类型系统调用的次数。
39fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/FileSystemchart.jpg)
40fb726d48Sopenharmony_ci按住 w 键放大界面,悬浮框会显示当前时刻的文件读写次数。
41fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/FileSystemcount.jpg)
42fb726d48Sopenharmony_ci
43fb726d48Sopenharmony_ci### FileSystem 泳道图的框选功能
44fb726d48Sopenharmony_ci
45fb726d48Sopenharmony_ci可以对读写操作泳道图进行框选,框选后展示框选数据的统计表格,总共有六个 tab 页。
46fb726d48Sopenharmony_ciFileSystem statistics 的 Tab 页如图:
47fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/FileSystemstatistics.jpg)
48fb726d48Sopenharmony_ci
49fb726d48Sopenharmony_ci-     Syscall/Process: 按照数据类型,进程分类显示。
50fb726d48Sopenharmony_ci-     Count: 系统调用的数量。
51fb726d48Sopenharmony_ci-     Logical Writes:写数据统计。
52fb726d48Sopenharmony_ci-     Logical Reads:读数据统计。
53fb726d48Sopenharmony_ci-     Other Filesystem Bytes:其他数据量。
54fb726d48Sopenharmony_ci-     Duration:总时长。
55fb726d48Sopenharmony_ci-     Min Duration:最小时长。
56fb726d48Sopenharmony_ci-     Avg Duration: 平均时长。
57fb726d48Sopenharmony_ci-     Max Duration:最大时长。
58fb726d48Sopenharmony_ci  FileSystem CallTree 的 Tab 页如图:
59fb726d48Sopenharmony_ci  ![GitHub Logo](../../figures/FileSystem/FileSystemCalltree.jpg)
60fb726d48Sopenharmony_ci-     Call Stack:为经过符号解析后的Callstack,并且给出动态链接库或者进程名的信息。
61fb726d48Sopenharmony_ci-     Local:为该调用方法自身占用的 CPU 时间。
62fb726d48Sopenharmony_ci-     Weight:为该调用方法占用的 CPU 时间。
63fb726d48Sopenharmony_ci-     %:为该调用方法占用的 CPU 时间占比。
64fb726d48Sopenharmony_ci  FileSystem Events 的 Tab 页如图:
65fb726d48Sopenharmony_ci  ![GitHub Logo](../../figures/FileSystem/FileSystemevents.jpg)
66fb726d48Sopenharmony_ci-     Start: 起始时间。
67fb726d48Sopenharmony_ci-     Duration:时长。
68fb726d48Sopenharmony_ci-     Process:进程名。
69fb726d48Sopenharmony_ci-     Thread:线程名。
70fb726d48Sopenharmony_ci-     Type:操作类型。
71fb726d48Sopenharmony_ci-     File Descriptor:文件描述符。
72fb726d48Sopenharmony_ci-     File Path:文件路径。
73fb726d48Sopenharmony_ci-     First Argument:系统调用的第一个参数。
74fb726d48Sopenharmony_ci-     Second Argument:系统调用的第二个参数。
75fb726d48Sopenharmony_ci-     Third Argument:系统调用的第三个参数。
76fb726d48Sopenharmony_ci-     Fourth Argument:系统调用的第四个参数。
77fb726d48Sopenharmony_ci-     Return:系统调用的返回值。
78fb726d48Sopenharmony_ci-     Error:错误码。
79fb726d48Sopenharmony_ci-     Backtrace:调用栈顶部函数,并显示调用栈深度。
80fb726d48Sopenharmony_ci  File Descriptor History 的 Tab 页如图:
81fb726d48Sopenharmony_ci  ![GitHub Logo](../../figures/FileSystem/FileSystemhistory.jpg)
82fb726d48Sopenharmony_ci-     Start: 起始时间。
83fb726d48Sopenharmony_ci-     Duration:时长。
84fb726d48Sopenharmony_ci-     Process:进程名。
85fb726d48Sopenharmony_ci-     Type:操作类型。
86fb726d48Sopenharmony_ci-     File Descriptor:文件描述符。
87fb726d48Sopenharmony_ci-     Path:文件路径。
88fb726d48Sopenharmony_ci-     Backtrace:调用栈顶部函数,并显示调用栈深度。
89fb726d48Sopenharmony_ci  File Descriptor Time Slice 的 Tab 页如图:
90fb726d48Sopenharmony_ci  ![GitHub Logo](../../figures/FileSystem/FileSystemtimeslice.jpg)
91fb726d48Sopenharmony_ci-     Open Time: 打开的起始时间。
92fb726d48Sopenharmony_ci-     Open Duration:打开的时长。
93fb726d48Sopenharmony_ci-     Process:进程名。
94fb726d48Sopenharmony_ci-     File Descriptor:文件描述符。
95fb726d48Sopenharmony_ci-     Path:文件路径。
96fb726d48Sopenharmony_ci-     Backtrace:调用栈顶部函数,并显示调用栈深度。
97fb726d48Sopenharmony_ci
98fb726d48Sopenharmony_ci### FileSystem 支持多种 Options 展示风格
99fb726d48Sopenharmony_ci
100fb726d48Sopenharmony_ci点击 FileSystem CallTree 的 Tab 页底部的 Options,会有四个 CheckBox 复选框。
101fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/FileSystemOptions.jpg)
102fb726d48Sopenharmony_ci
103fb726d48Sopenharmony_ci-     Invert:反向输出调用树。
104fb726d48Sopenharmony_ci-     Hide System so:隐藏系统库文件。
105fb726d48Sopenharmony_ci-     Hide Event:隐藏事件。
106fb726d48Sopenharmony_ci-     Hide Thread:隐藏线程。
107fb726d48Sopenharmony_ci
108fb726d48Sopenharmony_ci### FileSystem 支持过滤调用栈调用次数的展示风格
109fb726d48Sopenharmony_ci
110fb726d48Sopenharmony_ci点击 FileSystem CallTree 的 Tab 页底部的 Sample Count Filter,可以填上区间值。过滤出符合该区间值调用次数的调用栈信息。
111fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/FileSystemsamplecounter.jpg)
112fb726d48Sopenharmony_ci
113fb726d48Sopenharmony_ci### FileSystem 功能的调用栈 Group 展示-数据分析支持剪裁功能
114fb726d48Sopenharmony_ci
115fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/FileSystemdatamining.jpg)
116fb726d48Sopenharmony_ci
117fb726d48Sopenharmony_ci- 裁剪 Callstack,点击 Callstack 上一个节点符号,再点击底部 Symbol Filter 按钮,则该符号自动被裁剪掉,同时将该节点往下所有的 Callstack 内容裁剪掉。
118fb726d48Sopenharmony_ci
119fb726d48Sopenharmony_ci- 裁剪 Library,点击 Library 上一个节点符号,再点击底部 Library Filter 按钮,则该符号自动被裁剪掉,同时将该节点往下所有的 Callstack 内容裁剪掉。
120fb726d48Sopenharmony_ci- 点击 Reset 按钮,将恢复选中的裁剪内容。
121fb726d48Sopenharmony_ci
122fb726d48Sopenharmony_ci### FileSystem 功能的调用栈 Group 展示支持按条件过滤
123fb726d48Sopenharmony_ci
124fb726d48Sopenharmony_ci在 Input Filter 输入关键字,会显示出带有该关键字的展示信息。
125fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/FileSysteminputfilter.jpg)
126fb726d48Sopenharmony_ci
127fb726d48Sopenharmony_ci### FileSystem 辅助信息区展示调用栈
128fb726d48Sopenharmony_ci
129fb726d48Sopenharmony_ci当在详细信息区选择一个符号时,将展示与该符号相关的完整的调用栈。如下图的 Heaviest Stack Trace:
130fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/FileSystemheaviesttrace.jpg)
131fb726d48Sopenharmony_ci
132fb726d48Sopenharmony_ci### FileSystem 的事件类型的过滤
133fb726d48Sopenharmony_ci
134fb726d48Sopenharmony_ci通过选择可以过滤是 Open 类型,还是 Close 类型事件。
135fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/filesystemfilter.jpg)
136fb726d48Sopenharmony_ci
137fb726d48Sopenharmony_ci### FileSystem 的火焰图功能
138fb726d48Sopenharmony_ci
139fb726d48Sopenharmony_ci点击 FileSystem CallTree 左下角的柱状图的图标,会切换到火焰图页面。
140fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/FileSystemflame.jpg)
141fb726d48Sopenharmony_ci进入到火焰图页面,火焰图的展示跟 Callinfo 的 tab 页的调用栈显示一致,鼠标放到色块上,悬浮框可以显示调用栈名称、所属Lib库、函数地址、耗时及其占比。
142fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/FileSystemflameshow.jpg)
143fb726d48Sopenharmony_ci鼠标左键火焰图,会进入下一级界面,左键上级则返回上一级界面。
144fb726d48Sopenharmony_ci![GitHub Logo](../../figures/FileSystem/FileSystemflamelevel.jpg)
145