Openharmony 对应Android内存查看

        众所周知,内存查看是一个很重要的部分,大多数情况,我们都是使用dumpsys的方法对android的内存进行查看,但是对于openharmony而言好像又不太一样了。

Android内存查看

命令行:

adb shell dumpsys meminfo 

得到的结果:

Applications Memory Usage (in Kilobytes):
Uptime: 99398 Realtime: 99398

** MEMINFO in pid 2328 [com.android.systemui] **
                   Pss  Private  Private     Swap      Rss     Heap     Heap     Heap
                 Total    Dirty    Clean    Dirty    Total     Size    Alloc     Free
                ------   ------   ------   ------   ------   ------   ------   ------
  Native Heap   187950   187932        0        0   190616   198260   188316     5017
  Dalvik Heap    31234    31188        0        0    35336    39483     9871    29612
 Dalvik Other     4064     3988        0        0     5016
        Stack     1148     1148        0        0     1160
       Cursor       24       24        0        0       24
       Ashmem       58       48        0        0      148
      Gfx dev     2356     2356        0        0     2360
    Other dev       51        0       48        0      292
     .so mmap     4500      284      204        0    52188
    .jar mmap     1367        0        0        0    30820
    .apk mmap    22278        8    17296        0    83456
    .ttf mmap     1498        0      480        0     3492
    .dex mmap    26859       32    26824        0    26952
    .oat mmap      577        0        0        0    15592
    .art mmap     2004     1792        0        0    20176
   Other mmap      384       32       96        0     3928
   EGL mtrack    23720    23720        0        0    23720
    GL mtrack    28804    28804        0        0    28804
      Unknown      783      780        0        0     1512
        TOTAL   339659   282136    44948        0   339659   237743   198187    34629

 App Summary
                       Pss(KB)                        Rss(KB)
                        ------                         ------
           Java Heap:    32980                          55512
         Native Heap:   187932                         190616
                Code:    45136                         212756
               Stack:     1148                           1160
            Graphics:    54880                          54884
       Private Other:     5008
              System:    12575
             Unknown:                                   10664

           TOTAL PSS:   339659            TOTAL RSS:   525592      TOTAL SWAP (KB):        0

 Objects
               Views:     1531         ViewRootImpl:        9
         AppContexts:       19           Activities:        0
              Assets:       21        AssetManagers:        0
       Local Binders:      378        Proxy Binders:      124
       Parcel memory:       37         Parcel count:      138
    Death Recipients:        5      OpenSSL Sockets:        0
            WebViews:        0

 SQL
         MEMORY_USED:      328
  PAGECACHE_OVERFLOW:       58          MALLOC_SIZE:      117

 DATABASES
      pgsz     dbsz   Lookaside(b)          cache  Dbname
         4       32             48         7/17/2  /data/user_de/0/com.android.systemui/databases/keyguard_db2
         4       28             25         9/21/2  /data/user_de/0/com.android.systemui/databases/notificationdata.db

        我们可以很清楚地看到对应该报名的应用的PSS,Private Clean,Private等信息,一般最主要关注的就是第一行和Total,总的每一项的Total占用多少KB,以及PSS的Total每一项都包括哪些内容。

OpenHarmony内存查看

        我们都知道hdc shell进去之后并不存在dumpsys的命令,但是如果open harmony后续应用的话,内存管理这一块是绕不过的,所以找了好多资料,终于找到了对应的方法。

友情链接: OpenAtom OpenHarmony

命令行:

hdc shell hidumper --mem 

得到的结果:

-------------------------------[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            48             0             0             0            48             0             0             0             0             0
         Graph             0             0             0             0             0             0             0             0             0             0
   ark ts heap          2402             0          1376             0          2304           480            45             0             0             0
         guard             0             0             0             0             0             0             0             0             0             0
   native heap        183266           152          2724          1268        181768          5148           923         91764         86108          5127
AnonPage other        315730            88           564            56        315620          1752           124             0             0             0
         stack          1240             0             0             0          1240            20            20             0             0             0
          .hap          8268             0             0          8268             0             0             0             0             0             0
           .so         52657         38520          3256         39524          6876          6000           358             0             0             0
           dev            12             0           140            12             0             0             0             0             0             0
FilePage other            19           252            40             0             0             4             4             0             0             0
----------------------------------------------------------------------------------------------------------------------------------------------------------
         Total        565116         39012          8100         49128        507856         13404          1474         91764         86108          5127

native heap:
           heap:            60             0             0             0            60            28            28             0             0             0
       brk heap:           552             0           924           200           300            64            48             0             0             0
  jemalloc heap:        182654           152          1800          1068        181408          5056           847             0             0             0

Purgerable:
        PurgSum:0 kB
        PurgPin:0 kB

DMA:
            Dma:73920 kB

这里面的内容同dumpsys meminfo的内容并不太一样,不过分析方法也一样,可以一一对应下,最重要的还是第一列和最后Total一行。

你可能感兴趣的:(ADB系列,android,harmonyos)