• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "trace_streamer_config.h"
17 #ifdef ENABLE_MEMORY
18 #include "memory_plugin_common.pbreader.h"
19 #endif
20 namespace SysTuning {
21 namespace TraceCfg {
22 #ifdef ENABLE_MEMORY
23 using namespace ProtoReader;
24 #endif
TraceStreamerConfig()25 TraceStreamerConfig::TraceStreamerConfig()
26 {
27     InitEventNameMap();
28     eventErrorDescMap_ = {
29         {STAT_EVENT_RECEIVED, TRACE_STAT_TYPE_RECEIVED_DESC},
30         {STAT_EVENT_DATA_LOST, TRACE_STAT_TYPE_LOST_DESC},
31         {STAT_EVENT_NOTMATCH, TRACE_STAT_TYPE_NOTMATCH_DESC},
32         {STAT_EVENT_NOTSUPPORTED, TRACE_STAT_TYPE_NOTSUPPORTED_DESC},
33         {STAT_EVENT_DATA_INVALID, TRACE_STAT_TYPE_DATA_INVALID_DESC},
34     };
35     serverityLevelDescMap_ = {
36         {STAT_SEVERITY_LEVEL_INFO, STAT_SEVERITY_LEVEL_INFO_DESC},
37         {STAT_SEVERITY_LEVEL_WARN, STAT_SEVERITY_LEVEL_WARN_DESC},
38         {STAT_SEVERITY_LEVEL_ERROR, STAT_SEVERITY_LEVEL_ERROR_DESC},
39         {STAT_SEVERITY_LEVEL_FATAL, STAT_SEVERITY_LEVEL_FATAL_DESC},
40     };
41     memNameMap_ = {
42         {MEM_VM_SIZE, MEM_INFO_VM_SIZE_DESC},   {MEM_VM_LOCKED, MEM_INFO_LOCKED_DESC},
43         {MEM_VM_RSS, MEM_INFO_RSS_DESC},        {MEM_VM_ANON, MEM_INFO_RSS_ANON_DESC},
44         {MEM_RSS_FILE, MEM_INFO_RSS_FILE_DESC}, {MEM_RSS_SHMEM, MEM_INFO_RSS_SCHEM_DESC},
45         {MEM_VM_SWAP, MEM_INFO_SWAP_DESC},      {MEM_VM_LOCKED, MEM_INFO_VIRT_DESC},
46         {MEM_VM_HWM, MEM_INFO_HWM_DESC},        {MEM_OOM_SCORE_ADJ, MEM_INFO_SCORE_ADJ_DESC},
47         {MEM_PURG_SUM, MEM_INFO_PURG_SUM_DESC}, {MEM_PURG_PIN, MEM_INFO_PURG_PIN_DESC},
48         {MEM_GL_PSS, MEM_INFO_GL_PSS_DESC},     {MEM_GRAPH_PSS, MEM_INFO_GRAPH_PSS_DESC},
49     };
50 
51 #ifdef ENABLE_MEMORY
52     InitSysMemMap();
53     InitSysVmemMap();
54 #endif
55     InitSecurityMap();
56     if (eventNameMap_.size() != TRACE_EVENT_MAX) {
57         TS_LOGF("eventNameMap_.size() max be %d, logic error", TRACE_EVENT_MAX);
58     }
59     if (eventErrorDescMap_.size() != STAT_EVENT_MAX) {
60         TS_LOGF("eventErrorDescMap_.size() max be %d, logic error", STAT_EVENT_MAX);
61     }
62     if (serverityLevelDescMap_.size() != STAT_SEVERITY_LEVEL_MAX) {
63         TS_LOGF("serverityLevelDescMap_.size() max be %d, logic error", STAT_SEVERITY_LEVEL_MAX);
64     }
65     if (eventParserStatSeverityDescMap_.size() != TRACE_EVENT_MAX) {
66         TS_LOGF("eventParserStatSeverityDescMap_.size() max be %d, logic error", TRACE_EVENT_MAX);
67     }
68     if (memNameMap_.size() != MEM_MAX) {
69         TS_LOGF("memNameMap_.size() max be %d, logic error", MEM_MAX);
70     }
71     for (int32_t i = TRACE_EVENT_START; i < TRACE_EVENT_MAX; i++) {
72         if (eventParserStatSeverityDescMap_.at(static_cast<SupportedTraceEventType>(i)).size() != STAT_EVENT_MAX) {
73             TS_LOGF("every item in eventParserStatSeverityDescMap_ max be %d, logic error", STAT_EVENT_MAX);
74         }
75     }
76 }
77 
PrintInfo() const78 void TraceStreamerConfig::PrintInfo() const
79 {
80     printf("---all kind of trace event info---\n");
81     for (auto itor = eventNameMap_.begin(); itor != eventNameMap_.end(); itor++) {
82         printf("%s\n", itor->second.c_str());
83     }
84     printf("\n");
85     printf("---subdir of process mem info---\n");
86     for (auto itor = memNameMap_.begin(); itor != memNameMap_.end(); itor++) {
87         printf("%s\n", itor->second.c_str());
88     }
89     printf("\n");
90     printf("---subdir of sys mem info---\n");
91     for (auto itor = sysMemNameMap_.begin(); itor != sysMemNameMap_.end(); itor++) {
92         printf("%s\n", itor->second.c_str());
93     }
94     printf("\n");
95     printf("---subdir of sys vmem info---\n");
96     for (auto itor = sysVirtualMemNameMap_.begin(); itor != sysVirtualMemNameMap_.end(); itor++) {
97         printf("%s\n", itor->second.c_str());
98     }
99     printf("\n");
100 }
101 
InitBinderEventNameMap()102 inline void TraceStreamerConfig::InitBinderEventNameMap()
103 {
104     eventNameMap_.emplace(TRACE_EVENT_BINDER_TRANSACTION, TRACE_ACTION_BINDER_TRANSACTION);
105     eventNameMap_.emplace(TRACE_EVENT_BINDER_TRANSACTION_RECEIVED, TRACE_ACTION_BINDER_TRANSACTION_RECEIVED);
106     eventNameMap_.emplace(TRACE_EVENT_BINDER_TRANSACTION_ALLOC_BUF, TRACE_ACTION_BINDER_TRANSACTION_ALLOC_BUF);
107     eventNameMap_.emplace(TRACE_EVENT_BINDER_TRANSACTION_LOCK, TRACE_ACTION_BINDER_TRANSACTION_LOCK);
108     eventNameMap_.emplace(TRACE_EVENT_BINDER_TRANSACTION_LOCKED, TRACE_ACTION_BINDER_TRANSACTION_LOCKED);
109     eventNameMap_.emplace(TRACE_EVENT_BINDER_TRANSACTION_UNLOCK, TRACE_ACTION_BINDER_TRANSACTION_UNLOCK);
110 }
InitSchedEventNameMap()111 inline void TraceStreamerConfig::InitSchedEventNameMap()
112 {
113     eventNameMap_.emplace(TRACE_EVENT_SCHED_SWITCH, TRACE_ACTION_SCHED_SWITCH);
114     eventNameMap_.emplace(TRACE_EVENT_SCHED_BLOCKED_REASON, TRACE_ACTION_SCHED_BLOCKED_REASON);
115     eventNameMap_.emplace(TRACE_EVENT_SCHED_WAKEUP, TRACE_ACTION_SCHED_WAKEUP);
116     eventNameMap_.emplace(TRACE_EVENT_SCHED_WAKING, TRACE_ACTION_SCHED_WAKING);
117     eventNameMap_.emplace(TRACE_EVENT_SCHED_WAKEUP_NEW, TRACE_ACTION_SCHED_WAKEUP_NEW);
118 }
InitClkEventNameMap()119 inline void TraceStreamerConfig::InitClkEventNameMap()
120 {
121     eventNameMap_.emplace(TRACE_EVENT_CLOCK_SET_RATE, TRACE_ACTION_CLOCK_SET_RATE);
122     eventNameMap_.emplace(TRACE_EVENT_CLOCK_ENABLE, TRACE_ACTION_CLOCK_ENABLE);
123     eventNameMap_.emplace(TRACE_EVENT_CLOCK_DISABLE, TRACE_ACTION_CLOCK_DISABLE);
124     eventNameMap_.emplace(TRACE_EVENT_CLK_SET_RATE, TRACE_ACTION_CLK_SET_RATE);
125     eventNameMap_.emplace(TRACE_EVENT_CLK_ENABLE, TRACE_ACTION_CLK_ENABLE);
126     eventNameMap_.emplace(TRACE_EVENT_CLK_DISABLE, TRACE_ACTION_CLK_DISABLE);
127     eventNameMap_.emplace(TRACE_EVENT_CLOCK_SYNC, TRACE_ACTION_CLOCK_SYNC);
128 }
InitCpuEventNameMap()129 inline void TraceStreamerConfig::InitCpuEventNameMap()
130 {
131     eventNameMap_.emplace(TRACE_EVENT_CPU_IDLE, TRACE_ACTION_CPU_IDLE);
132     eventNameMap_.emplace(TRACE_EVENT_CPU_FREQUENCY, TRACE_ACTION_CPU_FREQUENCY);
133     eventNameMap_.emplace(TRACE_EVENT_CPU_FREQUENCY_LIMITS, TRACE_ACTION_CPU_FREQUENCY_LIMITS);
134     eventNameMap_.emplace(TRACE_CPU_USAGE, TRACE_ACTION_CPU_USAGE);
135 }
InitInterruptEventNameMap()136 inline void TraceStreamerConfig::InitInterruptEventNameMap()
137 {
138     eventNameMap_.emplace(TRACE_EVENT_IPI_ENTRY, TRACE_ACTION_IPI_ENTRY);
139     eventNameMap_.emplace(TRACE_EVENT_IPI_EXIT, TRACE_ACTION_IPI_EXIT);
140     eventNameMap_.emplace(TRACE_EVENT_IRQ_HANDLER_ENTRY, TRACE_ACTION_IRQ_HANDLER_ENTRY);
141     eventNameMap_.emplace(TRACE_EVENT_IRQ_HANDLER_EXIT, TRACE_ACTION_IRQ_HANDLER_EXIT);
142     eventNameMap_.emplace(TRACE_EVENT_SOFTIRQ_RAISE, TRACE_ACTION_SOFTIRQ_RAISE);
143     eventNameMap_.emplace(TRACE_EVENT_SOFTIRQ_ENTRY, TRACE_ACTION_SOFTIRQ_ENTRY);
144     eventNameMap_.emplace(TRACE_EVENT_SOFTIRQ_EXIT, TRACE_ACTION_SOFTIRQ_EXIT);
145 }
InitMemoryEventNameMap()146 inline void TraceStreamerConfig::InitMemoryEventNameMap()
147 {
148     eventNameMap_.emplace(TRACE_MEMORY, TRACE_ACTION_MEMORY);
149     eventNameMap_.emplace(TRACE_SYS_MEMORY, TRACE_ACTION_SYS_MEMORY);
150     eventNameMap_.emplace(TRACE_ASHMEM, TRACE_ACTION_ASHMEM);
151     eventNameMap_.emplace(TRACE_DMAMEM, TRACE_ACTION_DMAMEM);
152     eventNameMap_.emplace(TRACE_GPU_PROCESS_MEM, TRACE_ACTION_GPU_PROCESS_MEM);
153     eventNameMap_.emplace(TRACE_GPU_WINDOW_MEM, TRACE_ACTION_GPU_WINDOW_MEM);
154     eventNameMap_.emplace(TRACE_JS_MEMORY, TRACE_ACTION_JS_MEMORY);
155     eventNameMap_.emplace(TRACE_SYS_VIRTUAL_MEMORY, TRACE_ACTION_SYS_VIRTUAL_MEMORY);
156 }
InitBlockEventNameMap()157 inline void TraceStreamerConfig::InitBlockEventNameMap()
158 {
159     eventNameMap_.emplace(TRACE_EVENT_BLOCK_BIO_BACKMERGE, TRACE_ACTION_BLOCK_BIO_BACKMERGE);
160     eventNameMap_.emplace(TRACE_EVENT_BLOCK_BIO_BOUNCE, TRACE_ACTION_BLOCK_BIO_BOUNCE);
161     eventNameMap_.emplace(TRACE_EVENT_BLOCK_BIO_COMPLETE, TRACE_ACTION_BLOCK_BIO_COMPLETE);
162     eventNameMap_.emplace(TRACE_EVENT_BLOCK_BIO_FRONTMERGE, TRACE_ACTION_BLOCK_BIO_FRONTMERGE);
163     eventNameMap_.emplace(TRACE_EVENT_BLOCK_BIO_QUEUE, TRACE_ACTION_BLOCK_BIO_QUEUE);
164     eventNameMap_.emplace(TRACE_EVENT_BLOCK_BIO_REMAP, TRACE_ACTION_BLOCK_BIO_REMAP);
165     eventNameMap_.emplace(TRACE_EVENT_BLOCK_DIRTY_BUFFER, TRACE_ACTION_BLOCK_DIRTY_BUFFER);
166     eventNameMap_.emplace(TRACE_EVENT_BLOCK_GETRQ, TRACE_ACTION_BLOCK_GETRQ);
167     eventNameMap_.emplace(TRACE_EVENT_BLOCK_PLUG, TRACE_ACTION_BLOCK_PLUG);
168     eventNameMap_.emplace(TRACE_EVENT_BLOCK_RQ_COMPLETE, TRACE_ACTION_BLOCK_RQ_COMPLETE);
169     eventNameMap_.emplace(TRACE_EVENT_BLOCK_RQ_INSERT, TRACE_ACTION_BLOCK_RQ_INSERT);
170     eventNameMap_.emplace(TRACE_EVENT_BLOCK_RQ_REMAP, TRACE_ACTION_BLOCK_RQ_REMAP);
171     eventNameMap_.emplace(TRACE_EVENT_BLOCK_RQ_ISSUE, TRACE_ACTION_BLOCK_RQ_ISSUE);
172 }
InitRegulatorEventNameMap()173 inline void TraceStreamerConfig::InitRegulatorEventNameMap()
174 {
175     eventNameMap_.emplace(TRACE_EVENT_REGULATOR_SET_VOLTAGE, TRACE_ACTION_REGULATOR_SET_VOLTAGE);
176     eventNameMap_.emplace(TRACE_EVENT_REGULATOR_SET_VOLTAGE_COMPLETE, TRACE_ACTION_REGULATOR_SET_VOLTAGE_COMPLETE);
177     eventNameMap_.emplace(TRACE_EVENT_REGULATOR_DISABLE, TRACE_ACTION_REGULATOR_DISABLE);
178     eventNameMap_.emplace(TRACE_EVENT_REGULATOR_DISABLE_COMPLETE, TRACE_ACTION_REGULATOR_DISABLE_COMPLETE);
179 }
InitOtherEventNameMap()180 inline void TraceStreamerConfig::InitOtherEventNameMap()
181 {
182     eventNameMap_.emplace(TRACE_EVENT_FFRT, TRACE_ACTION_FFRT);
183     eventNameMap_.emplace(TRACE_EVENT_PRINT, TRACE_ACTION_PRINT);
184     eventNameMap_.emplace(TRACE_EVENT_TRACING_MARK_WRITE, TRACE_ACTION_TRACING_MARK_WRITE);
185     eventNameMap_.emplace(TRACE_EVENT_TASK_RENAME, TRACE_ACTION_TASK_RENAME);
186     eventNameMap_.emplace(TRACE_EVENT_TASK_NEWTASK, TRACE_ACTION_TASK_NEWTASK);
187     eventNameMap_.emplace(TRACE_EVENT_SUSPEND_RESUME, TRACE_ACTION_SUSPEND_RESUME);
188     eventNameMap_.emplace(TRACE_EVENT_WORKQUEUE_EXECUTE_START, TRACE_ACTION_WORKQUEUE_EXECUTE_START);
189     eventNameMap_.emplace(TRACE_EVENT_WORKQUEUE_EXECUTE_END, TRACE_ACTION_WORKQUEUE_EXECUTE_END);
190     eventNameMap_.emplace(TRACE_EVENT_SYS_ENTRY, TRACE_ACTION_SYS_ENTRY);
191     eventNameMap_.emplace(TRACE_EVENT_SYS_EXIT, TRACE_ACTION_SYS_EXIT);
192     eventNameMap_.emplace(TRACE_EVENT_OOM_SCORE_ADJ_UPDATE, TRACE_ACTION_OOM_SCORE_ADJ_UPDATE);
193     eventNameMap_.emplace(TRACE_EVENT_PROCESS_EXIT, TRACE_ACTION_PROCESS_EXIT);
194     eventNameMap_.emplace(TRACE_EVENT_PROCESS_FREE, TRACE_ACTION_PROCESS_FREE);
195     eventNameMap_.emplace(TRACE_EVENT_SIGNAL_GENERATE, TRACE_ACTION_SIGNAL_GENERATE);
196     eventNameMap_.emplace(TRACE_EVENT_SIGNAL_DELIVER, TRACE_ACTION_SIGNAL_DELIVER);
197     eventNameMap_.emplace(TRACE_EVENT_OTHER, TRACE_ACTION_OTHER);
198     eventNameMap_.emplace(TRACE_DISKIO, TRACE_ACTION_DISKIO);
199     eventNameMap_.emplace(TRACE_PROCESS, TRACE_ACTION_PROCESS);
200     eventNameMap_.emplace(TRACE_NETWORK, TRACE_ACTION_NETWORK);
201     eventNameMap_.emplace(TRACE_PERF, TRACE_ACTION_PERF);
202     eventNameMap_.emplace(TRACE_HILOG, TRACE_ACTION_HILOG);
203     eventNameMap_.emplace(TRACE_HIDUMP_FPS, TRACE_ACTION_HIDUMP_FPS);
204     eventNameMap_.emplace(TRACE_HISYSEVENT, TRACE_ACTION_HISYS_EVENT);
205     eventNameMap_.emplace(TRACE_SMAPS, TRACE_ACTION_SMAPS);
206     eventNameMap_.emplace(TRACE_WINDOW_MANAGER_SERVICE, TRACE_ACTION_WINDOW_MANAGER_SERVICE);
207     eventNameMap_.emplace(TRACE_VSYNC, TRACE_ACTION_VSYNC);
208     eventNameMap_.emplace(TRACE_ON_DO_COMPOSITION, TRACE_ACTION_ON_DO_COMPOSITION);
209     eventNameMap_.emplace(TRACE_FRAMEQUEUE, TRACE_ACTION_FRAMEQUEUE);
210 }
InitEbpfEventNameMap()211 inline void TraceStreamerConfig::InitEbpfEventNameMap()
212 {
213     eventNameMap_.emplace(TRACE_EVENT_EBPF, TRACE_ACTION_EBPF);
214     eventNameMap_.emplace(TRACE_EVENT_EBPF_FILE_SYSTEM, TRACE_ACTION_EBPF_FILE_SYSTEM);
215     eventNameMap_.emplace(TRACE_EVENT_EBPF_PAGED_MEMORY, TRACE_ACTION_EBPF_PAGED_MEMORY);
216     eventNameMap_.emplace(TRACE_EVENT_EBPF_BIO_LATENCY, TRACE_ACTION_EBPF_BIO_LATENCY);
217 }
InitHookEventNameMap()218 inline void TraceStreamerConfig::InitHookEventNameMap()
219 {
220     eventNameMap_.emplace(TRACE_NATIVE_HOOK_MALLOC, TRACE_ACTION_NATIVE_HOOK_MALLOC);
221     eventNameMap_.emplace(TRACE_NATIVE_HOOK_FREE, TRACE_ACTION_NATIVE_HOOK_FREE);
222     eventNameMap_.emplace(TRACE_NATIVE_HOOK_MMAP, TRACE_ACTION_NATIVE_HOOK_MMAP);
223     eventNameMap_.emplace(TRACE_NATIVE_HOOK_MUNMAP, TRACE_ACTION_NATIVE_HOOK_MUNMAP);
224     eventNameMap_.emplace(TRACE_NATIVE_HOOK_RECORD_STATISTICS, TRACE_ACTION_NATIVE_HOOK_RECORD_STATISTICS);
225     eventNameMap_.emplace(TRACE_NATIVE_HOOK_MEMTAG, TRACE_ACTION_NATIVE_HOOK_MEMTAG);
226 }
InitEventNameMap()227 void TraceStreamerConfig::InitEventNameMap()
228 {
229     InitBinderEventNameMap();
230     InitSchedEventNameMap();
231     InitClkEventNameMap();
232     InitCpuEventNameMap();
233     InitInterruptEventNameMap();
234     InitMemoryEventNameMap();
235     InitBlockEventNameMap();
236     InitRegulatorEventNameMap();
237     InitOtherEventNameMap();
238     InitEbpfEventNameMap();
239     InitHookEventNameMap();
240 }
241 #ifdef ENABLE_MEMORY
InitSysMemMap()242 void TraceStreamerConfig::InitSysMemMap()
243 {
244     sysMemNameMap_ = {{SysMeminfoType::PMEM_UNSPECIFIED, SYS_MEMINFO_UNSPECIFIED_DESC},
245                       {SysMeminfoType::PMEM_MEM_TOTAL, SYS_MEMINFO_MEM_TOTAL_DESC},
246                       {SysMeminfoType::PMEM_MEM_FREE, SYS_MEMINFO_MEM_FREE_DESC},
247                       {SysMeminfoType::PMEM_MEM_AVAILABLE, SYS_MEMINFO_MEM_AVAILABLE_DESC},
248                       {SysMeminfoType::PMEM_BUFFERS, SYS_MEMINFO_BUFFERS_DESC},
249                       {SysMeminfoType::PMEM_CACHED, SYS_MEMINFO_CACHED_DESC},
250                       {SysMeminfoType::PMEM_SWAP_CACHED, SYS_MEMINFO_SWAP_CACHED_DESC},
251                       {SysMeminfoType::PMEM_ACTIVE, SYS_MEMINFO_ACTIVE_DESC},
252                       {SysMeminfoType::PMEM_INACTIVE, SYS_MEMINFO_INACTIVE_DESC},
253                       {SysMeminfoType::PMEM_ACTIVE_ANON, SYS_MEMINFO_ACTIVE_ANON_DESC},
254                       {SysMeminfoType::PMEM_INACTIVE_ANON, SYS_MEMINFO_INACTIVE_ANON_DESC},
255                       {SysMeminfoType::PMEM_ACTIVE_FILE, SYS_MEMINFO_ACTIVE_FILE_DESC},
256                       {SysMeminfoType::PMEM_INACTIVE_FILE, SYS_MEMINFO_INACTIVE_FILE_DESC},
257                       {SysMeminfoType::PMEM_UNEVICTABLE, SYS_MEMINFO_UNEVICTABLE_DESC},
258                       {SysMeminfoType::PMEM_MLOCKED, SYS_MEMINFO_MLOCKED_DESC},
259                       {SysMeminfoType::PMEM_SWAP_TOTAL, SYS_MEMINFO_SWAP_TOTAL_DESC},
260                       {SysMeminfoType::PMEM_SWAP_FREE, SYS_MEMINFO_SWAP_FREE_DESC},
261                       {SysMeminfoType::PMEM_DIRTY, SYS_MEMINFO_DIRTY_DESC},
262                       {SysMeminfoType::PMEM_WRITEBACK, SYS_MEMINFO_WRITEBACK_DESC},
263                       {SysMeminfoType::PMEM_ANON_PAGES, SYS_MEMINFO_ANON_PAGES_DESC},
264                       {SysMeminfoType::PMEM_MAPPED, SYS_MEMINFO_MAPPED_DESC},
265                       {SysMeminfoType::PMEM_SHMEM, SYS_MEMINFO_SHMEM_DESC},
266                       {SysMeminfoType::PMEM_SLAB, SYS_MEMINFO_SLAB_DESC},
267                       {SysMeminfoType::PMEM_SLAB_RECLAIMABLE, SYS_MEMINFO_SLAB_RECLAIMABLE_DESC},
268                       {SysMeminfoType::PMEM_SLAB_UNRECLAIMABLE, SYS_MEMINFO_SLAB_UNRECLAIMABLE_DESC},
269                       {SysMeminfoType::PMEM_KERNEL_STACK, SYS_MEMINFO_KERNEL_STACK_DESC},
270                       {SysMeminfoType::PMEM_PAGE_TABLES, SYS_MEMINFO_PAGE_TABLES_DESC},
271                       {SysMeminfoType::PMEM_COMMIT_LIMIT, SYS_MEMINFO_COMMIT_LIMIT_DESC},
272                       {SysMeminfoType::PMEM_COMMITED_AS, SYS_MEMINFO_COMMITED_AS_DESC},
273                       {SysMeminfoType::PMEM_VMALLOC_TOTAL, SYS_MEMINFO_VMALLOC_TOTAL_DESC},
274                       {SysMeminfoType::PMEM_VMALLOC_USED, SYS_MEMINFO_VMALLOC_USED_DESC},
275                       {SysMeminfoType::PMEM_VMALLOC_CHUNK, SYS_MEMINFO_VMALLOC_CHUNK_DESC},
276                       {SysMeminfoType::PMEM_CMA_TOTAL, SYS_MEMINFO_CMA_TOTAL_DESC},
277                       {SysMeminfoType::PMEM_CMA_FREE, SYS_MEMINFO_CMA_FREE_DESC},
278                       {SysMeminfoType::PMEM_KERNEL_RECLAIMABLE, SYS_MEMINFO_KERNEL_RECLAIMABLE_DESC},
279                       {SysMeminfoType::PMEM_ACTIVE_PURG, SYS_MEMINFO_ACTIVE_PURG_DESC},
280                       {SysMeminfoType::PMEM_INACTIVE_PURG, SYS_MEMINFO_INACTIVE_PURG_DESC},
281                       {SysMeminfoType::PMEM_PINED_PURG, SYS_MEMINFO_PINED_PURG_DESC}};
282 }
InitNrZoneEventSysVmemMap()283 inline void TraceStreamerConfig::InitNrZoneEventSysVmemMap()
284 {
285     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_ZONE_ACTIVE_ANON, SYS_VMEMINFO_NR_ZONE_ACTIVE_ANON_DESC);
286     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_ZONE_ACTIVE_FILE, SYS_VMEMINFO_NR_ZONE_ACTIVE_FILE_DESC);
287     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_ZONE_INACTIVE_ANON,
288                                   SYS_VMEMINFO_NR_ZONE_INACTIVE_ANON_DESC);
289     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_ZONE_INACTIVE_FILE,
290                                   SYS_VMEMINFO_NR_ZONE_INACTIVE_FILE_DESC);
291     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_ZONE_UNEVICTABLE, SYS_VMEMINFO_NR_ZONE_UNEVICTABLE_DESC);
292     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_ZONE_WRITE_PENDING,
293                                   SYS_VMEMINFO_NR_ZONE_WRITE_PENDING_DESC);
294 }
InitNrDirtierEventSysVmemMap()295 inline void TraceStreamerConfig::InitNrDirtierEventSysVmemMap()
296 {
297     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_DIRTY, SYS_VMEMINFO_NR_DIRTY_DESC);
298     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_DIRTY_THRESHOLD, SYS_VMEMINFO_NR_DIRTY_THRESHOLD_DESC);
299     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_DIRTY_BACKGROUND_THRESHOLD,
300                                   SYS_VMEMINFO_NR_DIRTY_BACKGROUND_THRESHOLD_DESC);
301     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_DIRTIED, SYS_VMEMINFO_NR_DIRTIED_DESC);
302 }
InitNrOtherEventSysVmemMap()303 inline void TraceStreamerConfig::InitNrOtherEventSysVmemMap()
304 {
305     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_FREE_PAGES, SYS_VMEMINFO_NR_FREE_PAGES_DESC);
306     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_ALLOC_BATCH, SYS_VMEMINFO_NR_ALLOC_BATCH_DESC);
307     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_INACTIVE_ANON, SYS_VMEMINFO_NR_INACTIVE_ANON_DESC);
308     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_ACTIVE_ANON, SYS_VMEMINFO_NR_ACTIVE_ANON_DESC);
309     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_INACTIVE_FILE, SYS_VMEMINFO_NR_INACTIVE_FILE_DESC);
310     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_ACTIVE_FILE, SYS_VMEMINFO_NR_ACTIVE_FILE_DESC);
311     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_UNEVICTABLE, SYS_VMEMINFO_NR_UNEVICTABLE_DESC);
312     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_MLOCK, SYS_VMEMINFO_NR_MLOCK_DESC);
313     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_ANON_PAGES, SYS_VMEMINFO_NR_ANON_PAGES_DESC);
314     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_MAPPED, SYS_VMEMINFO_NR_MAPPED_DESC);
315     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_FILE_PAGES, SYS_VMEMINFO_NR_FILE_PAGES_DESC);
316     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_WRITEBACK, SYS_VMEMINFO_NR_WRITEBACK_DESC);
317     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_SLAB_RECLAIMABLE, SYS_VMEMINFO_NR_SLAB_RECLAIMABLE_DESC);
318     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_SLAB_UNRECLAIMABLE,
319                                   SYS_VMEMINFO_NR_SLAB_UNRECLAIMABLE_DESC);
320     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_PAGE_TABLE_PAGES, SYS_VMEMINFO_NR_PAGE_TABLE_PAGES_DESC);
321     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_KERNEL_STACK, SYS_VMEMINFO_NR_KERNEL_STACK_DESC);
322     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_OVERHEAD, SYS_VMEMINFO_NR_OVERHEAD_DESC);
323     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_UNSTABLE, SYS_VMEMINFO_NR_UNSTABLE_DESC);
324     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_BOUNCE, SYS_VMEMINFO_NR_BOUNCE_DESC);
325     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_VMSCAN_WRITE, SYS_VMEMINFO_NR_VMSCAN_WRITE_DESC);
326     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_VMSCAN_IMMEDIATE_RECLAIM,
327                                   SYS_VMEMINFO_NR_VMSCAN_IMMEDIATE_RECLAIM_DESC);
328     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_WRITEBACK_TEMP, SYS_VMEMINFO_NR_WRITEBACK_TEMP_DESC);
329     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_ISOLATED_ANON, SYS_VMEMINFO_NR_ISOLATED_ANON_DESC);
330     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_ISOLATED_FILE, SYS_VMEMINFO_NR_ISOLATED_FILE_DESC);
331     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_SHMEM, SYS_VMEMINFO_NR_SHMEM_DESC);
332     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_WRITTEN, SYS_VMEMINFO_NR_WRITTEN_DESC);
333     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_PAGES_SCANNED, SYS_VMEMINFO_NR_PAGES_SCANNED_DESC);
334     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_ANON_TRANSPARENT_HUGEPAGES,
335                                   SYS_VMEMINFO_NR_ANON_TRANSPARENT_HUGEPAGES_DESC);
336     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_FREE_CMA, SYS_VMEMINFO_NR_FREE_CMA_DESC);
337     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_SWAPCACHE, SYS_VMEMINFO_NR_SWAPCACHE_DESC);
338     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_ZSPAGES, SYS_VMEMINFO_NR_ZSPAGES_DESC);
339     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_ION_HEAP, SYS_VMEMINFO_NR_ION_HEAP_DESC);
340     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_GPU_HEAP, SYS_VMEMINFO_NR_GPU_HEAP_DESC);
341     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_FASTRPC, SYS_VMEMINFO_NR_FASTRPC_DESC);
342     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_INDIRECTLY_RECLAIMABLE,
343                                   SYS_VMEMINFO_NR_INDIRECTLY_RECLAIMABLE_DESC);
344     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_ION_HEAP_POOL, SYS_VMEMINFO_NR_ION_HEAP_POOL_DESC);
345     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_KERNEL_MISC_RECLAIMABLE,
346                                   SYS_VMEMINFO_NR_KERNEL_MISC_RECLAIMABLE_DESC);
347     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_SHADOW_CALL_STACK_BYTES,
348                                   SYS_VMEMINFO_NR_SHADOW_CALL_STACK_BYTES_DESC);
349     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_SHMEM_HUGEPAGES, SYS_VMEMINFO_NR_SHMEM_HUGEPAGES_DESC);
350     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_SHMEM_PMDMAPPED, SYS_VMEMINFO_NR_SHMEM_PMDMAPPED_DESC);
351     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_NR_UNRECLAIMABLE_PAGES,
352                                   SYS_VMEMINFO_NR_UNRECLAIMABLE_PAGES_DESC);
353 }
InitPgscanEventSysVmemMap()354 inline void TraceStreamerConfig::InitPgscanEventSysVmemMap()
355 {
356     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSCAN_KSWAPD_DMA, SYS_VMEMINFO_PGSCAN_KSWAPD_DMA_DESC);
357     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSCAN_KSWAPD_NORMAL,
358                                   SYS_VMEMINFO_PGSCAN_KSWAPD_NORMAL_DESC);
359     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSCAN_KSWAPD_MOVABLE,
360                                   SYS_VMEMINFO_PGSCAN_KSWAPD_MOVABLE_DESC);
361     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSCAN_DIRECT_DMA, SYS_VMEMINFO_PGSCAN_DIRECT_DMA_DESC);
362     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSCAN_DIRECT_NORMAL,
363                                   SYS_VMEMINFO_PGSCAN_DIRECT_NORMAL_DESC);
364     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSCAN_DIRECT_MOVABLE,
365                                   SYS_VMEMINFO_PGSCAN_DIRECT_MOVABLE_DESC);
366     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSCAN_DIRECT_THROTTLE,
367                                   SYS_VMEMINFO_PGSCAN_DIRECT_THROTTLE_DESC);
368     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSCAN_DIRECT, SYS_VMEMINFO_PGSCAN_DIRECT_DESC);
369     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSCAN_KSWAPD, SYS_VMEMINFO_PGSCAN_KSWAPD_DESC);
370 }
InitPgstealEventSysVmemMap()371 inline void TraceStreamerConfig::InitPgstealEventSysVmemMap()
372 {
373     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSTEAL_KSWAPD_DMA, SYS_VMEMINFO_PGSTEAL_KSWAPD_DMA_DESC);
374     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSTEAL_KSWAPD_NORMAL,
375                                   SYS_VMEMINFO_PGSTEAL_KSWAPD_NORMAL_DESC);
376     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSTEAL_KSWAPD_MOVABLE,
377                                   SYS_VMEMINFO_PGSTEAL_KSWAPD_MOVABLE_DESC);
378     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSTEAL_DIRECT_DMA, SYS_VMEMINFO_PGSTEAL_DIRECT_DMA_DESC);
379     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSTEAL_DIRECT_NORMAL,
380                                   SYS_VMEMINFO_PGSTEAL_DIRECT_NORMAL_DESC);
381     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSTEAL_DIRECT_MOVABLE,
382                                   SYS_VMEMINFO_PGSTEAL_DIRECT_MOVABLE_DESC);
383     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSTEAL_DIRECT, SYS_VMEMINFO_PGSTEAL_DIRECT_DESC);
384     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSTEAL_KSWAPD, SYS_VMEMINFO_PGSTEAL_KSWAPD_DESC);
385 }
InitCompactEventSysVmemMap()386 inline void TraceStreamerConfig::InitCompactEventSysVmemMap()
387 {
388     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_COMPACT_MIGRATE_SCANNED,
389                                   SYS_VMEMINFO_COMPACT_MIGRATE_SCANNED_DESC);
390     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_COMPACT_FREE_SCANNED,
391                                   SYS_VMEMINFO_COMPACT_FREE_SCANNED_DESC);
392     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_COMPACT_ISOLATED, SYS_VMEMINFO_COMPACT_ISOLATED_DESC);
393     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_COMPACT_STALL, SYS_VMEMINFO_COMPACT_STALL_DESC);
394     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_COMPACT_FAIL, SYS_VMEMINFO_COMPACT_FAIL_DESC);
395     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_COMPACT_SUCCESS, SYS_VMEMINFO_COMPACT_SUCCESS_DESC);
396     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_COMPACT_DAEMON_WAKE, SYS_VMEMINFO_COMPACT_DAEMON_WAKE_DESC);
397     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_COMPACT_DAEMON_FREE_SCANNED,
398                                   SYS_VMEMINFO_COMPACT_DAEMON_FREE_SCANNED_DESC);
399     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_COMPACT_DAEMON_MIGRATE_SCANNED,
400                                   SYS_VMEMINFO_COMPACT_DAEMON_MIGRATE_SCANNED_DESC);
401 }
InitUnevictableEventSysVmemMap()402 inline void TraceStreamerConfig::InitUnevictableEventSysVmemMap()
403 {
404     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_UNEVICTABLE_PGS_CULLED,
405                                   SYS_VMEMINFO_UNEVICTABLE_PGS_CULLED_DESC);
406     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_UNEVICTABLE_PGS_SCANNED,
407                                   SYS_VMEMINFO_UNEVICTABLE_PGS_SCANNED_DESC);
408     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_UNEVICTABLE_PGS_RESCUED,
409                                   SYS_VMEMINFO_UNEVICTABLE_PGS_RESCUED_DESC);
410     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_UNEVICTABLE_PGS_MLOCKED,
411                                   SYS_VMEMINFO_UNEVICTABLE_PGS_MLOCKED_DESC);
412     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_UNEVICTABLE_PGS_MUNLOCKED,
413                                   SYS_VMEMINFO_UNEVICTABLE_PGS_MUNLOCKED_DESC);
414     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_UNEVICTABLE_PGS_CLEARED,
415                                   SYS_VMEMINFO_UNEVICTABLE_PGS_CLEARED_DESC);
416     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_UNEVICTABLE_PGS_STRANDED,
417                                   SYS_VMEMINFO_UNEVICTABLE_PGS_STRANDED_DESC);
418 }
InitPgreFillEventSysVmemMap()419 inline void TraceStreamerConfig::InitPgreFillEventSysVmemMap()
420 {
421     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGREFILL_DMA, SYS_VMEMINFO_PGREFILL_DMA_DESC);
422     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGREFILL_NORMAL, SYS_VMEMINFO_PGREFILL_NORMAL_DESC);
423     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGREFILL_MOVABLE, SYS_VMEMINFO_PGREFILL_MOVABLE_DESC);
424     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGREFILL, SYS_VMEMINFO_PGREFILL_DESC);
425 }
InitWorkingSetEventSysVmemMap()426 inline void TraceStreamerConfig::InitWorkingSetEventSysVmemMap()
427 {
428     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_WORKINGSET_REFAULT, SYS_VMEMINFO_WORKINGSET_REFAULT_DESC);
429     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_WORKINGSET_ACTIVATE, SYS_VMEMINFO_WORKINGSET_ACTIVATE_DESC);
430     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_WORKINGSET_NODERECLAIM,
431                                   SYS_VMEMINFO_WORKINGSET_NODERECLAIM_DESC);
432     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_WORKINGSET_RESTORE, SYS_VMEMINFO_WORKINGSET_RESTORE_DESC);
433 }
InitPgEventSysVmemMap()434 inline void TraceStreamerConfig::InitPgEventSysVmemMap()
435 {
436     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGPGIN, SYS_VMEMINFO_PGPGIN_DESC);
437     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGPGOUT, SYS_VMEMINFO_PGPGOUT_DESC);
438     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGPGOUTCLEAN, SYS_VMEMINFO_PGPGOUTCLEAN_DESC);
439     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGALLOC_DMA, SYS_VMEMINFO_PGALLOC_DMA_DESC);
440     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGALLOC_NORMAL, SYS_VMEMINFO_PGALLOC_NORMAL_DESC);
441     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGALLOC_MOVABLE, SYS_VMEMINFO_PGALLOC_MOVABLE_DESC);
442     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGFREE, SYS_VMEMINFO_PGFREE_DESC);
443     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGACTIVATE, SYS_VMEMINFO_PGACTIVATE_DESC);
444     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGDEACTIVATE, SYS_VMEMINFO_PGDEACTIVATE_DESC);
445     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGFAULT, SYS_VMEMINFO_PGFAULT_DESC);
446     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGMAJFAULT, SYS_VMEMINFO_PGMAJFAULT_DESC);
447     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGROTATED, SYS_VMEMINFO_PGROTATED_DESC);
448     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGMIGRATE_SUCCESS, SYS_VMEMINFO_PGMIGRATE_SUCCESS_DESC);
449     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGMIGRATE_FAIL, SYS_VMEMINFO_PGMIGRATE_FAIL_DESC);
450     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGINODESTEAL, SYS_VMEMINFO_PGINODESTEAL_DESC);
451     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGLAZYFREE, SYS_VMEMINFO_PGLAZYFREE_DESC);
452     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGLAZYFREED, SYS_VMEMINFO_PGLAZYFREED_DESC);
453     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSKIP_DMA, SYS_VMEMINFO_PGSKIP_DMA_DESC);
454     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSKIP_MOVABLE, SYS_VMEMINFO_PGSKIP_MOVABLE_DESC);
455     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PGSKIP_NORMAL, SYS_VMEMINFO_PGSKIP_NORMAL_DESC);
456 }
InitOtherEventSysVmemMap()457 inline void TraceStreamerConfig::InitOtherEventSysVmemMap()
458 {
459     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_UNSPECIFIED, SYS_VMEMINFO_UNSPECIFIED_DESC);
460     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PSWPIN, SYS_VMEMINFO_PSWPIN_DESC);
461     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PSWPOUT, SYS_VMEMINFO_PSWPOUT_DESC);
462     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_SLABS_SCANNED, SYS_VMEMINFO_SLABS_SCANNED_DESC);
463     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_KSWAPD_INODESTEAL, SYS_VMEMINFO_KSWAPD_INODESTEAL_DESC);
464     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_KSWAPD_LOW_WMARK_HIT_QUICKLY,
465                                   SYS_VMEMINFO_KSWAPD_LOW_WMARK_HIT_QUICKLY_DESC);
466     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_KSWAPD_HIGH_WMARK_HIT_QUICKLY,
467                                   SYS_VMEMINFO_KSWAPD_HIGH_WMARK_HIT_QUICKLY_DESC);
468     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_PAGEOUTRUN, SYS_VMEMINFO_PAGEOUTRUN_DESC);
469     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_ALLOCSTALL, SYS_VMEMINFO_ALLOCSTALL_DESC);
470     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_DROP_PAGECACHE, SYS_VMEMINFO_DROP_PAGECACHE_DESC);
471     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_DROP_SLAB, SYS_VMEMINFO_DROP_SLAB_DESC);
472     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_ALLOCSTALL_DMA, SYS_VMEMINFO_ALLOCSTALL_DMA_DESC);
473     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_ALLOCSTALL_MOVABLE, SYS_VMEMINFO_ALLOCSTALL_MOVABLE_DESC);
474     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_ALLOCSTALL_NORMAL, SYS_VMEMINFO_ALLOCSTALL_NORMAL_DESC);
475     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_OOM_KILL, SYS_VMEMINFO_OOM_KILL_DESC);
476     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_SWAP_RA, SYS_VMEMINFO_SWAP_RA_DESC);
477     sysVirtualMemNameMap_.emplace(SysVMeminfoType::VMEMINFO_SWAP_RA_HIT, SYS_VMEMINFO_SWAP_RA_HIT_DESC);
478 }
InitSysVmemMap()479 void TraceStreamerConfig::InitSysVmemMap()
480 {
481     InitNrZoneEventSysVmemMap();
482     InitNrDirtierEventSysVmemMap();
483     InitNrOtherEventSysVmemMap();
484     InitPgscanEventSysVmemMap();
485     InitPgstealEventSysVmemMap();
486     InitCompactEventSysVmemMap();
487     InitUnevictableEventSysVmemMap();
488     InitPgreFillEventSysVmemMap();
489     InitWorkingSetEventSysVmemMap();
490     InitPgEventSysVmemMap();
491     InitOtherEventSysVmemMap();
492 }
493 #endif
InitBinderEventSecurityMap()494 inline void TraceStreamerConfig::InitBinderEventSecurityMap()
495 {
496     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BINDER_TRANSACTION, statSeverityDescMap_);
497     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BINDER_TRANSACTION_RECEIVED, statSeverityDescMap_);
498     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BINDER_TRANSACTION_ALLOC_BUF, statSeverityDescMap_);
499     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BINDER_TRANSACTION_LOCK, statSeverityDescMap_);
500     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BINDER_TRANSACTION_LOCKED, statSeverityDescMap_);
501     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BINDER_TRANSACTION_UNLOCK, statSeverityDescMap_);
502 }
InitSchedEventSecurityMap()503 inline void TraceStreamerConfig::InitSchedEventSecurityMap()
504 {
505     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_SCHED_SWITCH, statSeverityDescMap_);
506     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_SCHED_BLOCKED_REASON, statSeverityDescMap_);
507     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_SCHED_WAKEUP, statSeverityDescMap_);
508     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_SCHED_WAKING, statSeverityDescMap_);
509     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_SCHED_WAKEUP_NEW, statSeverityDescMap_);
510 }
InitClkEventSecurityMap()511 inline void TraceStreamerConfig::InitClkEventSecurityMap()
512 {
513     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_CLOCK_SET_RATE, statSeverityDescMap_);
514     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_CLOCK_ENABLE, statSeverityDescMap_);
515     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_CLOCK_DISABLE, statSeverityDescMap_);
516     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_CLK_SET_RATE, statSeverityDescMap_);
517     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_CLK_ENABLE, statSeverityDescMap_);
518     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_CLK_DISABLE, statSeverityDescMap_);
519     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_CLOCK_SYNC, statSeverityDescMap_);
520 }
InitCpuEventSecurityMap()521 inline void TraceStreamerConfig::InitCpuEventSecurityMap()
522 {
523     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_CPU_IDLE, statSeverityDescMap_);
524     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_CPU_FREQUENCY, statSeverityDescMap_);
525     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_CPU_FREQUENCY_LIMITS, statSeverityDescMap_);
526     eventParserStatSeverityDescMap_.emplace(TRACE_CPU_USAGE, statSeverityDescMap_);
527 }
InitInterruptEventSecurityMap()528 inline void TraceStreamerConfig::InitInterruptEventSecurityMap()
529 {
530     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_IPI_ENTRY, statSeverityDescMap_);
531     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_IPI_EXIT, statSeverityDescMap_);
532     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_IRQ_HANDLER_ENTRY, statSeverityDescMap_);
533     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_IRQ_HANDLER_EXIT, statSeverityDescMap_);
534     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_SOFTIRQ_RAISE, statSeverityDescMap_);
535     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_SOFTIRQ_ENTRY, statSeverityDescMap_);
536     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_SOFTIRQ_EXIT, statSeverityDescMap_);
537 }
InitMemoryEventSecurityMap()538 inline void TraceStreamerConfig::InitMemoryEventSecurityMap()
539 {
540     eventParserStatSeverityDescMap_.emplace(TRACE_MEMORY, statSeverityDescMap_);
541     eventParserStatSeverityDescMap_.emplace(TRACE_SYS_MEMORY, statSeverityDescMap_);
542     eventParserStatSeverityDescMap_.emplace(TRACE_ASHMEM, statSeverityDescMap_);
543     eventParserStatSeverityDescMap_.emplace(TRACE_DMAMEM, statSeverityDescMap_);
544     eventParserStatSeverityDescMap_.emplace(TRACE_GPU_PROCESS_MEM, statSeverityDescMap_);
545     eventParserStatSeverityDescMap_.emplace(TRACE_GPU_WINDOW_MEM, statSeverityDescMap_);
546     eventParserStatSeverityDescMap_.emplace(TRACE_JS_MEMORY, statSeverityDescMap_);
547     eventParserStatSeverityDescMap_.emplace(TRACE_SYS_VIRTUAL_MEMORY, statSeverityDescMap_);
548 }
InitBlockEventSecurityMap()549 inline void TraceStreamerConfig::InitBlockEventSecurityMap()
550 {
551     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BLOCK_BIO_BACKMERGE, statSeverityDescMap_);
552     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BLOCK_BIO_BOUNCE, statSeverityDescMap_);
553     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BLOCK_BIO_COMPLETE, statSeverityDescMap_);
554     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BLOCK_BIO_FRONTMERGE, statSeverityDescMap_);
555     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BLOCK_BIO_QUEUE, statSeverityDescMap_);
556     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BLOCK_BIO_REMAP, statSeverityDescMap_);
557     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BLOCK_DIRTY_BUFFER, statSeverityDescMap_);
558     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BLOCK_GETRQ, statSeverityDescMap_);
559     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BLOCK_PLUG, statSeverityDescMap_);
560     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BLOCK_RQ_COMPLETE, statSeverityDescMap_);
561     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BLOCK_RQ_INSERT, statSeverityDescMap_);
562     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BLOCK_RQ_REMAP, statSeverityDescMap_);
563     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_BLOCK_RQ_ISSUE, statSeverityDescMap_);
564 }
InitRegulatorEventSecurityMap()565 inline void TraceStreamerConfig::InitRegulatorEventSecurityMap()
566 {
567     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_REGULATOR_SET_VOLTAGE, statSeverityDescMap_);
568     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_REGULATOR_SET_VOLTAGE_COMPLETE, statSeverityDescMap_);
569     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_REGULATOR_DISABLE, statSeverityDescMap_);
570     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_REGULATOR_DISABLE_COMPLETE, statSeverityDescMap_);
571 }
InitOtherEventSecurityMap()572 inline void TraceStreamerConfig::InitOtherEventSecurityMap()
573 {
574     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_FFRT, statSeverityDescMap_);
575     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_PRINT, statSeverityDescMap_);
576     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_TRACING_MARK_WRITE, statSeverityDescMap_);
577     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_TASK_RENAME, statSeverityDescMap_);
578     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_TASK_NEWTASK, statSeverityDescMap_);
579     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_SUSPEND_RESUME, statSeverityDescMap_);
580     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_WORKQUEUE_EXECUTE_START, statSeverityDescMap_);
581     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_WORKQUEUE_EXECUTE_END, statSeverityDescMap_);
582     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_SYS_ENTRY, statSeverityDescMap_);
583     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_SYS_EXIT, statSeverityDescMap_);
584     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_OOM_SCORE_ADJ_UPDATE, statSeverityDescMap_);
585     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_PROCESS_EXIT, statSeverityDescMap_);
586     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_PROCESS_FREE, statSeverityDescMap_);
587     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_SIGNAL_GENERATE, statSeverityDescMap_);
588     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_SIGNAL_DELIVER, statSeverityDescMap_);
589     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_OTHER, statSeverityDescMap_);
590     eventParserStatSeverityDescMap_.emplace(TRACE_DISKIO, statSeverityDescMap_);
591     eventParserStatSeverityDescMap_.emplace(TRACE_PROCESS, statSeverityDescMap_);
592     eventParserStatSeverityDescMap_.emplace(TRACE_NETWORK, statSeverityDescMap_);
593     eventParserStatSeverityDescMap_.emplace(TRACE_PERF, statSeverityDescMap_);
594     eventParserStatSeverityDescMap_.emplace(TRACE_HILOG, statSeverityDescMap_);
595     eventParserStatSeverityDescMap_.emplace(TRACE_HIDUMP_FPS, statSeverityDescMap_);
596     eventParserStatSeverityDescMap_.emplace(TRACE_HISYSEVENT, statSeverityDescMap_);
597     eventParserStatSeverityDescMap_.emplace(TRACE_SMAPS, statSeverityDescMap_);
598     eventParserStatSeverityDescMap_.emplace(TRACE_WINDOW_MANAGER_SERVICE, statSeverityDescMap_);
599     eventParserStatSeverityDescMap_.emplace(TRACE_VSYNC, statSeverityDescMap_);
600     eventParserStatSeverityDescMap_.emplace(TRACE_ON_DO_COMPOSITION, statSeverityDescMap_);
601     eventParserStatSeverityDescMap_.emplace(TRACE_FRAMEQUEUE, statSeverityDescMap_);
602 }
InitEbpfEventSecurityMap()603 inline void TraceStreamerConfig::InitEbpfEventSecurityMap()
604 {
605     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_EBPF, statSeverityDescMap_);
606     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_EBPF_FILE_SYSTEM, statSeverityDescMap_);
607     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_EBPF_PAGED_MEMORY, statSeverityDescMap_);
608     eventParserStatSeverityDescMap_.emplace(TRACE_EVENT_EBPF_BIO_LATENCY, statSeverityDescMap_);
609 }
InitHookEventSecurityMap()610 inline void TraceStreamerConfig::InitHookEventSecurityMap()
611 {
612     eventParserStatSeverityDescMap_.emplace(TRACE_NATIVE_HOOK_MALLOC, statSeverityDescMap_);
613     eventParserStatSeverityDescMap_.emplace(TRACE_NATIVE_HOOK_FREE, statSeverityDescMap_);
614     eventParserStatSeverityDescMap_.emplace(TRACE_NATIVE_HOOK_MMAP, statSeverityDescMap_);
615     eventParserStatSeverityDescMap_.emplace(TRACE_NATIVE_HOOK_MUNMAP, statSeverityDescMap_);
616     eventParserStatSeverityDescMap_.emplace(TRACE_NATIVE_HOOK_RECORD_STATISTICS, statSeverityDescMap_);
617     eventParserStatSeverityDescMap_.emplace(TRACE_NATIVE_HOOK_MEMTAG, statSeverityDescMap_);
618 }
InitSecurityMap()619 void TraceStreamerConfig::InitSecurityMap()
620 {
621     statSeverityDescMap_ = {
622         {STAT_EVENT_RECEIVED, STAT_SEVERITY_LEVEL_INFO},      {STAT_EVENT_DATA_LOST, STAT_SEVERITY_LEVEL_ERROR},
623         {STAT_EVENT_NOTMATCH, STAT_SEVERITY_LEVEL_INFO},      {STAT_EVENT_NOTSUPPORTED, STAT_SEVERITY_LEVEL_WARN},
624         {STAT_EVENT_DATA_INVALID, STAT_SEVERITY_LEVEL_ERROR},
625     };
626     InitBinderEventSecurityMap();
627     InitSchedEventSecurityMap();
628     InitClkEventSecurityMap();
629     InitCpuEventSecurityMap();
630     InitInterruptEventSecurityMap();
631     InitMemoryEventSecurityMap();
632     InitBlockEventSecurityMap();
633     InitRegulatorEventSecurityMap();
634     InitOtherEventSecurityMap();
635     InitEbpfEventSecurityMap();
636     InitHookEventSecurityMap();
637 }
638 } // namespace TraceCfg
639 } // namespace SysTuning
640