• 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 */
15import {query} from "../SqlLite";
16import {CounterStruct} from "../ui-worker/ProduceWorkerSdkCounter";
17import {CounterSummary, SdkSliceSummary} from "../../bean/SdkSummary";
18import {SdkSliceStruct} from "../ui-worker/ProduceWorkerSdkSlice";
19
20export const querySdkCount = (sql: string, componentId: number, args?: any): Promise<Array<any>> =>
21  query('querySdkCount', sql, args, 'exec-sdk-' + componentId);
22
23export const querySdkCounterData = (
24  sql: string,
25  counter_id: number,
26  componentId: number
27): Promise<Array<CounterStruct>> =>
28  query('querySdkCounterData', sql, { $counter_id: counter_id }, 'exec-sdk-' + componentId);
29
30export const getTabSdkCounterData = (
31  sqlStr: string,
32  startTime: number,
33  leftNs: number,
34  rightNs: number,
35  counters: Array<string>,
36  componentId: number
37): Promise<Array<CounterSummary>> =>
38  query<CounterSummary>(
39    'getTabSdkCounterData',
40    sqlStr,
41    {
42      $startTime: startTime,
43      $leftNs: leftNs,
44      $rightNs: rightNs,
45      $counters: counters,
46    },
47    'exec-sdk-' + componentId
48  );
49
50export const getTabSdkCounterLeftData = (
51  sqlStr: string,
52  leftNs: number,
53  counters: Array<string>,
54  componentId: number
55): Promise<Array<any>> =>
56  query<any>(
57    'getTabSdkCounterLeftData',
58    sqlStr,
59    {
60      $leftNs: leftNs,
61      $counters: counters,
62    },
63    'exec-sdk-' + componentId
64  );
65
66export const getTabSdkSliceData = (
67  sqlStr: string,
68  startTime: number,
69  leftNs: number,
70  rightNs: number,
71  slices: Array<string>,
72  componentId: number
73): Promise<Array<SdkSliceSummary>> =>
74  query<SdkSliceSummary>(
75    'getTabSdkSliceData',
76    sqlStr,
77    {
78      $startTime: startTime,
79      $leftNs: leftNs,
80      $rightNs: rightNs,
81      $slices: slices,
82    },
83    'exec-sdk-' + componentId
84  );
85
86export const querySdkSliceData = (
87  sqlStr: string,
88  column_id: number,
89  startNS: number,
90  endNS: number,
91  componentId: number
92): Promise<Array<SdkSliceStruct>> =>
93  query(
94    'querySdkSliceData',
95    sqlStr,
96    { $column_id: column_id, $startNS: startNS, $endNS: endNS },
97    'exec-sdk-' + componentId
98  );
99export const queryCounterMax = (sqlStr: string, counter_id: number, componentId: number): Promise<Array<any>> =>
100  query('queryCounterMax', sqlStr, { $counter_id: counter_id }, 'exec-sdk-' + componentId);
101