• 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';
19//cpu 泳道 memory 缓存
20export const cpuList: Map<number, Array<any>> = new Map();
21//clock 泳道 memory 模式缓存
22export const clockList: Map<string, Array<any>> = new Map();
23//cpu freq 泳道 memory模式缓存
24export const cpuFreqList: Map<number, Array<any>> = new Map();
25//cpu freq limit 泳道 memory模式缓存
26export const cpuFreqLimitList: Map<number, Array<any>> = new Map();
27//cpu state 泳道 memory模式缓存
28export const cpuStateList: Map<number, Array<any>> = new Map();
29//thread call stack 泳道图 memory 模式缓存
30export const threadCallStackList: Map<string, Array<any>> = new Map();
31//irq 泳道图 memory 模式缓存
32export const lrqList: Map<string, Array<any>> = new Map();
33//进程 泳道图 memory 模式缓存
34export const processList: Map<number, Array<any>> = new Map();
35//进程内存 泳道图 memory 模式缓存数据
36export const memList: Map<number, Array<any>> = new Map();
37//线程状态 泳道图 memory 模式缓存
38export const threadStateList: Map<string, Array<any>> = new Map();
39//进程下卡顿丢帧 泳道图 memory 模式缓存
40export const processFrameList: Map<string, Array<any>> = new Map();
41export function clearMemoryCache(data: any, proc: Function) {
42  cpuList.clear();
43  clockList.clear();
44  cpuFreqList.clear();
45  cpuFreqLimitList.clear();
46  cpuStateList.clear();
47  threadCallStackList.clear();
48  lrqList.clear();
49  processList.clear();
50  memList.clear();
51  threadStateList.clear();
52  processFrameList.clear();
53  hiPerfCallChartClearCache(true);
54  nativeMemoryCacheClear();
55  resetVmTracker();
56  resetAbilityMonitor();
57  resetAbility();
58  resetVM();
59  (self as unknown as Worker).postMessage(
60    {
61      id: data.id,
62      action: data.action,
63      results: 'ok',
64      len: 0,
65      transfer: [],
66    },
67    []
68  );
69}
70