• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (c) 2021 Huawei Device Co., Ltd.
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6//     http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13import { hiPerfCallChartClearCache } from '../hiperf/HiperfCallChartReceiver';
14import { nativeMemoryCacheClear } from '../NativeMemoryDataReceiver';
15import { resetVmTracker } from '../VmTrackerDataReceiver';
16import { resetVM } from '../VirtualMemoryDataReceiver';
17import { resetAbilityMonitor } from '../AbilityMonitorReceiver';
18import { resetAbility } from '../VmTrackerDataReceiver';
19import { resetDynamicEffect } from '../FrameDynamicEffectReceiver';
20import { resetEnergyEvent } from '../EnergySysEventReceiver';
21import { HangSQLStruct } from '../HangDataReceiver';
22// thread_state 表缓存
23export const sliceList: Map<number, Array<unknown>> = new Map();
24//cpu 泳道 memory 缓存
25export const cpuList: Map<number, Array<unknown>> = new Map();
26//clock 泳道 memory 模式缓存
27export const clockList: Map<string, Array<unknown>> = new Map();
28//hang 泳道 memory 模式缓存
29export const hangList: Map<string, Array<HangSQLStruct>> = new Map();
30//cpu freq 泳道 memory模式缓存
31export const cpuFreqList: Map<number, Array<unknown>> = new Map();
32//cpu freq limit 泳道 memory模式缓存
33export const cpuFreqLimitList: Map<number, Array<unknown>> = new Map();
34//cpu state 泳道 memory模式缓存
35export const cpuStateList: Map<number, Array<unknown>> = new Map();
36//thread call stack 泳道图 memory 模式缓存
37export const threadCallStackList: Map<string, Array<unknown>> = new Map();
38//irq 泳道图 memory 模式缓存
39export const lrqList: Map<string, Array<unknown>> = new Map();
40//Lost Frame 泳道图 memory 模式缓存
41export const lostFrameList: Map<number, Array<unknown>> = new Map();
42//Hitch Time 泳道图 memory 模式缓存
43export const hitchTimeList: Map<number, Array<unknown>> = new Map();
44//进程 泳道图 memory 模式缓存
45export const processList: Map<number, Array<unknown>> = new Map();
46//进程内存 泳道图 memory 模式缓存数据
47export const memList: Map<number, Array<unknown>> = new Map();
48//线程状态 泳道图 memory 模式缓存
49export const threadStateList: Map<string, Array<unknown>> = new Map();
50//线程系统调用 泳道图 memory数据缓存
51export const threadSysCallList: Map<number, Array<unknown>> = new Map();
52//进程下卡顿丢帧 泳道图 memory 模式缓存
53export const processFrameList: Map<string, Array<unknown>> = new Map();
54//hiSysEvent 泳道图 memory 模式缓存
55export const hiSysEventList: Map<string, Array<unknown>> = new Map();
56//hiLog 泳道图 memory 模式缓存
57export const hiLogList: Map<string, Array<unknown>> = new Map();
58
59//energy 泳道图 memory 模式缓存
60export const energyList: Map<string, Array<unknown>> = new Map();
61//dma_fence 泳道图 memory 模式缓存
62export const dmaFenceList: Map<string, Array<unknown>> = new Map();
63//xpower 泳道 memory 模式缓存
64export const xpowerList: Map<string, Array<unknown>> = new Map();
65//xpowerStastic 泳道 memory 模式缓存
66export const xpowerStasticList: Map<string, Array<unknown>> = new Map();
67//xpowerWifiList 泳道 memory 模式缓存
68export const xpowerWifiList: Map<string, Array<unknown>> = new Map();
69//xpowerAppDetailList 泳道 memory 模式缓存
70export const xpowerAppDetailList: Map<string, Array<unknown>> = new Map();
71export function clearMemoryCache(data: unknown, proc: Function): void {
72  sliceList.clear();
73  cpuList.clear();
74  clockList.clear();
75  cpuFreqList.clear();
76  cpuFreqLimitList.clear();
77  cpuStateList.clear();
78  threadCallStackList.clear();
79  lrqList.clear();
80  processList.clear();
81  memList.clear();
82  threadStateList.clear();
83  threadSysCallList.clear();
84  processFrameList.clear();
85  lostFrameList.clear();
86  hitchTimeList.clear();
87  hiSysEventList.clear();
88  hiLogList.clear();
89  energyList.clear();
90  xpowerList.clear();
91  xpowerStasticList.clear();
92  xpowerWifiList.clear();
93  xpowerAppDetailList.clear();
94  hiPerfCallChartClearCache(true);
95  nativeMemoryCacheClear();
96  resetVmTracker();
97  resetAbilityMonitor();
98  resetAbility();
99  resetVM();
100  resetDynamicEffect();
101  resetEnergyEvent();
102  (self as unknown as Worker).postMessage(
103    {
104      //@ts-ignore
105      id: data.id, //@ts-ignore
106      action: data.action,
107      results: 'ok',
108      len: 0,
109      transfer: [],
110    },
111    []
112  );
113}
114