diff --git a/zh-cn/application-dev/dfx/hidumper.md b/zh-cn/application-dev/dfx/hidumper.md index fdb6f2502d4cbec7dbcd3d9d89f53bd2bc04a5d2..ea8bca645d94da0e4f5f07002048c2f3bcfa7809 100644 --- a/zh-cn/application-dev/dfx/hidumper.md +++ b/zh-cn/application-dev/dfx/hidumper.md @@ -29,7 +29,7 @@ HiDumper为开发、测试人员提供统一的系统信息获取工具,可帮 | --mem [pid] | 获取总内存占用率;如果指定pid,则获取指定pid的内存占用率。 | | --zip | 保存命令输出到/data/log/hidumper下的压缩文件。 | | --ipc pid/-a --start-stat/stop-stat/stat | 统计一段时间进程IPC信息,如果使用-a则统计所有进程IPC数据,--start-stat开始统计,--stat获取统计数据,--stop-stat结束统计。 | -| --mem-smaps pid [-v] | 获取pid内存统计信息,数据来源于/proc/pid/smaps,使用-v指定更多详细信息。 (仅限制debug版本使用) | +| --mem-smaps pid [-v] | 获取pid内存统计信息,数据来源于/proc/pid/smaps,使用-v指定更多详细信息。(对于API version 20及之后版本,该功能将支持release版本的部分应用;对于API version 19及之前版本,该功能仅限debug版本可用。) | | --mem-jsheap pid [-T tid] [--gc] [--leakobj] | pid 必选参数。命令触发所有线程gc和快照导出。如果指定线程的tid,只触发该线程gc和快照导出;如果指定--gc,只触发gc不做快照导出;如果指定--leakobj,则获取泄露对象的列表。 | ## 常用命令 @@ -539,37 +539,79 @@ HiDumper为开发、测试人员提供统一的系统信息获取工具,可帮 $ hidumper --mem 1 -------------------------------[memory]------------------------------- - - Pss Shared Shared Private Private Swap SwapPss Heap Heap Heap - Total Clean Dirty Clean Dirty Total Total Size Alloc Free - ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) - -------------------------------------------------------------------------------------------------------------------------------------------- + + Pss Shared Shared Private Private Swap SwapPss Heap Heap Heap + Total Clean Dirty Clean Dirty Total Total Size Alloc Free + ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) + -------------------------------------------------------------------------------------------------------------------------------------------- GL 0 0 0 0 0 0 0 0 0 0 - Graph 0 0 0 0 0 0 0 0 0 0 - native heap 924 0 0 924 0 1948 1948 0 0 0 - AnonPage other 84 16 0 84 0 52 52 0 0 0 - stack 28 0 0 28 0 0 0 0 0 0 - .so 413 1548 0 248 56 216 216 0 0 0 - dev 190 0 856 0 0 0 0 0 0 0 - FilePage other 420 0 0 404 16 0 0 0 0 0 + Graph 0 0 0 0 0 0 0 0 0 0 + guard 0 0 0 0 0 0 0 0 0 0 + native heap 3284 0 0 0 3284 0 0 0 0 0 + AnonPage other 268 4 0 0 268 0 0 0 0 0 + stack 168 0 0 0 168 0 0 0 0 0 + .so 4507 34188 0 604 2460 0 0 0 0 0 + dev 34 0 140 32 0 0 0 0 0 0 + FilePage other 16 148 0 0 8 0 0 0 0 0 ---------------------------------------------------------------------------------------------------------------------------------------------------------- - Total 4275 1564 856 1688 72 2216 2216 0 0 0 - + Total 8277 34340 140 636 6188 0 0 0 0 0 + native heap: - jemalloc meta: 120 0 0 120 0 52 52 0 0 0 - jemalloc heap: 776 0 0 776 0 1888 1888 0 0 0 - brk heap: 20 0 0 20 0 8 8 0 0 0 - musl heap: 8 0 0 8 0 0 0 0 0 0 - + heap: 124 0 0 0 124 0 0 0 0 0 + brk heap: 3160 0 0 0 3160 0 0 0 0 0 + Purgeable: PurgSum:0 kB PurgPin:0 kB - + DMA: Dma:0 kB ``` + ``` + $ hidumper --mem `pidof com.application` + + -------------------------------[memory]------------------------------- + + Pss Shared Shared Private Private Swap SwapPss Heap Heap Heap + Total Clean Dirty Clean Dirty Total Total Size Alloc Free + ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) ( kB ) + ------------------------------------------------------------------------------------------------------------------------------------------------------ + GL 101940 0 0 0 101940 0 0 0 0 0 + Graph 57092 0 0 0 57092 0 0 0 0 0 + guard 0 0 0 0 0 0 0 0 0 0 + native heap 92484 0 0 92484 0 0 0 0 0 0 + AnonPage other 11616 16 0 11616 0 0 0 0 0 0 + stack 608 0 0 608 0 0 0 0 0 0 + .so 23528 23104 0 14960 6016 0 0 0 0 0 + dev 77 0 224 76 0 0 0 0 0 0 + .ttf 4064 2804 0 2880 0 0 0 0 0 0 + FilePage other 24194 60 27996 3684 6528 0 0 0 0 0 + -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Total 315603 25984 28220 126308 171576 0 0 0 0 0 + + native heap: + jemalloc meta: 2992 0 0 2992 0 0 0 0 0 0 + jemalloc heap: 88664 0 0 88664 0 0 0 0 0 0 + brk heap: 776 0 0 776 0 0 0 0 0 0 + musl heap: 52 0 0 52 0 0 0 0 0 0 + + Purgeable: + PurgSum:0 kB + PurgPin:0 kB + + DMA: + Dma:57092 kB + + Ashmem: + Total Ashmem:36704 kB + Process_name Process_ID Fd Cnode_idx Applicant_Pid Ashmem_name Virtual_size Physical_size magic + com.application 1600 13 328305 1600 dev/ashmem/hdi_smq 135168 135168 10 + com.application 1600 16 328305 1448 dev/ashmem/hdi_smq 135168 135168 11 + ... + ``` **Graph字段统计方式为:计算/proc/process_dmabuf_info节点下该进程使用的内存大小。** + **ashmem为匿名共享内存。** 16. 保存命令输出到/data/log/hidumper下的压缩文件。 @@ -656,61 +698,40 @@ HiDumper为开发、测试人员提供统一的系统信息获取工具,可帮 > **注意** > - > 该命令仅限debug版本使用,release版本不可用。 + > 该命令在debug版本中无限制,在release版本中仅支持调试debug签名的应用。 + > + > hidumper --mem-smaps pid -v命令在debug版本会打印Perm、Start和End三列数据,在release版本不会打印这三列数据。 > > 如何区分debug/release版本:请查看`hidumper -p`中说明。 + > + > 查看应用是否为debug签名的应用:参考[获取自身的应用程序信息](../reference/apis-ability-kit/js-apis-bundleManager-applicationInfo.md#获取自身的应用程序信息)中的appProvisionType字段,若appProvisionType为debug,则说明是debug签名的应用。 **使用样例:** + ``` - $ hidumper --mem-smaps 1 - usage: - -h |help text for the tool - -lc |a list of system information clusters - -ls |a list of system abilities - -c |all system information clusters - -c [base system] |system information clusters labeled "base" and "system" - -s |all system abilities - -s [SA0 SA1] |system abilities labeled "SA0" and "SA1" - -s [SA] -a ['-h'] |system ability labeled "SA" with arguments "-h" specified - -e |faultlogs of crash history - --net [pid] |dump network information; if pid is specified, dump traffic usage of specified pid - --storage [pid] |dump storage information; if pid is specified, dump /proc/pid/io - -p |processes information, include list and information of processes and threads - -p [pid] |dump threads under pid, includes smap, block channel, execute time, mountinfo - --cpufreq |dump real CPU frequency of each core - --mem [pid] |dump memory usage of total; dump memory usage of specified pid if pid was specified - --zip |compress output to /data/log/hidumper - --mem-smaps pid [-v] |display statistic in /proc/pid/smaps, use -v specify more details - --mem-jsheap pid [-T tid] [--gc] [--leakobj] |triggerGC, dumpHeapSnapshot and dumpLeakList under pid and tid - --ipc pid ARG |ipc load statistic; pid must be specified or set to -a dump all processes. ARG must be one of --start-stat | --stop-stat | --stat - --cpuusage [pid] |dump cpu usage by processes and category; if PID is specified, dump category usage of specified pid + # hidumper --mem-smaps `pidof com.application` + -------------------------------[memory]------------------------------- + + Shared Shared Private Private + Size Rss Pss Clean Dirty Clean Dirty Swap SwapPss Counts Category Name + 16 0 0 0 0 0 0 4 4 3 FilePage other [anon] + 8 8 8 0 0 8 0 0 0 1 FilePage other /bin/init + ... - $ hidumper --mem-smaps 1 -v - usage: - -h |help text for the tool - -lc |a list of system information clusters - -ls |a list of system abilities - -c |all system information clusters - -c [base system] |system information clusters labeled "base" and "system" - -s |all system abilities - -s [SA0 SA1] |system abilities labeled "SA0" and "SA1" - -s [SA] -a ['-h'] |system ability labeled "SA" with arguments "-h" specified - -e |faultlogs of crash history - --net [pid] |dump network information; if pid is specified, dump traffic usage of specified pid - --storage [pid] |dump storage information; if pid is specified, dump /proc/pid/io - -p |processes information, include list and information of processes and threads - -p [pid] |dump threads under pid, includes smap, block channel, execute time, mountinfo - --cpufreq |dump real CPU frequency of each core - --mem [pid] |dump memory usage of total; dump memory usage of specified pid if pid was specified - --zip |compress output to /data/log/hidumper - --mem-smaps pid [-v] |display statistic in /proc/pid/smaps, use -v specify more details - --mem-jsheap pid [-T tid] [--gc] [--leakobj] |triggerGC, dumpHeapSnapshot and dumpLeakList under pid and tid - --ipc pid ARG |ipc load statistic; pid must be specified or set to -a dump all processes. ARG must be one of --start-stat | --stop-stat | --stat - --cpuusage [pid] |dump cpu usage by processes and category; if PID is specified, dump category usage of specified pid + # hidumper --mem-smaps `pidof com.application` -v + + -------------------------------[memory]------------------------------- + + Shared Shared Private Private + Size Rss Pss Clean Dirty Clean Dirty Swap SwapPss Perm Start End Category Name + 4 4 2 0 4 0 0 0 0 r--p 004a8000 004ab000 FilePage other [anon] + 4 4 2 0 4 0 0 0 0 r-xp 004ab000 004ae000 FilePage other /bin/init + ... ``` + -18. 运行 **hidumper --mem-jsheap pid [-T tid] [--gc] [--leakobj]** pid 必选参数。命令触发所有线程gc和快照导出。如果指定线程的tid,只触发该线程gc和快照导出;如果指定--gc,只触发gc不做快照导出;如果指定--leakobj,则获取泄露对象的列表。(仅限debug版本使用) +18. 运行**hidumper --mem-jsheap pid [-T tid] [--gc] [--leakobj]** pid 必选参数。命令触发所有线程gc和快照导出。如果指定线程的tid,只触发该线程gc和快照导出;如果指定--gc,只触发gc不做快照导出;如果指定--leakobj,则获取泄露对象的列表。(仅限debug版本使用) ``` hidumper --mem-jsheap pid [-T tid] [--gc] [--leakobj]