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 { 17 ThreadInitConfig, 18 SchedSwitchCountBean, 19 TreeSwitchConfig, 20 HistogramSourceConfig, 21 CutDataObjConfig, 22} from '../../../src/trace/bean/SchedSwitchStruct'; 23describe('PerfStruct', () => { 24 it('PerfStructTest01', () => { 25 let threadInitConfig = new ThreadInitConfig(); 26 let struct = { 27 endTs: 0, 28 pid: -1, 29 state: '', 30 tid: -1, 31 ts: -1, 32 dur: -1, 33 duration: -1, 34 cycleStartTime: -1, 35 cycleEndTime: -1, 36 }; 37 expect(threadInitConfig).toEqual(struct); 38 }); 39 it('PerfStructTest02', () => { 40 let schedSwitchCountBean = new SchedSwitchCountBean('', 0, '', '', 2, 3, '', 4, '', 5, []); 41 let struct = { 42 children: [], 43 colorIndex: 5, 44 cycle: 3, 45 cycleStartTime: '', 46 dur: '', 47 duration: 2, 48 level: '', 49 nodeFlag: '', 50 startNS: 0, 51 title: '', 52 value: 4, 53 }; 54 55 expect(schedSwitchCountBean).toEqual(struct); 56 }); 57 it('PerfStructTest03', () => { 58 let treeSwitchConfig = new TreeSwitchConfig(); 59 let struct = { 60 children: [], 61 cycle: 0, 62 isHover: false, 63 isSelected: false, 64 level: '', 65 pid: -1, 66 status: false, 67 tid: -1, 68 title: '', 69 value: 0, 70 }; 71 expect(treeSwitchConfig).toEqual(struct); 72 }); 73 it('PerfStructTest04', () => { 74 let histogramSourceConfig = new HistogramSourceConfig(); 75 let struct = { 76 average: 0, 77 color: '', 78 cycleNum: 0, 79 isHover: false, 80 size: '', 81 value: 0, 82 }; 83 expect(histogramSourceConfig).toEqual(struct); 84 }); 85 it('PerfStructTest05', () => { 86 let cutDataObjConfig = new CutDataObjConfig(); 87 let struct = { 88 cyclesArr: [], 89 pid: -1, 90 processTitle: '', 91 threadCountTotal: 0, 92 threadTitle: '', 93 tid: -1, 94 }; 95 expect(cutDataObjConfig).toEqual(struct); 96 }); 97}); 98