• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html>
2<html>
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5    <title>quickstart_native_memory</title>
6
7    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
9    <style>
10      code[class*='smartperf-'],
11      pre[class*='smartperf-'] {
12        color: #333333;
13        background: none;
14        font-family: Helvetica;
15        line-height: 1.6;
16        text-align: left;
17        white-space: pre;
18        -moz-tab-size: 9;
19        -o-tab-size: 9;
20        tab-size: 8;
21        -webkit-hyphens: none;
22        -moz-hyphens: none;
23        -ms-hyphens: none;
24        hyphens: none;
25      }
26
27      /* Code blocks */
28      pre[class*='smartperf-'] {
29        padding: 0.9em;
30        overflow: auto;
31        border-radius: 2px;
32        background: #f5f5f4;
33      }
34
35      /* Inline code */
36      :not(pre) > code[class*='smartperf-'] {
37        white-space: normal;
38        background: #fcf8f8;
39        padding: 1px 0.2em;
40        border-radius: 1px 0.3em;
41      }
42
43      .tk.comment,
44      .tk.blockquote {
45        color: #8c918c;
46      }
47
48      .tk.cdata {
49        color: #183898;
50      }
51
52      .tk.doctype,
53      .tk.punctuation,
54      .tk.variable,
55      .tk.macro.property {
56        color: #424242;
57      }
58
59      .tk.operator,
60      .tk.important,
61      .tk.keyword,
62      .tk.rule,
63      .tk.builtin {
64        color: #b71d65;
65      }
66
67      .tk.string,
68      .tk.url,
69      .tk.regex,
70      .tk.attr-value {
71        color: #16338d;
72      }
73
74      .tk.property,
75      .tk.number,
76      .tk.boolean,
77      .tk.entity,
78      .tk.atrule,
79      .tk.constant,
80      .tk.symbol,
81      .tk.command,
82      .tk.code {
83        color: #037aa2;
84      }
85
86      .tk.tag,
87      .tk.selector,
88      .tk.prolog {
89        color: #69ad62;
90      }
91
92      .tk.function,
93      .tk.namespace,
94      .tk.pseudo-element,
95      .tk.class,
96      .tk.class-name,
97      .tk.pseudo-class,
98      .tk.id,
99      .tk.url-reference .tk.variable,
100      .tk.attr-name {
101        color: #775d9d;
102      }
103
104      .tk.entity {
105        cursor: help;
106      }
107
108      .tk.title,
109      .tk.title .tk.punctuation {
110        font-weight: bold;
111        color: #1a3773;
112      }
113
114      .tk.list {
115        color: #f56940;
116      }
117
118      .tk.inserted {
119        background-color: #eaffea;
120        color: #509b2f;
121      }
122
123      .tk.deleted {
124        background-color: #fae1e1;
125        color: #ad2d06;
126      }
127
128      .tk.bold {
129        font-weight: bolder;
130      }
131
132      .tk.italic {
133        font-style: normal;
134      }
135
136      /* JSON */
137      .smartperf-json .tk.property {
138        color: #19358c;
139      }
140
141      .smartperf-markup .tk.tag .tk.punctuation {
142        color: #2c2b2b;
143      }
144
145      /* CSS */
146      code.smartperf-css,
147      .smartperf-css .tk.function {
148        color: #047ca4;
149      }
150
151      /* YAML */
152      .smartperf-yaml .tk.atrule {
153        color: #609b5a;
154      }
155
156      code.smartperf-yaml {
157        color: #153491;
158      }
159
160      /* Ruby */
161      .smartperf-ruby .tk.function {
162        color: #3f3e3e;
163      }
164
165      /* Markdown */
166      .smartperf-markdown .tk.url {
167        color: #6e5298;
168      }
169
170      /* Makefile */
171      .smartperf-makefile .tk.symbol {
172        color: #6c5393;
173      }
174
175      .smartperf-makefile .tk.variable {
176        color: #183488;
177      }
178
179      .smartperf-makefile .tk.builtin {
180        color: #027ba4;
181      }
182
183      /* Bash */
184      .smartperf-bash .tk.keyword {
185        color: #027fa9;
186      }
187
188      /* highlight */
189      pre[dl] {
190        position: relative;
191        padding: 1em 1px 1px 0.9em;
192      }
193      pre[dl] .line-highlight-wrapper {
194        position: absolute;
195        top: 1px;
196        left: 1px;
197        background-color: transparent;
198        display: block;
199        width: 99%;
200      }
201
202      pre[dl] .line-highlight {
203        position: absolute;
204        left: 1px;
205        right: 1px;
206        padding: inherit;
207        margin-top: 0.9em;
208        background: hsla(25, 21%, 50%, 0.08);
209        background: linear-gradient(to right, hsla(24, 20%, 50%, 0.1) 70%, hsla(24, 20%, 50%, 0));
210        pointer-events: none;
211        line-height: inherit;
212        white-space: pre;
213      }
214
215      pre[dl] .line-highlight:before,
216      pre[dl] .line-highlight[data-end]:after {
217        content: attr(data-start);
218        position: absolute;
219        text-shadow: none;
220        top: 0.3em;
221        left: 0.7em;
222        min-width: 0.9em;
223        padding: 1px 0.6em;
224        background-color: hsla(24, 20%, 47%, 0.4);
225        color: hsl(20, 11%, 95%);
226        text-align: center;
227        vertical-align: 0.2em;
228        border-radius: 10000px;
229        box-shadow: 1px 2px #fdf6f6;
230      }
231
232      pre[dl] .line-highlight[data-end]:after {
233        content: attr(data-end);
234        top: auto;
235        bottom: 0.5em;
236      }
237      html body {
238        line-height: 1.6;
239        font-size: 16px;
240        color: #333333;
241        overflow: initial;
242        background-color: #ffffff;
243        word-wrap: break-word;
244        font-family: Helvetica;
245        box-sizing: border-box;
246      }
247
248      html body > :first-child {
249        margin-top: 0px;
250      }
251
252      html body h1,
253      html body h2,
254      html body h3,
255      html body h4,
256      html body h5,
257      html body h6 {
258        margin-top: 1em;
259        margin-bottom: 16px;
260        color: #000000;
261        line-height: 1.2;
262      }
263
264      html body h1 {
265        font-weight: 300;
266        font-size: 2.25em;
267        padding-bottom: 0.3em;
268      }
269
270      html body h2 {
271        font-weight: 410;
272        font-size: 1.74em;
273        padding-bottom: 0.2em;
274      }
275
276      html body h3 {
277        font-size: 1.6em;
278        font-weight: 501;
279      }
280
281      html body h4 {
282        font-size: 1.26em;
283        font-weight: 601;
284      }
285
286      html body h5 {
287        font-size: 1.2em;
288        font-weight: 601;
289      }
290
291      html body h6 {
292        font-size: 0.9em;
293        font-weight: 601;
294      }
295
296      html body h1,
297      html body h2,
298      html body h3,
299      html body h4,
300      html body h5 {
301        font-weight: 601;
302      }
303
304      html body h5 {
305        font-size: 0.9em;
306      }
307
308      html body h6 {
309        color: #5c5c5c;
310      }
311
312      html body strong {
313        color: #090909;
314      }
315
316      html body del {
317        color: #525252;
318      }
319
320      html body a:not([href]) {
321        color: inherit;
322        text-decoration: none;
323      }
324
325      html body a {
326        color: #0192da;
327        text-decoration: none;
328      }
329
330      html body a:hover {
331        color: #029dea;
332        text-decoration: none;
333      }
334
335      html body img {
336        max-width: 99%;
337      }
338
339      html body > p {
340        margin-top: 1px;
341        margin-bottom: 15px;
342        word-wrap: break-word;
343      }
344
345      html body > ul,
346      html body > ol {
347        margin-bottom: 15px;
348      }
349
350      html body ul,
351      html body ol {
352        padding-left: 1.9em;
353      }
354
355      html body ul.no-list,
356      html body ol.no-list {
357        padding: 0px;
358        list-style-type: none;
359      }
360
361      html body ul ul,
362      html body ul ol,
363      html body ol ol,
364      html body ol ul {
365        margin-top: 1px;
366        margin-bottom: 1px;
367      }
368
369      html body li {
370        margin-bottom: 1px;
371      }
372
373      html body li.task-list-item {
374        list-style: none;
375      }
376
377      html body li > p {
378        margin-top: 1px;
379        margin-bottom: 1px;
380      }
381
382      html body .task-list-item-checkbox {
383        margin: 0 0.3em 0.24em -1.7em;
384        vertical-align: middle;
385      }
386
387      html body .task-list-item-checkbox:hover {
388        cursor: pointer;
389      }
390
391      html body blockquote {
392        padding: 0.1px 15px 0 0.1px;
393        font-size: inherit;
394        color: #5c5c5c;
395        margin: 16px 0.1px 0 0.1px;
396        border-left: 3px solid #cbc9c9;
397        background-color: #e8e6e6;
398      }
399
400      html body blockquote > :first-child {
401        margin-top: 0.2px;
402      }
403
404      html body blockquote > :last-child {
405        margin-bottom: 0.1px;
406      }
407
408      html body hr {
409        height: 5px;
410        background-color: #cbcaca;
411        margin: 32px 0 0.1px 0;
412        border: 0 none;
413      }
414
415      html body table {
416        overflow: auto;
417        border-collapse: collapse;
418        margin: 15px 0.1px 20px 0.1px;
419        border-spacing: 0;
420      }
421
422      html body table th {
423        font-weight: bold;
424        color: #000000;
425      }
426
427      html body table td,
428      html body table th {
429        border: 1px solid #d6d6d6;
430        padding: 2px 14px;
431      }
432
433      html body dl {
434        padding: 0px;
435      }
436
437      html body dl dt {
438        padding: 0px;
439        margin-top: 15px;
440        font-size: 0.9em;
441        font-style: italic;
442        font-weight: bold;
443      }
444
445      html body dl dd {
446        padding: 0px 17px;
447        margin-bottom: 17px;
448      }
449
450      html body code {
451        font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
452        font-size: 0.86em !important;
453        color: #000000;
454        background-color: #f0f0f0;
455        border-radius: 4px;
456        padding: 0.3em 0px;
457      }
458
459      html body code::before,
460      html body code::after {
461        letter-spacing: -0.1em;
462        content: '\00a0';
463      }
464
465      html body pre > code {
466        padding: 1px;
467        margin: 0px;
468        font-size: 0.86em !important;
469        word-break: normal;
470        white-space: pre;
471        background: transparent;
472        border: 0px;
473      }
474
475      html body .highlight {
476        margin-bottom: 17px;
477      }
478
479      html body .highlight pre,
480      html body pre {
481        padding: 0.9em;
482        overflow: auto;
483        font-size: 0.86em !important;
484        line-height: 1.46;
485        border: #d6d6d6;
486        border-radius: 4px;
487      }
488
489      html body .highlight pre {
490        margin-bottom: 0px;
491        word-break: normal;
492      }
493
494      html body pre code,
495      html body pre tt {
496        display: inline;
497        max-width: initial;
498        padding: 1px;
499        margin: 1px;
500        overflow: initial;
501        line-height: inherit;
502        word-wrap: normal;
503        background-color: transparent;
504        border: 1px;
505      }
506
507      html body pre code:before,
508      html body pre tt:before,
509      html body pre code:after,
510      html body pre tt:after {
511        content: normal;
512      }
513
514      html body p,
515      html body blockquote,
516      html body ul,
517      html body ol,
518      html body dl,
519      html body pre {
520        margin-top: 1px;
521        margin-bottom: 17px;
522      }
523
524      html body kbd {
525        color: #000000;
526        border: 3px solid #d6d6d6;
527        border-bottom: 3px solid #c7c7c7;
528        padding: 3px 5px;
529        background-color: #f0f0f0;
530        border-radius: 2px;
531      }
532
533      @media print {
534        html body {
535          background-color: #ffffff;
536        }
537
538        html body h1,
539        html body h2,
540        html body h3,
541        html body h4,
542        html body h5,
543        html body h6 {
544          color: #000000;
545          page-break-after: avoid;
546        }
547
548        html body blockquote {
549          color: #5c5c53;
550        }
551
552        html body pre {
553          page-break-inside: avoid;
554        }
555
556        html body table {
557          display: table;
558        }
559
560        html body img {
561          display: block;
562          max-width: 99%;
563          max-height: 99%;
564        }
565
566        html body pre,
567        html body code {
568          word-wrap: break-word;
569          white-space: pre;
570        }
571      }
572      .smartperf-preview {
573        width: 99%;
574        height: 99%;
575        box-sizing: border-box;
576      }
577
578      .smartperf-preview .pagebreak,
579      .smartperf-preview .newpage {
580        page-break-before: always;
581      }
582
583      .smartperf-preview pre.line-numbers {
584        position: relative;
585        padding-left: 3.7em;
586        counter-reset: linenumber;
587      }
588
589      .smartperf-preview pre.line-numbers > code {
590        position: relative;
591      }
592
593      .smartperf-preview pre.line-numbers .line-numbers-rows {
594        position: absolute;
595        pointer-events: none;
596        top: 0.9em;
597        font-size: 99%;
598        left: 1px;
599        width: 3em;
600        letter-spacing: -1px;
601        border-right: 1px solid #999;
602        -webkit-user-select: none;
603        -moz-user-select: none;
604        -ms-user-select: none;
605        user-select: none;
606      }
607
608      .smartperf-preview pre.line-numbers .line-numbers-rows > span {
609        pointer-events: none;
610        display: block;
611        counter-increment: linenumber;
612      }
613
614      .smartperf-preview pre.line-numbers .line-numbers-rows > span:before {
615        content: counter(linenumber);
616        color: #999;
617        display: block;
618        padding-right: 0.79em;
619        text-align: right;
620      }
621
622      .smartperf-preview .mathjax-exps .MathJax_Display {
623        text-align: center !important;
624      }
625
626      .smartperf-preview:not([for='preview']) .code-chunk .btn-group {
627        display: none;
628      }
629
630      .smartperf-preview:not([for='preview']) .code-chunk .status {
631        display: none;
632      }
633
634      .smartperf-preview:not([for='preview']) .code-chunk .output-div {
635        margin-bottom: 16px;
636      }
637
638      .scrollbar-style::-webkit-scrollbar {
639        width: 8px;
640      }
641
642      .scrollbar-style::-webkit-scrollbar-track {
643        border-radius: 9px;
644        background-color: transparent;
645      }
646
647      .scrollbar-style::-webkit-scrollbar-thumb {
648        border-radius: 6px;
649        background-color: rgba(150, 150, 150, 1);
650        border: 4px solid rgba(150, 150, 150, 1);
651        background-clip: content-box;
652      }
653
654      html body[for='html-export']:not([dpm]) {
655        position: relative;
656        width: 99%;
657        height: 99%;
658        top: 1px;
659        left: 1px;
660        margin: 1px;
661        padding: 1px;
662        overflow: auto;
663      }
664
665      html body[for='html-export']:not([dpm]) .smartperf-preview {
666        position: relative;
667        top: 1px;
668      }
669
670      @media screen and (min-width: 914px) {
671        html body[for='html-export']:not([dpm]) .smartperf-preview {
672          padding: 2em calc(50% - 458px + 2em);
673        }
674      }
675
676      @media screen and (max-width: 914px) {
677        html body[for='html-export']:not([dpm]) .smartperf-preview {
678          padding: 1.9em;
679        }
680      }
681
682      @media screen and (max-width: 450px) {
683        html body[for='html-export']:not([dpm]) .smartperf-preview {
684          font-size: 15px !important;
685          padding: 1.1em;
686        }
687      }
688
689      @media print {
690        html body[for='html-export']:not([dpm]) #sidebar-toc-btn {
691          display: none;
692        }
693      }
694
695      html body[for='html-export']:not([dpm]) #sidebar-toc-btn {
696        position: fixed;
697        bottom: 9px;
698        left: 9px;
699        font-size: 28px;
700        cursor: pointer;
701        color: inherit;
702        z-index: 99;
703        width: 31px;
704        text-align: center;
705        opacity: 0.5;
706      }
707
708      html body[for='html-export']:not([dpm])[hsst] #sidebar-toc-btn {
709        opacity: 1;
710      }
711
712      html body[for='html-export']:not([dpm])[hsst] .md-sidebar-toc {
713        position: fixed;
714        top: 1px;
715        left: 1px;
716        width: 300px;
717        height: 99%;
718        padding: 32px 0 48px 0;
719        font-size: 14px;
720        box-shadow: 1px 1px 4px rgba(150, 150, 150, 0.33);
721        box-sizing: border-box;
722        overflow: auto;
723        background-color: inherit;
724      }
725
726      html body[for='html-export']:not([dpm])[hsst] .md-sidebar-toc::-webkit-scrollbar {
727        width: 9px;
728      }
729
730      html body[for='html-export']:not([dpm])[hsst] .md-sidebar-toc::-webkit-scrollbar-track {
731        border-radius: 11px;
732        background-color: transparent;
733      }
734
735      html body[for='html-export']:not([dpm])[hsst] .md-sidebar-toc::-webkit-scrollbar-thumb {
736        border-radius: 6px;
737        background-color: rgba(150, 150, 150, 0.66);
738        border: 3px solid rgba(150, 150, 150, 0.66);
739        background-clip: content-box;
740      }
741
742      html body[for='html-export']:not([dpm])[hsst] .md-sidebar-toc a {
743        text-decoration: none;
744      }
745
746      html body[for='html-export']:not([dpm])[hsst] .md-sidebar-toc ul {
747        padding: 1px 1.7em;
748        margin-top: 0.9em;
749      }
750
751      html body[for='html-export']:not([dpm])[hsst] .md-sidebar-toc li {
752        margin-bottom: 0.8em;
753      }
754
755      html body[for='html-export']:not([dpm])[hsst] .md-sidebar-toc ul {
756        list-style-type: none;
757      }
758
759      html body[for='html-export']:not([dpm])[hsst] .smartperf-preview {
760        left: 301px;
761        width: calc(100% - 300px);
762        padding: 2em calc(50% - 457px - 150px);
763        margin: 1px;
764        box-sizing: border-box;
765      }
766
767      @media screen and (max-width: 1274px) {
768        html body[for='html-export']:not([dpm])[hsst] .smartperf-preview {
769          padding: 1.9em;
770        }
771      }
772
773      @media screen and (max-width: 450px) {
774        html body[for='html-export']:not([dpm])[hsst] .smartperf-preview {
775          width: 99%;
776        }
777      }
778
779      html body[for='html-export']:not([dpm]):not([hsst]) .smartperf-preview {
780        left: 50%;
781        transform: translateX(-50%);
782      }
783
784      html body[for='html-export']:not([dpm]):not([hsst]) .md-sidebar-toc {
785        display: none;
786      }
787    </style>
788  </head>
789  <body for="html-export" id="body">
790    <div class="smartperf smartperf-preview">
791      <h1 class="mume-header fontColor">Native Memory抓取和展示说明</h1>
792
793      <p class="fontColor">Native Memory是查看内存的分配和释放等情况。</p>
794      <h2 class="mume-header fontColor">Native Memory的抓取</h2>
795
796      <h3 class="mume-header fontColor">Native Memory抓取配置参数</h3>
797
798      <p class="fontColor">
799        <img src="../figures/NativeMemory/nativememorysetting.jpg" alt="GitHub Logo" /><br />
800        配置参数说明:
801      </p>
802      <ul class="fontColor">
803        <li>ProcessId or ProcessName:设置抓取的进程ID或者进程名,此处以输入com.ohos.mms进程名为例。</li>
804        <li>Max unwind level:抓取的栈的最大深度。</li>
805        <li>Shared Memory Size:native_daemon和native_hook进程之间存储数据的共享内存大小。</li>
806        <li>Filter Memory Size:只抓取大于该size的malloc数据(free不受影响)。</li>
807        <li>Use Fp Unwind:Fp回栈。</li>
808        <li>Use Record Accurately:不过滤数据,上报全量的。</li>
809        <li>Use Offline Symbolization:离线符号化。</li>
810        <li>Use Record Statistics:统计数据上报时间间隔设置。</li>
811        <li>Use Startup Mode :抓取应用启动阶段的内存(默认是关闭,需要抓取应用启阶段内存可开启)。</li>
812      </ul>
813      <p class="fontColor">
814        再点击Record setting,在output file path输入文件名hiprofiler_data_nativememory.htrace,拖动滚动条设置buffer
815        size大小是64M,抓取时长是50s。<br />
816        <img src="../figures/NativeMemory/nativememoryset.jpg" alt="GitHub Logo" />
817      </p>
818      <p class="fontColor">
819        点击Trace command,就会根据上面的配置生成抓取命令,点击复制按钮,会将命令行复制。<br />
820        <img src="../figures/NativeMemory/nativememorycommand.jpg" alt="GitHub Logo" />
821      </p>
822      <p class="fontColor">命令行参数说明:</p>
823      <ul class="fontColor">
824        <li>save_file:是否将hook数据保存成文件,不上报protobuf形式数据给hiprofilerd。</li>
825        <li>filter_size:过滤malloc的大小,最小值是0,默认值是4096Byte。</li>
826        <li>smb_pages:nativedeamon与libnativehook间的共享内存大小。</li>
827        <li>max_stack_depth:最多回栈的层数,也就是抓取的栈的最大深度。</li>
828        <li>process_name:抓取的应用进程名。</li>
829        <li>string_compressed:是否进行字符串压缩。</li>
830        <li>fp_unwind:是否进行fp回栈。</li>
831        <li>callframe_compress: 是否进行栈帧压缩。</li>
832        <li>record_accurately: 是否不过滤数据,上报全量的。</li>
833        <li>offline_symbolization: 是否离线符号化。</li>
834        <li>statistics_interval: 统计模式下上报数据的时间间隔。</li>
835        <li>startup_mode: 是否需要抓取应用启动阶段内存。</li>
836      </ul>
837      <p class="fontColor">
838        输入hdc_std shell,进入设备,执行命令。<br />
839        <img src="../figures/NativeMemory/nativeexcutecommand.jpg" alt="GitHub Logo" /><br />
840        执行完成后,进入指定目录查看,在/data/local/tmp下就会生成trace文件。<br />
841        <img src="../figures/NativeMemory/naitvememoryfile.jpg" alt="GitHub Logo" />
842      </p>
843      <h2 class="mume-header fontColor">Native Memory展示说明</h2>
844
845      <p class="fontColor">将抓取的nativememory文件导入到smartperf工具中查看,查看内存的分配和释放等情况。</p>
846      <h3 class="mume-header fontColor">Native Memory泳道图展示类型</h3>
847
848      <p class="fontColor">
849        点击齿轮状的图标可以设置内存的展示单位。<br />
850        <img src="../figures/NativeMemory/NativeChart.jpg" alt="GitHub Logo" />
851      </p>
852      <ul class="fontColor">
853        <li>
854          <pre class="smartperf-text fontColor light">
855Current Bytes:以申请内存的size绘制泳道图。
856</pre
857          >
858        </li>
859        <li>
860          <pre class="smartperf-text fontColor light">
861Native Memory Density:以申请内存的数量绘制泳道图。
862</pre
863          >
864        </li>
865        <li>
866          <pre class="smartperf-text fontColor light">
867All Heap&amp;AnonuymousVM:malloc分配和mmap分配的总量。
868</pre
869          >
870        </li>
871        <li>
872          <pre class="smartperf-text fontColor light">
873All Heap:malloc分配的内存。
874</pre
875          >
876        </li>
877        <li>
878          <pre class="smartperf-text fontColor light">
879All Anonymous VM:mmap分配的内存。
880</pre
881          >
882        </li>
883      </ul>
884      <h3 class="mume-header fontColor">Native Memory泳道图的框选功能</h3>
885
886      <p class="fontColor">
887        可以对内存的数据进行框选,框选后在最下方的弹出层中会展示框选数据的统计表格,总共有四个tab页。<br />
888        Statistics的Tab页,主要显示了统计明细类型。<br />
889        <img src="../figures/NativeMemory/Statistics.jpg" alt="GitHub Logo" />
890      </p>
891      <ul class="fontColor">
892        <li>
893          <pre class="smartperf-text fontColor light">
894Memory Type:内存的类型。
895</pre
896          >
897        </li>
898        <li>
899          <pre class="smartperf-text fontColor light">
900Existing:框选区域内申请没有释放的大小。
901</pre
902          >
903        </li>
904        <li>
905          <pre class="smartperf-text fontColor light">
906#Existing:框选区域内申请没有释放的次数。
907</pre
908          >
909        </li>
910        <li>
911          <pre class="smartperf-text fontColor light">
912Transient:框选区域内释放的大小。
913</pre
914          >
915        </li>
916        <li>
917          <pre class="smartperf-text fontColor light">
918#Transient:框选区域内释放的次数。
919</pre
920          >
921        </li>
922        <li>
923          <pre class="smartperf-text fontColor light">
924Total Bytes:框选区间内申请的大小。
925</pre
926          >
927        </li>
928        <li>
929          <pre class="smartperf-text fontColor light">
930#Total: 框选区间内申请的次数。
931</pre
932          >
933        </li>
934        <li>
935          <pre class="smartperf-text fontColor light">
936Peak Value: 框选区间内内存申请的峰值。
937</pre
938          >
939        </li>
940        <li>
941          <pre class="smartperf-text fontColor light">
942Existing/Total:框选区间内剩余的内存比上申请的内存,其中浅紫色是框选区间内申请的大小/整个时间轴(申请+释放的总大小),深紫色是框选区间内(申请+释放)的大小/整个时间轴(申请+释放的总大小)。
943</pre
944          >
945        </li>
946      </ul>
947      <p class="fontColor">
948        Call Info的Tab页,主要显示了调用树详细类型。<br />
949        <img src="../figures/NativeMemory/CallInfo.jpg" alt="GitHub Logo" />
950      </p>
951      <ul class="fontColor">
952        <li>
953          <pre class="smartperf-text fontColor light">
954Symbol Name:每个内存分配的调用栈。
955</pre
956          >
957        </li>
958        <li>
959          <pre class="smartperf-text fontColor light">
960Size:分配的总大小。
961</pre
962          >
963        </li>
964        <li>
965          <pre class="smartperf-text fontColor light">
966Count:相同调用栈出现的次数。
967</pre
968          >
969        </li>
970      </ul>
971      <p class="fontColor">
972        Native Memory的Tab页,主要显示了单次分配信息列表。<br />
973        <img src="../figures/NativeMemory/NativeMemory.jpg" alt="GitHub Logo" />
974      </p>
975      <ul class="fontColor">
976        <li>
977          <pre class="smartperf-text fontColor light">
978Address:内存块的地址。
979</pre
980          >
981        </li>
982        <li>
983          <pre class="smartperf-text fontColor light">
984Memory Type:内存分配的类型。
985</pre
986          >
987        </li>
988        <li>
989          <pre class="smartperf-text fontColor light">
990Timestamp:时间戳信息。
991</pre
992          >
993        </li>
994        <li>
995          <pre class="smartperf-text fontColor light">
996State:内存地址当前状态Existed 表示框选范围内未释放,Freed表示已释放。
997</pre
998          >
999        </li>
1000        <li>
1001          <pre class="smartperf-text fontColor light">
1002Size:该次申请分配内存的大小。
1003</pre
1004          >
1005        </li>
1006        <li>
1007          <pre class="smartperf-text fontColor light">
1008Responsible Library :调用该函数的库。
1009</pre
1010          >
1011        </li>
1012        <li>
1013          <pre class="smartperf-text fontColor light">
1014Responsible Caller  :调用该函数的方法。
1015</pre
1016          >
1017        </li>
1018      </ul>
1019      <p class="fontColor">
1020        Snapshot List的Tab页,主要显示了各时刻内存的增长的差值。<br />
1021        <img src="../figures/NativeMemory/Snapshotlist.jpg" alt="GitHub Logo" />
1022      </p>
1023      <ul class="fontColor">
1024        <li>
1025          <pre class="smartperf-text fontColor light">
1026Snapshot:标记的打点说明。
1027</pre
1028          >
1029        </li>
1030        <li>
1031          <pre class="smartperf-text fontColor light">
1032Timestamp :时间戳信息。
1033</pre
1034          >
1035        </li>
1036        <li>
1037          <pre class="smartperf-text fontColor light">
1038Net Growth :自从上次Snapshot的增长量,是计算分配和释放的。
1039</pre
1040          >
1041        </li>
1042        <li>
1043          <pre class="smartperf-text fontColor light">
1044Total Growth :自从上次Snapshot的增长量,是计算的每一次分配的。
1045</pre
1046          >
1047        </li>
1048        <li>
1049          <pre class="smartperf-text fontColor light">
1050#Existing  :仍然存在的内存数。
1051</pre
1052          >
1053        </li>
1054      </ul>
1055      <h3 class="mume-header fontColor">Native Memory的辅助信息功能</h3>
1056
1057      <p class="fontColor">
1058        在Call Info和Native Memory的Tab页,点击选中某一行,右边画红线处会显示出该行调用栈的树结构信息。<br />
1059        <img src="../figures/NativeMemory/nativecallstack.jpg" alt="GitHub Logo" />
1060      </p>
1061      <h3 class="mume-header fontColor">Native Memory详细显示的过滤功能</h3>
1062
1063      <p class="fontColor">
1064        点击下方的All Allocations可以对Allocation lifeSpan进行过滤,有三个选择:All Allocations,Created &amp;
1065        Existing,Created &amp; Destroyed。<br />
1066        <img src="../figures/NativeMemory/lifespan.jpg" alt="GitHub Logo" />
1067      </p>
1068      <ul class="fontColor">
1069        <li>
1070          <pre class="smartperf-text fontColor light">
1071 All Allocations:所有的内存。
1072</pre
1073          >
1074        </li>
1075        <li>
1076          <pre class="smartperf-text fontColor light">
1077 Created &amp; Existing:创建且存活的内存。
1078</pre
1079          >
1080        </li>
1081        <li>
1082          <pre class="smartperf-text fontColor light">
1083 Created &amp; Destroyed: 创建且被销毁的内存。
1084</pre
1085          >
1086        </li>
1087      </ul>
1088      <p class="fontColor">
1089        点击下方的All Heap&amp;Anonymous VM可以对内存类型进行过滤。<br />
1090        <img src="../figures/NativeMemory/AllocationType.jpg" alt="GitHub Logo" />
1091      </p>
1092      <ul class="fontColor">
1093        <li>
1094          <pre class="smartperf-text fontColor light">
1095All Heap&amp;AnonuymousVM:Heap和AnonuymousVM的总量。
1096</pre
1097          >
1098        </li>
1099        <li>
1100          <pre class="smartperf-text fontColor light">
1101All Heap:malloc分配的内存。
1102</pre
1103          >
1104        </li>
1105        <li>
1106          <pre class="smartperf-text fontColor light">
1107All Anonymous VM:mmap的匿名页。
1108</pre
1109          >
1110        </li>
1111      </ul>
1112      <p class="fontColor">
1113        点击下方的Mark Snapshot可以在时间轴上打标签。出现小旗的标志,通过标注多个时间点。点击到Snapshot
1114        List标签页可以看到各个时间点的内存的增长值。<br />
1115        <img src="../figures/NativeMemory/Generation.jpg" alt="GitHub Logo" />
1116      </p>
1117      <h3 class="mume-header fontColor">Native Memory的火焰图功能</h3>
1118
1119      <p class="fontColor">
1120        火焰图的展示跟Callinfo的tab页的调用栈显示一致,鼠标放到色块上,悬浮框可以显示调用栈名称,栈的所在库名,地址,size大小,栈的个数。<br />
1121        <img src="../figures/NativeMemory/nativeflameshow.jpg" alt="GitHub Logo" />
1122      </p>
1123      <h3 class="mume-header fontColor">基于函数进行调用栈(单个或多个)选择后可以在时间轴上显示内存操作点</h3>
1124
1125      <p class="fontColor">
1126        点击火焰图函数时,触发火焰图点击中,显示调用栈中该函数出现在时间轴范围的分布情况。<br />
1127        <img src="../figures/NativeMemory/memoryframe.jpg" alt="GitHub Logo" />
1128      </p>
1129      <h3 class="mume-header fontColor">内存搜索大小写不敏感,上层火焰图的大小和总内存需要根据搜索内容动态调整</h3>
1130
1131      <p class="fontColor">
1132        执行搜索的关键字大小写不区分,搜索的函数的parent只显示搜索的children的大小之和,且可以与点选联动。
1133      </p>
1134      <h3 class="mume-header fontColor">焦点函数火焰图详细展开:选中函数的全部调用栈展示</h3>
1135
1136      <p class="fontColor">
1137        点击调用栈某个函数,点击函数调用的函数对应铺满画布,点击函数的parent,显示以及绘制的大小变化为点击函数的大小,如下图点击OHOS::EglCoreInit()函数,会显示该函数的全部调用栈。<br />
1138        <img src="../figures/NativeMemory/eg_callstack.jpg" alt="GitHub Logo" />
1139      </p>
1140      <h3 class="mume-header fontColor">搜索框支持表达式输入</h3>
1141
1142      <p class="fontColor">
1143        调用栈默认显示火焰图,新增搜索框表达式输入。表达式作用范围为nativehook统计与非统计模式。其中处理的均为Responsible
1144        Library与Responsible Caller,其中Responsible Library,Responsible Caller表示从下往上非libc++
1145        musl的第一条调用栈的lib跟symbol,如下图所示,由于最后一条 [ operator new(unsigned long) ]
1146        libc++.so为libc++.so的函数,固跳过,所以该条调用栈的Responsible Library为
1147        <a href="http://libhilog.so/">libhilog.so</a>,Responsible Caller为OHOS::HiviewDFX::GetDomainLevel(unsigned int)
1148        。<br />
1149        <img src="../figures/NativeMemory/framecaller.jpg" alt="GitHub Logo" /><br />
1150        表达式说明:在InputFilter输入框可以进行搜索过滤和表达式过滤,其中表达式必须以@开头,英文括号包起所需要过滤的内容,每个括号必须包括
1151        (Responsible Library,Responsible Caller)匹配全量以*表示,否则认为该输入为搜索过滤。
1152      </p>
1153      <table class="fontColor">
1154        <thead>
1155          <tr>
1156            <th class="fontColor">表达式</th>
1157            <th class="fontColor">含义</th>
1158          </tr>
1159        </thead>
1160        <tbody>
1161          <tr>
1162            <td>@(libquickjs tryalloc)</td>
1163            <td>只显示 Responsible Library为libquickjs 且Responsible Caller包含tryalloc的数据</td>
1164          </tr>
1165          <tr>
1166            <td>@(libquickjs *)</td>
1167            <td>只显示Responsible Library包含libquickjs的数据</td>
1168          </tr>
1169          <tr>
1170            <td>@(* tryalloc codec bitmapcache skYUV)</td>
1171            <td>
1172              只显示 Responsible Library为任意值 且Responsible Caller包含tryalloc或codec或bitmapcache或skYUV的数据
1173            </td>
1174          </tr>
1175          <tr>
1176            <td>@(libglobal *,*resourceManager)</td>
1177            <td>
1178              只显示Responsible Library包含libglobal且 Responsible Caller为任意值的数据 或 Responsible
1179              Library为任意值,Responsible Caller包含resourceManager的数据
1180            </td>
1181          </tr>
1182          <tr>
1183            <td>@(/data/user *)</td>
1184            <td>只显示Responsible Library路径/data/user且symbol为任意值的数据</td>
1185          </tr>
1186          <tr>
1187            <td>@(<a href="http://mali.so/">mali.so</a> *,libGLES_mali.so *)</td>
1188            <td>只显示Responsible Library包含mali.so或者libGLES_mali.so的数据</td>
1189          </tr>
1190          <tr>
1191            <td>@(* PixelMap:ReadImageData)</td>
1192            <td>只显示Responsible Caller包含PixelMap:ReadImageData的数据</td>
1193          </tr>
1194          <tr>
1195            <td></td>
1196            <td></td>
1197          </tr>
1198          <tr>
1199            <td>@-(libark jsvm table)</td>
1200            <td>不显示Responsible Library包含libark且Responsible Caller包含jsvm或者table的数据</td>
1201          </tr>
1202          <tr>
1203            <td>@-(librender picture, libskia picture) <br /></td>
1204            <td>不显示Responsible Library包含librender或者libskia且Responsible Caller中包含picture的数据</td>
1205          </tr>
1206          <tr>
1207            <td>@-(libark *)</td>
1208            <td>不显示Responsible Library包含libark的数据</td>
1209          </tr>
1210          <tr>
1211            <td>@-(* table)</td>
1212            <td>不显示Responsible Caller中table的数据</td>
1213          </tr>
1214          <tr>
1215            <td></td>
1216            <td></td>
1217          </tr>
1218          <tr>
1219            <td>@(* table) - (libark *)</td>
1220            <td>只显示Responsible Caller包含table且Responsible Library不为libark的数据</td>
1221          </tr>
1222        </tbody>
1223      </table>
1224      <h3 class="mume-header fontColor">Native Memory数据统计功能</h3>
1225
1226      <p class="fontColor">
1227        选择Use Record Statistics和statistics interval配置项抓取的数据,只会显示Call Info的Tab页,Call
1228        Info相关功能同上。<br />
1229        <img src="../figures/NativeMemory/statiscsCallInfo.jpg" alt="GitHub Logo" />
1230      </p>
1231      <h3 class="mume-header fontColor">Native Memory多进程数据显示</h3>
1232
1233      <p class="fontColor">
1234        前端可以支持多进程数据的展示,通过在tab页切换不同进程,可以显示不同进程的hook数据。<br />
1235        <img src="../figures/NativeMemory/hook_moreprocess.jpg" alt="GitHub Logo" />
1236      </p>
1237    </div>
1238
1239    <script>
1240      window.onload = () => {
1241        let isDark = window.location.search;
1242        if (isDark.indexOf('?') !== -1) {
1243          isDark = isDark.substr(1, isDark.length - 1);
1244        }
1245        if (isDark === 'true') {
1246          document.getElementById('body').setAttribute('style', 'background-color:#272C34;');
1247          let header = document.getElementsByClassName('fontColor');
1248          for (let i = 0; i < header.length; i++) {
1249            header[i].style.color = '#fff';
1250          }
1251          let lightBackGround = document.getElementsByClassName('light');
1252          for (let i = 0; i < lightBackGround.length; i++) {
1253            lightBackGround[i].style.backgroundColor = '#32373F';
1254          }
1255        }
1256      };
1257    </script>
1258  </body>
1259</html>
1260