• 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 processFrameList: Map<string, Array<unknown>> = new Map();
52//hiSysEvent 泳道图 memory 模式缓存
53export const hiSysEventList: Map<string, Array<unknown>> = new Map();
54//hiLog 泳道图 memory 模式缓存
55export const hiLogList: Map<string, Array<unknown>> = new Map();
56
57//energy 泳道图 memory 模式缓存
58export const energyList: Map<string, Array<unknown>> = new Map();
59//dma_fence 泳道图 memory 模式缓存
60export const dmaFenceList: Map<string, Array<unknown>> = new Map();
61export function clearMemoryCache(data: unknown, proc: Function): void {
62  sliceList.clear();
63  cpuList.clear();
64  clockList.clear();
65  cpuFreqList.clear();
66  cpuFreqLimitList.clear();
67  cpuStateList.clear();
68  threadCallStackList.clear();
69  lrqList.clear();
70  processList.clear();
71  memList.clear();
72  threadStateList.clear();
73  processFrameList.clear();
74  lostFrameList.clear();
75  hitchTimeList.clear();
76  hiSysEventList.clear();
77  hiLogList.clear();
78  energyList.clear();
79  hiPerfCallChartClearCache(true);
80  nativeMemoryCacheClear();
81  resetVmTracker();
82  resetAbilityMonitor();
83  resetAbility();
84  resetVM();
85  resetDynamicEffect();
86  resetEnergyEvent();
87  (self as unknown as Worker).postMessage(
88    {
89      //@ts-ignore
90      id: data.id, //@ts-ignore
91      action: data.action,
92      results: 'ok',
93      len: 0,
94      transfer: [],
95    },
96    []
97  );
98}
99