• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 { BaseElement, element } from '../../../../../base-ui/BaseElement';
17import { LitTable } from '../../../../../base-ui/table/lit-table';
18import { LitChartPie } from '../../../../../base-ui/chart/pie/LitChartPie';
19import { SelectionParam } from '../../../../bean/BoxSelection';
20import '../../../../../base-ui/chart/pie/LitChartPie';
21import { LitProgressBar } from '../../../../../base-ui/progress-bar/LitProgressBar';
22import { Utils } from '../../base/Utils';
23import { procedurePool } from '../../../../database/Procedure';
24import { LitCheckBox } from '../../../../../base-ui/checkbox/LitCheckBox';
25import { TabPaneFilter } from '../TabPaneFilter';
26import { initSort } from '../SheetUtils';
27import { TabpaneFilesystemCalltree } from './TabPaneFileSystemCalltree';
28import { NUM_5, NUM_MILLON } from '../../../../bean/NumBean';
29import { TabPaneFilesystemStatisticsAnalysisHtml } from './TabPaneFilesystemStatisticsAnalysis.html';
30
31@element('tabpane-file-statistics-analysis')
32export class TabPaneFilesystemStatisticsAnalysis extends BaseElement {
33  private fsPieChart: LitChartPie | null | undefined;
34  private fsCurrentSelection: SelectionParam | null | undefined;
35  private fileStatisticsAnalysisProcessData: unknown;
36  private fileStatisticsAnalysisThreadData!: unknown[];
37  private fileStatisticsAnalysisSoData!: unknown[];
38  private fileStatisticsAnalysisPidData!: unknown[];
39  private fileStatisticsAnalysisTypeData!: unknown[];
40  private fileStatisticsAnalysisFunctionData!: unknown[];
41  private fileStatisticsAnalysisTableProcess: LitTable | null | undefined;
42  private fileStatisticsAnalysisTableType: LitTable | null | undefined;
43  private fileStatisticsAnalysisTableThread: LitTable | null | undefined;
44  private fileStatisticsAnalysisTableSo: LitTable | null | undefined;
45  private fileStatisticsAnalysisTableFunction: LitTable | null | undefined;
46  private sumDur: number = 0;
47  private fileStatisticsAnalysisRange: HTMLLabelElement | null | undefined;
48  private fsBack: HTMLDivElement | null | undefined;
49  private tabName: HTMLDivElement | null | undefined;
50  private fileStatisticsAnalysisProgressEL: LitProgressBar | null | undefined;
51  private fsProcessName: string = '';
52  private fileStatisticsAnalysisThreadName: string = '';
53  private fsSortColumn: string = '';
54  private fsSortType: number = 0;
55  private typeName: string = '';
56  private currentLevel = -1;
57  private currentLevelData!: Array<unknown>;
58  private processStatisticsData!: {};
59  private typeStatisticsData!: {};
60  private threadStatisticsData!: {};
61  private libStatisticsData!: {};
62  private functionStatisticsData!: {};
63  private fileSystemTitleEl: HTMLDivElement | undefined | null;
64  private fileSystemFilterEl: TabPaneFilter | undefined | null;
65  private hideProcessCheckBox: LitCheckBox | undefined | null;
66  private hideThreadCheckBox: LitCheckBox | undefined | null;
67  private checkBoxs: NodeListOf<LitCheckBox> | undefined | null;
68  private fsTableArray: NodeListOf<LitTable> | undefined | null;
69
70  set data(val: SelectionParam) {
71    if (val === this.fsCurrentSelection) {
72      this.fileStatisticsAnalysisPidData.unshift(this.processStatisticsData);
73      this.fileStatisticsAnalysisTableProcess!.recycleDataSource = this.fileStatisticsAnalysisPidData;
74      // @ts-ignore
75      this.fileStatisticsAnalysisPidData.shift(this.processStatisticsData);
76      return;
77    }
78    this.fsCurrentSelection = val;
79    if (this.fsTableArray && this.fsTableArray.length > 0) {
80      for (let fsTable of this.fsTableArray) {
81        initSort(fsTable!, this.fsSortColumn, this.fsSortType);
82      }
83    }
84    this.reset(this.fileStatisticsAnalysisTableProcess!, false);
85    this.hideProcessCheckBox!.checked = false;
86    this.hideThreadCheckBox!.checked = false;
87    this.fileSystemTitleEl!.textContent = '';
88    this.tabName!.textContent = '';
89    this.fileStatisticsAnalysisRange!.textContent = `Selected range: ${parseFloat(
90      ((val.rightNs - val.leftNs) / NUM_MILLON).toFixed(NUM_5)
91    )} ms`;
92    this.fileStatisticsAnalysisProgressEL!.loading = true;
93    this.getDataByWorker(
94      [
95        {
96          funcName: 'setSearchValue',
97          funcArgs: [''],
98        },
99        {
100          funcName: 'getCurrentDataFromDb',
101          funcArgs: [{ queryFuncName: 'fileSystem', ...val }],
102        },
103      ],
104      (results: unknown[]): void => {
105        this.disableCheckBox(results);
106        this.getFilesystemProcess(results);
107      }
108    );
109  }
110
111  initElements(): void {
112    this.fileStatisticsAnalysisRange = this.shadowRoot?.querySelector('#time-range');
113    this.fsPieChart = this.shadowRoot!.querySelector<LitChartPie>('#fs-chart-pie');
114    this.fileStatisticsAnalysisTableProcess = this.shadowRoot!.querySelector<LitTable>('#tb-process-usage');
115    this.fileStatisticsAnalysisTableThread = this.shadowRoot!.querySelector<LitTable>('#tb-thread-usage');
116    this.fileStatisticsAnalysisTableSo = this.shadowRoot!.querySelector<LitTable>('#tb-so-usage');
117    this.fileStatisticsAnalysisTableFunction = this.shadowRoot!.querySelector<LitTable>('#tb-function-usage');
118    this.fsBack = this.shadowRoot!.querySelector<HTMLDivElement>('.fs-go-back');
119    this.tabName = this.shadowRoot!.querySelector<HTMLDivElement>('.fs-subheading');
120    this.fileStatisticsAnalysisTableType = this.shadowRoot!.querySelector<LitTable>('#tb-type-usage');
121    this.fileStatisticsAnalysisProgressEL = this.shadowRoot?.querySelector('.progress') as LitProgressBar;
122    this.goBack();
123    this.fileSystemTitleEl = this.shadowRoot!.querySelector<HTMLDivElement>('.title');
124    this.fileSystemFilterEl = this.shadowRoot?.querySelector('#filter');
125    this.fileSystemFilterEl!.setOptionsList(['Hide Process', 'Hide Thread']);
126    let popover = this.fileSystemFilterEl!.shadowRoot!.querySelector('#check-popover');
127    this.hideProcessCheckBox = popover!!.querySelector<LitCheckBox>('div > #hideProcess');
128    this.hideThreadCheckBox = popover!!.querySelector<LitCheckBox>('div > #hideThread');
129    this.checkBoxs = popover!.querySelectorAll<LitCheckBox>('.check-wrap > lit-check-box');
130    this.fsTableArray = this.shadowRoot!.querySelectorAll('lit-table') as NodeListOf<LitTable>;
131    for (let fsTable of this.fsTableArray) {
132      this.columnClickListeners(fsTable);
133      fsTable!.addEventListener('contextmenu', function (event: MouseEvent): void {
134        event.preventDefault(); // 阻止默认的上下文菜单弹框
135      });
136      this.initTableRowHoverListeners(fsTable);
137      this.initTableRowClickListeners(fsTable);
138    }
139    for (let box of this.checkBoxs) {
140      this.checkBoxListener(box);
141    }
142    const addRowClickEventListener = (fsTable: LitTable, clickEvent: Function): void => {
143      fsTable.addEventListener('row-click', (evt: Event): void => {
144        // @ts-ignore
145        const detail = evt.detail;
146        if (detail.button === 0 && detail.data.tableName !== '' && detail.data.duration !== 0) {
147          clickEvent(detail.data, this.fsCurrentSelection);
148        }
149      });
150    };
151    addRowClickEventListener(this.fileStatisticsAnalysisTableProcess!, this.fileProcessLevelClickEvent.bind(this));
152    addRowClickEventListener(this.fileStatisticsAnalysisTableType!, this.fileTypeLevelClickEvent.bind(this));
153    addRowClickEventListener(this.fileStatisticsAnalysisTableThread!, this.fileThreadLevelClickEvent.bind(this));
154    addRowClickEventListener(this.fileStatisticsAnalysisTableSo!, this.fileSoLevelClickEvent.bind(this));
155  }
156  private disableCheckBox(results: Array<unknown>): void {
157    if (results.length === 0) {
158      this.hideProcessCheckBox?.setAttribute('disabled', 'disabled');
159      this.hideThreadCheckBox?.setAttribute('disabled', 'disabled');
160    } else {
161      this.hideProcessCheckBox?.removeAttribute('disabled');
162      this.hideThreadCheckBox?.removeAttribute('disabled');
163    }
164  }
165
166  private checkBoxListener(box: LitCheckBox): void {
167    box!.addEventListener('change', (): void => {
168      if (this.hideProcessCheckBox!.checked && this.hideThreadCheckBox!.checked) {
169        this.hideThread();
170        this.fsBack!.style.visibility = 'hidden';
171      } else if (this.hideProcessCheckBox!.checked && !this.hideThreadCheckBox!.checked) {
172        this.hideProcess();
173      } else {
174        this.reset(this.fileStatisticsAnalysisTableProcess!, false); // @ts-ignore
175        this.getFilesystemProcess(this.fileStatisticsAnalysisProcessData);
176      }
177    });
178  }
179
180  private initTableRowClickListeners(fsTable: LitTable): void {
181    fsTable!.addEventListener('row-click', (evt: Event): void => {
182      // @ts-ignore
183      let detail = evt.detail;
184      if (detail.button === 2) {
185        let fsTab = this.parentElement?.parentElement?.querySelector<TabpaneFilesystemCalltree>(
186          '#box-file-system-calltree > tabpane-filesystem-calltree'
187        );
188        fsTab!.cWidth = this.clientWidth;
189        fsTab!.currentFsCallTreeLevel = this.currentLevel;
190        if (this.hideProcessCheckBox?.checked) {
191          detail.data.pid = undefined;
192        }
193        if (this.hideThreadCheckBox?.checked) {
194          detail.data.tid = undefined;
195        }
196        fsTab!.fsRowClickData = detail.data;
197        let title = '';
198        if (this.fileSystemTitleEl?.textContent === '') {
199          title = detail.data.tableName;
200        } else {
201          title = `${this.fileSystemTitleEl?.textContent} / ${detail.data.tableName}`;
202        }
203        fsTab!.pieTitle = title;
204        //  是否是在表格上右键点击跳转到火焰图的
205        this.fsCurrentSelection!.isRowClick = true;
206        fsTab!.data = this.fsCurrentSelection;
207      }
208    });
209  }
210
211  private initTableRowHoverListeners(fsTable: LitTable): void {
212    fsTable!.addEventListener('row-hover', (evt) => {
213      // @ts-ignore
214      let detail = evt.detail;
215      if (detail.data) {
216        let tableData = detail.data;
217        tableData.isHover = true;
218        if (detail.callBack) {
219          detail.callBack(true);
220        }
221      }
222      this.fsPieChart?.showHover();
223      this.fsPieChart?.hideTip();
224    });
225  }
226
227  private columnClickListeners(fsTable: LitTable): void {
228    fsTable!.addEventListener('column-click', (evt) => {
229      // @ts-ignore
230      this.fsSortColumn = evt.detail.key;
231      // @ts-ignore
232      this.fsSortType = evt.detail.sort;
233      this.sortByColumn();
234    });
235  }
236
237  private reset(showTable: LitTable, isShowBack: boolean): void {
238    this.clearData();
239    if (isShowBack) {
240      this.fsBack!.style.visibility = 'visible';
241    } else {
242      this.fsBack!.style.visibility = 'hidden';
243      this.fileSystemTitleEl!.textContent = '';
244    }
245    if (this.fsTableArray) {
246      for (let fileSystemTable of this.fsTableArray) {
247        if (fileSystemTable === showTable) {
248          initSort(fileSystemTable!, this.fsSortColumn, this.fsSortType);
249          fileSystemTable.style.display = 'grid';
250          fileSystemTable!.removeAttribute('hideDownload');
251        } else {
252          fileSystemTable!.style.display = 'none';
253          fileSystemTable.setAttribute('hideDownload', '');
254        }
255      }
256    }
257  }
258
259  private clearData(): void {
260    this.fsPieChart!.dataSource = [];
261    this.fileStatisticsAnalysisTableProcess!.recycleDataSource = [];
262    this.fileStatisticsAnalysisTableThread!.recycleDataSource = [];
263    this.fileStatisticsAnalysisTableType!.recycleDataSource = [];
264    this.fileStatisticsAnalysisTableSo!.recycleDataSource = [];
265    this.fileStatisticsAnalysisTableFunction!.recycleDataSource = [];
266  }
267
268  private showAssignLevel(showFsTable: LitTable, hideFsTable: LitTable, currentLevel: number): void {
269    showFsTable!.style.display = 'grid';
270    hideFsTable!.style.display = 'none';
271    hideFsTable.setAttribute('hideDownload', '');
272    showFsTable?.removeAttribute('hideDownload');
273    this.currentLevel = currentLevel;
274  }
275
276  private goBack(): void {
277    this.fsBack!.addEventListener('click', () => {
278      if (this.tabName!.textContent === 'Statistic By type AllDuration') {
279        this.fsBack!.style.visibility = 'hidden';
280        this.showAssignLevel(this.fileStatisticsAnalysisTableProcess!, this.fileStatisticsAnalysisTableType!, 0);
281        this.processPieChart();
282      } else if (this.tabName!.textContent === 'Statistic By Thread AllDuration') {
283        if (this.hideProcessCheckBox?.checked) {
284          this.fsBack!.style.visibility = 'hidden';
285        } else {
286          this.fsBack!.style.visibility = 'visible';
287        }
288        this.showAssignLevel(this.fileStatisticsAnalysisTableType!, this.fileStatisticsAnalysisTableThread!, 1);
289        this.typePieChart();
290      } else if (this.tabName!.textContent === 'Statistic By Library AllDuration') {
291        if (this.hideThreadCheckBox?.checked) {
292          if (this.hideProcessCheckBox?.checked) {
293            this.fsBack!.style.visibility = 'hidden';
294          }
295          this.showAssignLevel(this.fileStatisticsAnalysisTableType!, this.fileStatisticsAnalysisTableSo!, 1);
296          this.typePieChart();
297        } else {
298          this.showAssignLevel(this.fileStatisticsAnalysisTableThread!, this.fileStatisticsAnalysisTableSo!, 2);
299          this.threadPieChart();
300        }
301      } else if (this.tabName!.textContent === 'Statistic By Function AllDuration') {
302        this.showAssignLevel(this.fileStatisticsAnalysisTableSo!, this.fileStatisticsAnalysisTableFunction!, 3);
303        this.libraryPieChart();
304      }
305    });
306  }
307
308  private hideProcess(): void {
309    this.reset(this.fileStatisticsAnalysisTableType!, false);
310    this.fsProcessName = '';
311    this.getFilesystemType(null);
312  }
313
314  private hideThread(it?: unknown): void {
315    this.reset(this.fileStatisticsAnalysisTableType!, true);
316    this.fsProcessName = '';
317    this.fileStatisticsAnalysisThreadName = '';
318    if (it) {
319      this.getFilesystemType(it);
320    } else {
321      this.getFilesystemType(null);
322    }
323  }
324
325  private processPieChart(): void {
326    // @ts-ignore
327    this.sumDur = this.processStatisticsData.allDuration;
328    this.fsPieChart!.config = {
329      appendPadding: 0,
330      data: this.getFsPieChartData(this.fileStatisticsAnalysisPidData),
331      angleField: 'duration',
332      colorField: 'tableName',
333      radius: 1,
334      label: {
335        type: 'outer',
336      }, // @ts-ignore
337      tip: this.getFsTip(),
338      angleClick: (fsPieClickItem): void => {
339        // @ts-ignore
340        if (fsPieClickItem.tableName !== 'other') {
341          this.fileProcessLevelClickEvent(fsPieClickItem);
342        }
343      },
344      hoverHandler: (fsPieData): void => {
345        if (fsPieData) {
346          this.fileStatisticsAnalysisTableProcess!.setCurrentHover(fsPieData);
347        } else {
348          this.fileStatisticsAnalysisTableProcess!.mouseOut();
349        }
350      },
351      interactions: [
352        {
353          type: 'element-active',
354        },
355      ],
356    };
357    this.fileSystemTitleEl!.textContent = '';
358    this.tabName!.textContent = 'Statistic By Process AllDuration';
359    this.fileStatisticsAnalysisPidData.unshift(this.processStatisticsData);
360    this.fileStatisticsAnalysisTableProcess!.recycleDataSource = this.fileStatisticsAnalysisPidData;
361    // @ts-ignore
362    this.fileStatisticsAnalysisPidData.shift(this.processStatisticsData);
363    this.currentLevelData = this.fileStatisticsAnalysisPidData;
364    this.fileStatisticsAnalysisTableProcess?.reMeauseHeight();
365  }
366
367  private fileProcessLevelClickEvent(it: unknown): void {
368    this.reset(this.fileStatisticsAnalysisTableType!, true);
369    this.getFilesystemType(it);
370    // @ts-ignore
371    this.fsProcessName = it.tableName;
372    this.fileSystemTitleEl!.textContent = this.fsProcessName;
373    this.fsPieChart?.hideTip();
374  }
375
376  private typePieChart(): void {
377    this.fsPieChart!.config = {
378      appendPadding: 0,
379      data: this.fileStatisticsAnalysisTypeData,
380      angleField: 'duration',
381      colorField: 'tableName',
382      radius: 1,
383      label: {
384        type: 'outer',
385      }, // @ts-ignore
386      tip: this.getFileTypeTip(),
387      angleClick: (it): void => {
388        this.fileTypeLevelClickEvent(it);
389      },
390      hoverHandler: (data): void => {
391        if (data) {
392          this.fileStatisticsAnalysisTableType!.setCurrentHover(data);
393        } else {
394          this.fileStatisticsAnalysisTableType!.mouseOut();
395        }
396      },
397      interactions: [
398        {
399          type: 'element-active',
400        },
401      ],
402    };
403    this.fileSystemTitleEl!.textContent = this.fsProcessName;
404    this.tabName!.textContent = 'Statistic By type AllDuration';
405    this.fileStatisticsAnalysisTypeData.unshift(this.typeStatisticsData);
406    this.fileStatisticsAnalysisTableType!.recycleDataSource = this.fileStatisticsAnalysisTypeData;
407    // @ts-ignore
408    this.fileStatisticsAnalysisTypeData.shift(this.typeStatisticsData);
409    this.currentLevelData = this.fileStatisticsAnalysisTypeData;
410    this.fileStatisticsAnalysisTableType?.reMeauseHeight();
411  }
412
413  private getFileTypeTip() {
414    return (obj: { obj: { tableName: unknown; durFormat: unknown; percent: unknown } }): string => {
415      return `<div>
416                    <div>Type:${obj.obj.tableName}</div>
417                    <div>Duration:${obj.obj.durFormat}</div>
418                    <div>Percent:${obj.obj.percent}%</div>
419                </div>
420                `;
421    };
422  }
423
424  private fileTypeLevelClickEvent(it: unknown): void {
425    if (this.hideThreadCheckBox!.checked) {
426      this.reset(this.fileStatisticsAnalysisTableSo!, true);
427      this.getFilesystemSo(it);
428    } else {
429      this.reset(this.fileStatisticsAnalysisTableThread!, true);
430      this.getFilesystemThread(it);
431    }
432    // @ts-ignore
433    this.typeName = it.tableName;
434    let title = '';
435    if (this.fsProcessName.length > 0) {
436      title += `${this.fsProcessName} / `;
437    }
438    if (this.typeName.length > 0) {
439      title += this.typeName;
440    }
441    this.fileSystemTitleEl!.textContent = title;
442    this.fsPieChart?.hideTip();
443  }
444
445  private threadPieChart(): void {
446    // @ts-ignore
447    this.sumDur = this.threadStatisticsData.allDuration;
448    this.fsPieChart!.config = {
449      appendPadding: 0,
450      data: this.getFsPieChartData(this.fileStatisticsAnalysisThreadData),
451      angleField: 'duration',
452      colorField: 'tableName',
453      radius: 1,
454      label: {
455        type: 'outer',
456      }, // @ts-ignore
457      tip: this.getFileTypeTip(),
458      angleClick: (it): void => {
459        // @ts-ignore
460        if (it.tableName !== 'other') {
461          this.fileThreadLevelClickEvent(it);
462        }
463      },
464      hoverHandler: (data): void => {
465        if (data) {
466          this.fileStatisticsAnalysisTableThread!.setCurrentHover(data);
467        } else {
468          this.fileStatisticsAnalysisTableThread!.mouseOut();
469        }
470      },
471      interactions: [
472        {
473          type: 'element-active',
474        },
475      ],
476    };
477    let title = '';
478    if (this.fsProcessName.length > 0) {
479      title += `${this.fsProcessName} / `;
480    }
481    if (this.typeName.length > 0) {
482      title += this.typeName;
483    }
484    this.fileSystemTitleEl!.textContent = title;
485    this.tabName!.textContent = 'Statistic By Thread AllDuration';
486    this.fileStatisticsAnalysisThreadData.unshift(this.threadStatisticsData);
487    this.fileStatisticsAnalysisTableThread!.recycleDataSource = this.fileStatisticsAnalysisThreadData;
488    // @ts-ignore
489    this.fileStatisticsAnalysisThreadData.shift(this.threadStatisticsData);
490    this.currentLevelData = this.fileStatisticsAnalysisThreadData;
491    this.fileStatisticsAnalysisTableThread?.reMeauseHeight();
492  }
493
494  private getFsTip() {
495    return (obj: { obj: { tableName: unknown; durFormat: unknown; percent: unknown } }): string => {
496      return `<div>
497                    <div>ThreadName:${obj.obj.tableName}</div>
498                    <div>Duration:${obj.obj.durFormat}</div>
499                    <div>Percent:${obj.obj.percent}%</div>
500                </div>
501                    `;
502    };
503  }
504
505  private fileThreadLevelClickEvent(it: unknown): void {
506    this.reset(this.fileStatisticsAnalysisTableSo!, true);
507    this.getFilesystemSo(it);
508    // @ts-ignore
509    this.fileStatisticsAnalysisThreadName = it.tableName;
510    let title = '';
511    if (this.fsProcessName.length > 0) {
512      title += `${this.fsProcessName} / `;
513    }
514    if (this.typeName.length > 0) {
515      title += `${this.typeName} / `;
516    }
517    if (this.fileStatisticsAnalysisThreadName.length > 0) {
518      title += this.fileStatisticsAnalysisThreadName;
519    }
520    this.fileSystemTitleEl!.textContent = title;
521    this.fsPieChart?.hideTip();
522  }
523
524  private libraryPieChart(): void {
525    // @ts-ignore
526    this.sumDur = this.libStatisticsData.allDuration;
527    this.setFsPieChartConfig();
528    let fileSystemTitle = '';
529    if (this.fsProcessName.length > 0) {
530      fileSystemTitle += `${this.fsProcessName} / `;
531    }
532    if (this.typeName.length > 0) {
533      if (this.hideThreadCheckBox?.checked) {
534        fileSystemTitle += this.typeName;
535      } else {
536        fileSystemTitle += `${this.typeName} / `;
537      }
538    }
539    if (this.fileStatisticsAnalysisThreadName.length > 0) {
540      fileSystemTitle += this.fileStatisticsAnalysisThreadName;
541    }
542    this.fileSystemTitleEl!.textContent = fileSystemTitle;
543    this.tabName!.textContent = 'Statistic By Library AllDuration';
544    this.fileStatisticsAnalysisSoData.unshift(this.libStatisticsData);
545    this.fileStatisticsAnalysisTableSo!.recycleDataSource = this.fileStatisticsAnalysisSoData;
546    // @ts-ignore
547    this.fileStatisticsAnalysisSoData.shift(this.libStatisticsData);
548    this.currentLevelData = this.fileStatisticsAnalysisSoData;
549    this.fileStatisticsAnalysisTableSo?.reMeauseHeight();
550  }
551
552  private setFsPieChartConfig(): void {
553    this.fsPieChart!.config = {
554      appendPadding: 0,
555      data: this.getFsPieChartData(this.fileStatisticsAnalysisSoData),
556      angleField: 'duration',
557      colorField: 'tableName',
558      radius: 1,
559      label: {
560        type: 'outer',
561      },
562      tip: (fileSysObj): string => {
563        return `<div>
564                    <div>Library:${
565                      // @ts-ignore
566                      fileSysObj.obj.tableName
567                    }</div>
568                    <div>Duration:${
569                      // @ts-ignore
570                      fileSysObj.obj.durFormat
571                    }</div>
572                    <div>Percent:${
573                      // @ts-ignore
574                      fileSysObj.obj.percent
575                    }%</div>
576                </div>
577                    `;
578      },
579      angleClick: (fileSysBean): void => {
580        // @ts-ignore
581        if (fileSysBean.tableName !== 'other') {
582          this.fileSoLevelClickEvent(fileSysBean);
583        }
584      },
585      hoverHandler: (data): void => {
586        if (data) {
587          this.fileStatisticsAnalysisTableSo!.setCurrentHover(data);
588        } else {
589          this.fileStatisticsAnalysisTableSo!.mouseOut();
590        }
591      },
592      interactions: [
593        {
594          type: 'element-active',
595        },
596      ],
597    };
598  }
599
600  private fileSoLevelClickEvent(it: unknown): void {
601    this.reset(this.fileStatisticsAnalysisTableFunction!, true);
602    this.fileStatisticsAnalysisProgressEL!.loading = true;
603    this.shadowRoot!.querySelector<HTMLDivElement>('.fs-subheading')!.textContent = 'Statistic By Function AllDuration'; // @ts-ignore
604    if (!this.fileStatisticsAnalysisProcessData || this.fileStatisticsAnalysisProcessData.length === 0) {
605      return;
606    }
607    let allDur = 0;
608    let symbolMap = new Map<number, Array<unknown>>();
609    allDur = this.symbolMapProcessData(it, allDur, symbolMap);
610    this.updateFunctionData(symbolMap, it, allDur);
611    this.getFilesystemFunction(allDur);
612    let title = '';
613    if (this.fsProcessName.length > 0) {
614      title += `${this.fsProcessName} / `;
615    }
616    if (this.typeName.length > 0) {
617      title += `${this.typeName} / `;
618    }
619    if (this.fileStatisticsAnalysisThreadName.length > 0 && !this.hideThreadCheckBox!.checked) {
620      title += `${this.fileStatisticsAnalysisThreadName} / `;
621    } // @ts-ignore
622    if (it.tableName.length > 0) {
623      // @ts-ignore
624      title += it.tableName;
625    }
626    this.fileSystemTitleEl!.textContent = title;
627    this.fsPieChart?.hideTip();
628  }
629
630  private getFilesystemFunction(allDur: number): void {
631    // @ts-ignore
632    this.fileStatisticsAnalysisFunctionData.sort((a, b) => b.duration - a.duration);
633    this.functionStatisticsData = this.totalDurationData(allDur);
634    this.currentLevel = 4;
635    this.fileStatisticsAnalysisProgressEL!.loading = false;
636    // @ts-ignore
637    this.sumDur = this.functionStatisticsData.allDuration;
638    this.fsPieChart!.config = {
639      appendPadding: 0,
640      data: this.getFsPieChartData(this.fileStatisticsAnalysisFunctionData),
641      angleField: 'duration',
642      colorField: 'tableName',
643      radius: 1,
644      label: {
645        type: 'outer',
646      },
647      tip: (fsaObj): string => {
648        return `<div>
649                    <div>Function:${
650                      // @ts-ignore
651                      fsaObj.obj.tableName
652                    }</div>
653                    <div>Duration:${
654                      // @ts-ignore
655                      fsaObj.obj.durFormat
656                    }</div>
657                    <div>percent:${
658                      // @ts-ignore
659                      fsaObj.obj.percent
660                    }</div>
661                </div>
662                `;
663      },
664      hoverHandler: (data): void => {
665        if (data) {
666          this.fileStatisticsAnalysisTableFunction!.setCurrentHover(data);
667        } else {
668          this.fileStatisticsAnalysisTableFunction!.mouseOut();
669        }
670      },
671      interactions: [
672        {
673          type: 'element-active',
674        },
675      ],
676    };
677    this.fileStatisticsAnalysisFunctionData.unshift(this.functionStatisticsData);
678    this.fileStatisticsAnalysisTableFunction!.recycleDataSource = this.fileStatisticsAnalysisFunctionData;
679    this.fileStatisticsAnalysisTableFunction?.reMeauseHeight();
680    // @ts-ignore
681    this.fileStatisticsAnalysisFunctionData.shift(this.functionStatisticsData);
682    this.currentLevelData = this.fileStatisticsAnalysisFunctionData;
683  }
684
685  private sortByColumn(): void {
686    let fsaCurrentTable: LitTable | null | undefined;
687    switch (this.currentLevel) {
688      case 0:
689        fsaCurrentTable = this.fileStatisticsAnalysisTableProcess;
690        break;
691      case 1:
692        fsaCurrentTable = this.fileStatisticsAnalysisTableType;
693        break;
694      case 2:
695        fsaCurrentTable = this.fileStatisticsAnalysisTableThread;
696        break;
697      case 3:
698        fsaCurrentTable = this.fileStatisticsAnalysisTableSo;
699        break;
700      case 4:
701        fsaCurrentTable = this.fileStatisticsAnalysisTableFunction;
702        break;
703    }
704    if (!fsaCurrentTable) {
705      return;
706    }
707    if (this.fsSortType === 0) {
708      this.sortAndRefreshTable(fsaCurrentTable);
709    } else {
710      this.sortAndRefreshTableByColumn(fsaCurrentTable);
711    }
712  }
713
714  private sortAndRefreshTableByColumn(fsaCurrentTable: LitTable): void {
715    let fsaArray = [...this.currentLevelData];
716    if (this.fsSortColumn === 'tableName') {
717      this.sortTableNameCase(fsaCurrentTable, fsaArray);
718    } else if (this.fsSortColumn === 'durFormat' || this.fsSortColumn === 'percent') {
719      fsaCurrentTable!.recycleDataSource = fsaArray.sort((a, b) => {
720        // @ts-ignore
721        return this.fsSortType === 1 ? a.duration - b.duration : b.duration - a.duration;
722      });
723    }
724    switch (this.currentLevel) {
725      case 0:
726        fsaArray.unshift(this.processStatisticsData);
727        break;
728      case 1:
729        fsaArray.unshift(this.typeStatisticsData);
730        break;
731      case 2:
732        fsaArray.unshift(this.threadStatisticsData);
733        break;
734      case 3:
735        fsaArray.unshift(this.libStatisticsData);
736        break;
737      case 4:
738        fsaArray.unshift(this.functionStatisticsData);
739        break;
740    }
741    fsaCurrentTable!.recycleDataSource = fsaArray;
742  }
743
744  private sortAndRefreshTable(fsaCurrentTable: LitTable): void {
745    let fsaArr = [...this.currentLevelData];
746    switch (this.currentLevel) {
747      case 0:
748        fsaArr.unshift(this.processStatisticsData);
749        break;
750      case 1:
751        fsaArr.unshift(this.typeStatisticsData);
752        break;
753      case 2:
754        fsaArr.unshift(this.threadStatisticsData);
755        break;
756      case 3:
757        fsaArr.unshift(this.libStatisticsData);
758        break;
759      case 4:
760        fsaArr.unshift(this.functionStatisticsData);
761        break;
762    }
763    fsaCurrentTable!.recycleDataSource = fsaArr;
764  }
765
766  private sortTableNameCase(fsaCurrentTable: LitTable, fsaArray: unknown[]): void {
767    fsaCurrentTable!.recycleDataSource = fsaArray.sort((firstElement, secondElement): number => {
768      if (this.fsSortType === 1) {
769        // @ts-ignore
770        if (firstElement.tableName > secondElement.tableName) {
771          return 1; // @ts-ignore
772        } else if (firstElement.tableName === secondElement.tableName) {
773          return 0;
774        } else {
775          return -1;
776        }
777      } else {
778        // @ts-ignore
779        if (secondElement.tableName > firstElement.tableName) {
780          return 1; // @ts-ignore
781        } else if (firstElement.tableName === secondElement.tableName) {
782          return 0;
783        } else {
784          return -1;
785        }
786      }
787    });
788  }
789
790  private getFilesystemProcess(result: Array<unknown>): void {
791    this.fileStatisticsAnalysisProcessData = JSON.parse(JSON.stringify(result)); // @ts-ignore
792    if (!this.fileStatisticsAnalysisProcessData || this.fileStatisticsAnalysisProcessData.length === 0) {
793      this.fileStatisticsAnalysisPidData = [];
794      this.processStatisticsData = [];
795      this.processPieChart();
796      return;
797    }
798    let allDur = 0;
799    let pidMap = new Map<string, Array<number | string>>();
800    for (let itemData of result) {
801      // @ts-ignore
802      allDur += itemData.dur; // @ts-ignore
803      if (pidMap.has(itemData.pid)) {
804        // @ts-ignore
805        pidMap.get(itemData.pid)?.push(itemData);
806      } else {
807        let itemArray = [];
808        itemArray.push(itemData); // @ts-ignore
809        pidMap.set(itemData.pid, itemArray);
810      }
811    }
812    this.fileStatisticsAnalysisPidData = [];
813    pidMap.forEach((value: Array<unknown>, key: string): void => {
814      let analysisPidDataDur = 0;
815      let pName = '';
816      for (let fileSysStatPidItem of value) {
817        // @ts-ignore
818        if (fileSysStatPidItem.processName && fileSysStatPidItem.processName.length > 0) {
819          // @ts-ignore
820          if (!fileSysStatPidItem.processName.endsWith(`(${fileSysStatPidItem.pid})`)) {
821            // @ts-ignore
822            fileSysStatPidItem.processName = `${fileSysStatPidItem.processName}(${fileSysStatPidItem.pid})`;
823          }
824        } else {
825          // @ts-ignore
826          fileSysStatPidItem.processName = `Process(${fileSysStatPidItem.pid})`;
827        } // @ts-ignore
828        pName = fileSysStatPidItem.processName; // @ts-ignore
829        analysisPidDataDur += fileSysStatPidItem.dur;
830      }
831      this.fileStatisticsAnalysisPidData.push({
832        tableName: pName,
833        pid: key,
834        percent: ((analysisPidDataDur / allDur) * 100).toFixed(2),
835        durFormat: Utils.getProbablyTime(analysisPidDataDur),
836        duration: analysisPidDataDur,
837      });
838    }); // @ts-ignore
839    this.fileStatisticsAnalysisPidData.sort((a, b) => b.duration - a.duration);
840    this.processStatisticsData = this.totalDurationData(allDur);
841    this.currentLevel = 0;
842    this.fileStatisticsAnalysisProgressEL!.loading = false;
843    this.processPieChart();
844  }
845
846  private getFilesystemType(fileSysStatTypeItem: unknown): void {
847    this.fileStatisticsAnalysisProgressEL!.loading = true;
848    let typeMap = new Map<number, Array<number | string>>();
849    let allDur = 0; // @ts-ignore
850    if (!this.fileStatisticsAnalysisProcessData || this.fileStatisticsAnalysisProcessData.length === 0) {
851      return;
852    } // @ts-ignore
853    for (let fsItem of this.fileStatisticsAnalysisProcessData) {
854      // @ts-ignore
855      if (fileSysStatTypeItem && fsItem.pid !== fileSysStatTypeItem.pid && !this.hideProcessCheckBox?.checked) {
856        continue;
857      }
858      allDur += fsItem.dur;
859      if (typeMap.has(fsItem.type)) {
860        typeMap.get(fsItem.type)?.push(fsItem);
861      } else {
862        let itemArray = [];
863        itemArray.push(fsItem);
864        typeMap.set(fsItem.type, itemArray);
865      }
866    }
867    this.fileStatisticsAnalysisTypeData = [];
868    typeMap.forEach((value: Array<unknown>, key: number): void => {
869      let dur = 0;
870      for (let item of value) {
871        // @ts-ignore
872        dur += item.dur;
873      }
874      const typeData = {
875        tableName: this.typeIdToString(key), // @ts-ignore
876        pid: fileSysStatTypeItem === null ? value[0].pid : fileSysStatTypeItem.pid,
877        type: key,
878        percent: ((dur / allDur) * 100).toFixed(2),
879        durFormat: Utils.getProbablyTime(dur),
880        duration: dur,
881      };
882      this.fileStatisticsAnalysisTypeData.push(typeData);
883    }); // @ts-ignore
884    this.fileStatisticsAnalysisTypeData.sort((a, b) => b.duration - a.duration);
885    this.typeStatisticsData = this.totalDurationData(allDur);
886    this.currentLevel = 1;
887    this.typePieChart();
888    this.fileStatisticsAnalysisProgressEL!.loading = false;
889  }
890
891  private getFilesystemThread(fileSysStatThreadItem: unknown): void {
892    this.fileStatisticsAnalysisProgressEL!.loading = true;
893    let threadMap = new Map<string, Array<number | string>>(); // @ts-ignore
894    let pid = fileSysStatThreadItem.pid; // @ts-ignore
895    let type = fileSysStatThreadItem.type;
896    let allDur = 0; // @ts-ignore
897    if (!this.fileStatisticsAnalysisProcessData || this.fileStatisticsAnalysisProcessData.length === 0) {
898      return;
899    } // @ts-ignore
900    for (let fspItem of this.fileStatisticsAnalysisProcessData) {
901      if (
902        (!this.hideProcessCheckBox?.checked && fspItem.pid !== pid) ||
903        fspItem.type !== type ||
904        (fspItem.type !== type && this.hideProcessCheckBox?.checked)
905      ) {
906        continue;
907      }
908      allDur += fspItem.dur;
909      if (threadMap.has(fspItem.tid)) {
910        threadMap.get(fspItem.tid)?.push(fspItem);
911      } else {
912        let itemArray = [];
913        itemArray.push(fspItem);
914        threadMap.set(fspItem.tid, itemArray);
915      }
916    }
917    this.updateThreadData(threadMap, fileSysStatThreadItem, allDur); // @ts-ignore
918    this.fileStatisticsAnalysisThreadData.sort((a, b) => b.duration - a.duration);
919    this.threadStatisticsData = this.totalDurationData(allDur);
920    this.currentLevel = 2;
921    this.fileStatisticsAnalysisProgressEL!.loading = false;
922    this.threadPieChart();
923  }
924
925  private updateThreadData(
926    threadMap: Map<string, Array<number | string>>,
927    fileSysStatThreadItem: unknown,
928    allDur: number
929  ): void {
930    this.fileStatisticsAnalysisThreadData = [];
931    threadMap.forEach((value: Array<unknown>, key: string): void => {
932      let dur = 0;
933      let tName = '';
934      for (let fileSysStatThreadItem of value) {
935        // @ts-ignore
936        dur += fileSysStatThreadItem.dur; // @ts-ignore
937        tName = fileSysStatThreadItem.threadName = // @ts-ignore
938          fileSysStatThreadItem.threadName === null || fileSysStatThreadItem.threadName === undefined // @ts-ignore
939            ? `Thread(${fileSysStatThreadItem.tid})` // @ts-ignore
940            : `${fileSysStatThreadItem.threadName}(${fileSysStatThreadItem.tid})`;
941      }
942      const threadData = {
943        tableName: tName, // @ts-ignore
944        pid: fileSysStatThreadItem.pid, // @ts-ignore
945        type: fileSysStatThreadItem.type,
946        tid: key,
947        percent: ((dur / allDur) * 100).toFixed(2),
948        durFormat: Utils.getProbablyTime(dur),
949        duration: dur,
950      };
951      this.fileStatisticsAnalysisThreadData.push(threadData);
952    });
953  }
954
955  private getFilesystemSo(item: unknown): void {
956    this.fileStatisticsAnalysisProgressEL!.loading = true;
957    let allDur = 0;
958    let libMap = new Map<number, Array<number | string>>(); // @ts-ignore
959    if (!this.fileStatisticsAnalysisProcessData || this.fileStatisticsAnalysisProcessData.length === 0) {
960      return;
961    }
962    allDur = this.libMapProcessData(item, allDur, libMap);
963    this.updateSoData(libMap, item, allDur);
964    this.libStatisticsData = this.totalDurationData(allDur);
965    this.currentLevel = 3;
966    this.fileStatisticsAnalysisProgressEL!.loading = false;
967    this.libraryPieChart();
968  }
969
970  private libMapProcessData(item: unknown, allDur: number, libMap: Map<number, Array<number | string>>): number {
971    // @ts-ignore
972    for (let itemData of this.fileStatisticsAnalysisProcessData) {
973      if (this.libIsAccumulationData(item, itemData)) {
974        continue;
975      }
976      allDur += itemData.dur;
977      if (libMap.has(itemData.libId)) {
978        libMap.get(itemData.libId)?.push(itemData);
979      } else {
980        let dataArray = [];
981        dataArray.push(itemData);
982        libMap.set(itemData.libId, dataArray);
983      }
984    }
985    return allDur;
986  }
987
988  private libIsAccumulationData(item: unknown, itemData: unknown): boolean {
989    if (!item) {
990      return false;
991    }
992    if (!this.hideProcessCheckBox?.checked && !this.hideThreadCheckBox?.checked) {
993      // @ts-ignore
994      return itemData.pid !== item.pid || itemData.tid !== item.tid || itemData.type !== item.type;
995    }
996    if (!this.hideProcessCheckBox?.checked && this.hideThreadCheckBox?.checked) {
997      // @ts-ignore
998      return itemData.pid !== item.pid || itemData.type !== item.type;
999    }
1000    if (this.hideProcessCheckBox?.checked && !this.hideThreadCheckBox?.checked) {
1001      // @ts-ignore
1002      return itemData.tid !== item.tid || itemData.type !== item.type;
1003    }
1004    if (this.hideProcessCheckBox?.checked && this.hideThreadCheckBox?.checked) {
1005      // @ts-ignore
1006      return itemData.type !== item.type;
1007    }
1008    return false;
1009  }
1010
1011  private updateSoData(libMap: Map<number, Array<number | string>>, item: unknown, allDur: number): void {
1012    this.fileStatisticsAnalysisSoData = [];
1013    libMap.forEach((value: unknown[], key: number): void => {
1014      let dur = 0;
1015      let soName = '';
1016      for (let item of value) {
1017        // @ts-ignore
1018        dur += item.dur;
1019        if (key === null) {
1020          // @ts-ignore
1021          item.libName = 'unknown';
1022        } // @ts-ignore
1023        soName = item.libName;
1024      }
1025      let libPath = soName?.split('/');
1026      if (libPath) {
1027        soName = libPath[libPath.length - 1];
1028      }
1029      const soData = {
1030        tableName: soName, // @ts-ignore
1031        pid: item === null ? value[0].pid : item.pid, // @ts-ignore
1032        type: item === null ? value[0].type : item.type, // @ts-ignore
1033        tid: item === null ? value[0].tid : item.tid,
1034        libId: key,
1035        percent: ((dur / allDur) * 100).toFixed(2),
1036        durFormat: Utils.getProbablyTime(dur),
1037        duration: dur,
1038      };
1039      this.fileStatisticsAnalysisSoData.push(soData);
1040    }); // @ts-ignore
1041    this.fileStatisticsAnalysisSoData.sort((a, b) => b.duration - a.duration);
1042  }
1043
1044  private symbolMapProcessData(item: unknown, allDur: number, symbolMap: Map<number, Array<unknown>>): number {
1045    // @ts-ignore
1046    let tid = item.tid; // @ts-ignore
1047    let pid = item.pid; // @ts-ignore
1048    let type = item.type; // @ts-ignore
1049    let libId = item.libId; // @ts-ignore
1050    for (let fsProcessData of this.fileStatisticsAnalysisProcessData) {
1051      if (this.symbolIsAccumulationData(fsProcessData, tid, pid, type, libId)) {
1052        continue;
1053      }
1054      allDur += fsProcessData.dur;
1055      if (symbolMap.has(fsProcessData.symbolId)) {
1056        symbolMap.get(fsProcessData.symbolId)?.push(fsProcessData);
1057      } else {
1058        let dataArray = [];
1059        dataArray.push(fsProcessData);
1060        symbolMap.set(fsProcessData.symbolId, dataArray);
1061      }
1062    }
1063    return allDur;
1064  }
1065
1066  private symbolIsAccumulationData(
1067    fsProcessData: unknown,
1068    tid: number,
1069    pid: number,
1070    type: string,
1071    libId: number
1072  ): boolean {
1073    if (!fsProcessData) {
1074      return false;
1075    }
1076    if (!this.hideProcessCheckBox?.checked && !this.hideThreadCheckBox?.checked) {
1077      return (
1078        // @ts-ignore
1079        fsProcessData.pid !== pid || // @ts-ignore
1080        fsProcessData.tid !== tid || // @ts-ignore
1081        fsProcessData.type !== type || // @ts-ignore
1082        fsProcessData.libId !== libId
1083      );
1084    }
1085    if (!this.hideProcessCheckBox?.checked && this.hideThreadCheckBox?.checked) {
1086      // @ts-ignore
1087      return fsProcessData.pid !== pid || fsProcessData.type !== type || fsProcessData.libId !== libId;
1088    }
1089    if (this.hideProcessCheckBox?.checked && !this.hideThreadCheckBox?.checked) {
1090      // @ts-ignore
1091      return fsProcessData.tid !== tid || fsProcessData.type !== type || fsProcessData.libId !== libId;
1092    }
1093    if (this.hideProcessCheckBox?.checked && this.hideThreadCheckBox?.checked) {
1094      // @ts-ignore
1095      return fsProcessData.type !== type || fsProcessData.libId !== libId;
1096    }
1097    return false;
1098  }
1099
1100  private updateFunctionData(symbolMap: Map<number, Array<unknown>>, item: unknown, allDur: number): void {
1101    this.fileStatisticsAnalysisFunctionData = [];
1102    symbolMap.forEach((symbolItems, key): void => {
1103      let dur = 0;
1104      let fsSymbolName = '';
1105      for (let symbolItem of symbolItems) {
1106        // @ts-ignore
1107        fsSymbolName = symbolItem.symbolName; // @ts-ignore
1108        dur += symbolItem.dur;
1109      }
1110      let symbolPath = fsSymbolName?.split('/');
1111      if (symbolPath) {
1112        fsSymbolName = symbolPath[symbolPath.length - 1];
1113      }
1114      const symbolData = {
1115        // @ts-ignore
1116        pid: item.pid, // @ts-ignore
1117        type: item.type, // @ts-ignore
1118        tid: item.tid, // @ts-ignore
1119        libId: item.libId,
1120        symbolId: key,
1121        percent: ((dur / allDur) * 100).toFixed(2),
1122        tableName: fsSymbolName,
1123        durFormat: Utils.getProbablyTime(dur),
1124        duration: dur,
1125      };
1126      this.fileStatisticsAnalysisFunctionData.push(symbolData);
1127    });
1128  }
1129
1130  private typeIdToString(transformType: number): string {
1131    let fsReleaseType: string;
1132    if (transformType === 0) {
1133      fsReleaseType = 'OPEN';
1134    } else if (transformType === 2) {
1135      fsReleaseType = 'READ';
1136    } else if (transformType === 3) {
1137      fsReleaseType = 'WRITE';
1138    } else if (transformType === 1) {
1139      fsReleaseType = 'CLOSE';
1140    }
1141    // @ts-ignore
1142    return fsReleaseType;
1143  }
1144
1145  private totalDurationData(durationTS: number): {
1146    durFormat: string;
1147    percent: string;
1148    tableName: string;
1149    duration: number;
1150  } {
1151    return {
1152      durFormat: Utils.getProbablyTime(durationTS),
1153      percent: ((durationTS / durationTS) * 100).toFixed(2),
1154      tableName: '',
1155      duration: 0,
1156    };
1157  }
1158
1159  private getFsPieChartData(fsPieChartData: unknown[]): unknown[] {
1160    if (fsPieChartData.length > 20) {
1161      let fsPieChartArr: string[] = [];
1162      let other: unknown = {
1163        tableName: 'other',
1164        duration: 0,
1165        percent: 0,
1166        durFormat: 0,
1167      };
1168      for (let pieDataIndex = 0; pieDataIndex < fsPieChartData.length; pieDataIndex++) {
1169        if (pieDataIndex < 19) {
1170          // @ts-ignore
1171          fsPieChartArr.push(fsPieChartData[pieDataIndex]);
1172        } else {
1173          // @ts-ignore
1174          other.duration += fsPieChartData[pieDataIndex].duration; // @ts-ignore
1175          other.durFormat = Utils.getProbablyTime(other.duration); // @ts-ignore
1176          other.percent = ((other.duration / this.sumDur) * 100).toFixed(2);
1177        }
1178      } // @ts-ignore
1179      fsPieChartArr.push(other);
1180      return fsPieChartArr;
1181    }
1182    return fsPieChartData;
1183  }
1184
1185  private getDataByWorker(args: unknown[], handler: Function): void {
1186    procedurePool.submitWithName(
1187      'logic0',
1188      'fileSystem-action',
1189      { args, callType: 'fileSystem', isAnalysis: true },
1190      undefined,
1191      (results: unknown) => {
1192        handler(results);
1193        this.fileStatisticsAnalysisProgressEL!.loading = false;
1194      }
1195    );
1196  }
1197
1198  public connectedCallback(): void {
1199    new ResizeObserver(() => {
1200      if (this.parentElement?.clientHeight !== 0) {
1201        this.fileStatisticsAnalysisTableProcess!.style.height = `${this.parentElement!.clientHeight - 50}px`;
1202        this.fileStatisticsAnalysisTableProcess?.reMeauseHeight();
1203        this.fileStatisticsAnalysisTableThread!.style.height = `${this.parentElement!.clientHeight - 50}px`;
1204        this.fileStatisticsAnalysisTableThread?.reMeauseHeight();
1205        this.fileStatisticsAnalysisTableSo!.style.height = `${this.parentElement!.clientHeight - 50}px`;
1206        this.fileStatisticsAnalysisTableSo?.reMeauseHeight();
1207        this.fileStatisticsAnalysisTableFunction!.style.height = `${this.parentElement!.clientHeight - 50}px`;
1208        this.fileStatisticsAnalysisTableFunction?.reMeauseHeight();
1209        this.fileStatisticsAnalysisTableType!.style.height = `${this.parentElement!.clientHeight - 50}px`;
1210        this.fileStatisticsAnalysisTableType?.reMeauseHeight();
1211        if (this.parentElement!.clientHeight >= 0 && this.parentElement!.clientHeight <= 31) {
1212          this.fileSystemFilterEl!.style.display = 'none';
1213        } else {
1214          this.fileSystemFilterEl!.style.display = 'flex';
1215        }
1216      }
1217    }).observe(this.parentElement!);
1218  }
1219
1220  initHtml(): string {
1221    return TabPaneFilesystemStatisticsAnalysisHtml;
1222  }
1223}
1224