1/* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 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 16import { CompareStruct } from '../component/trace/sheet/SheetUtils.js'; 17 18export class SystemCpuSummary { 19 startTime: number = -1; 20 startTimeStr: string = ''; 21 duration: number = -1; 22 durationStr: string = ''; 23 totalLoad: number = -1; 24 totalLoadStr: string = ''; 25 userLoad: number = -1; 26 userLoadStr: string = ''; 27 systemLoad: number = -1; 28 systemLoadStr: string = ''; 29 threads: number = -1; 30 threadsStr: string = ''; 31} 32 33export class SystemDiskIOSummary { 34 startTime: number = -1; 35 startTimeStr: string = ''; 36 duration: number = -1; 37 durationStr: string = ''; 38 dataRead: number = -1; 39 dataReadStr: string = ''; 40 dataReadSec: number = -1; 41 dataReadSecStr: string = ''; 42 dataWrite: number = -1; 43 dataWriteStr: string = ''; 44 dataWriteSec: number = -1; 45 dataWriteSecStr: string = ''; 46 readsIn: number = -1; 47 readsInStr: string = ''; 48 readsInSec: number = -1; 49 readsInSecStr: string = ''; 50 writeOut: number = -1; 51 writeOutStr: string = ''; 52 writeOutSec: number = -1; 53 writeOutSecStr: string = ''; 54} 55 56export class ProcessHistory { 57 processId: number = -1; 58 alive: string = ''; // 0 alive and 1 dead 59 firstSeen: string = ''; 60 firstSeenNumber: number = -1; 61 lastSeen: string = ''; 62 lastSeenNumber: number = -1; 63 processName: string = ''; 64 responsibleProcess: string = ''; 65 userName: string = ''; 66 cpuTime: string = ''; 67 cpuTimeNumber: number = -1; 68 pss: number = -1; 69} 70 71export class LiveProcess { 72 processId: number = -1; 73 processName: string = ''; 74 responsibleProcess: string = ''; 75 userName: string = ''; 76 cpu: string = ''; 77 threads: number = -1; 78 memory: string = ''; 79 memoryNumber: number = -1; 80 diskWrite: number = -1; 81 diskReads: number = -1; 82 cpuTime: string = ''; 83 cpuTimeNumber: number = -1; 84} 85 86export class SystemNetworkSummary { 87 startTime: number = -1; 88 startTimeStr: string = ''; 89 duration: number = -1; 90 durationStr: string = ''; 91 dataReceived: number = -1; 92 dataReceivedStr: string = ''; 93 dataReceivedSec: number = -1; 94 dataReceivedSecStr: string = ''; 95 dataSend: number = -1; 96 dataSendStr: string = ''; 97 dataSendSec: number = -1; 98 dataSendSecStr: string = ''; 99 packetsIn: number = -1; 100 packetsInStr: string = ''; 101 packetsInSec: number = -1; 102 packetsInSecStr: string = ''; 103 packetsOut: number = -1; 104 packetsOutStr: string = ''; 105 packetsOutSec: number = -1; 106 packetsOutSecStr: string = ''; 107} 108 109export class SystemMemorySummary { 110 startTimeStr: string = '0'; 111 durationStr: string = '0'; 112 durationNumber: number = -1; 113 memoryTotal: string = '0'; 114 memFree: string = '0'; 115 buffers: string = '0'; 116 cached: string = '0'; 117 shmem: string = '0'; 118 slab: string = '0'; 119 swapTotal: string = '0'; 120 swapFree: string = '0'; 121 mapped: string = '0'; 122 vmallocUsed: string = '0'; 123 pageTables: string = '0'; 124 kernelStack: string = '0'; 125 active: string = '0'; 126 inactive: string = '0'; 127 unevictable: string = '0'; 128 vmallocTotal: string = '0'; 129 sUnreclaim: string = '0'; 130 kReclaimable: string = '0'; 131 cmaTotal: string = '0'; 132 cmaFree: string = '0'; 133 zram: string = '0'; 134} 135 136export class Dma { 137 processId: number = -1; 138 timeStamp: string = ''; 139 startNs: number = -1; 140 expTaskComm: string | number = ''; 141 avgSize: number = 0; 142 minSize: number = -1; 143 maxSize: number = -1; 144 bufName: string | number = ''; 145 expName: string | number = ''; 146 size: number = -1; 147 processName: string = ''; 148 process: string = ''; //processName + processId 149 fd: number = -1; 150 ino: number = -1; 151 expPid: number = -1; 152 flag: number = -1; 153 avgSizes: string = ''; 154 minSizes: string = ''; 155 maxSizes: string = ''; 156 sizes: string = ''; 157 sumSize: number = -1; 158 sumSizes: string = ''; 159} 160 161export class GpuMemory { 162 processId: number = -1; 163 threadId: number = -1; 164 timeStamp: string = ''; 165 expTaskComm: string = ''; 166 startNs: number = -1; 167 avgSize: number = -1; 168 minSize: number = -1; 169 maxSize: number = -1; 170 gpuName: string = ''; 171 gpuNameId: number = -1; 172 processName: string = ''; 173 process: string = ''; //processName + processId 174 threadName: string = ''; 175 thread: string = ''; //threadName + threadI 176 size: number = -1; 177 avgSizes: string = ''; 178 minSizes: string = ''; 179 maxSizes: string = ''; 180 sizes: string = ''; 181 sumSize: number = -1; 182 sumSizes: string = ''; 183} 184 185export class DmaComparison extends CompareStruct { 186 processId: number = -1; 187 processName: string = ''; 188 process: string = ''; //processName + processId 189 sizes: string = ''; 190 thread: string = ''; 191 192 constructor(process: string, value: number) { 193 super(process, value); 194 this.process = process; 195 } 196 197 clone(isBase?: boolean): DmaComparison { 198 const value = isBase ? this.value : -this.value; 199 return new DmaComparison(this.process, value); 200 } 201} 202 203export class GpuMemoryComparison extends CompareStruct { 204 processId: number = -1; 205 processName: string = ''; 206 process: string = ''; //processName + processId 207 sizes: string = ''; 208 gpuNameId: number = -1; 209 gpuName: string = ''; 210 threadName: string = ''; 211 threadId: number = -1; 212 thread: string = ''; 213 214 constructor(process: string, thread: string, gpuName: string, value: number) { 215 super(process + '' + thread + '' + gpuName, value); 216 this.process = process; 217 this.gpuName = gpuName; 218 this.thread = thread; 219 } 220 221 clone(isBase?: boolean): GpuMemoryComparison { 222 const value = isBase ? this.value : -this.value; 223 return new GpuMemoryComparison(this.process, this.thread, this.gpuName, value); 224 } 225} 226