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 { query } from '../SqlLite'; 17import { CounterStruct } from '../ui-worker/ProduceWorkerSdkCounter'; 18import { CounterSummary, SdkSliceSummary } from '../../bean/SdkSummary'; 19import { SdkSliceStruct } from '../ui-worker/ProduceWorkerSdkSlice'; 20 21//@ts-ignore 22export const querySdkCount = (sql: string, componentId: number, args?: unknown): Promise<Array<unknown>> => 23 query('querySdkCount', sql, args, { 24 action: `exec-sdk-${componentId}` 25 }); 26 27export const querySdkCounterData = ( 28 sql: string, 29 counter_id: number, 30 componentId: number 31): Promise<Array<CounterStruct>> => 32 query('querySdkCounterData', sql, { $counter_id: counter_id }, { 33 action: `exec-sdk-${componentId}` 34 }); 35 36export const getTabSdkCounterData = ( 37 sqlStr: string, 38 startTime: number, 39 leftNs: number, 40 rightNs: number, 41 counters: Array<string>, 42 componentId: number 43): Promise<Array<CounterSummary>> => 44 query<CounterSummary>( 45 'getTabSdkCounterData', 46 sqlStr, 47 { 48 $startTime: startTime, 49 $leftNs: leftNs, 50 $rightNs: rightNs, 51 $counters: counters, 52 }, 53 { 54 action: `exec-sdk-${componentId}` 55 } 56 ); 57 58export const getTabSdkCounterLeftData = ( 59 sqlStr: string, 60 leftNs: number, 61 counters: Array<string>, 62 componentId: number 63): //@ts-ignore 64Promise<Array<unknown>> => 65 //@ts-ignore 66 query<unknown>( 67 'getTabSdkCounterLeftData', 68 sqlStr, 69 { 70 $leftNs: leftNs, 71 $counters: counters, 72 }, 73 { 74 action: `exec-sdk-${componentId}` 75 } 76 ); 77 78export const getTabSdkSliceData = ( 79 sqlStr: string, 80 startTime: number, 81 leftNs: number, 82 rightNs: number, 83 slices: Array<string>, 84 componentId: number 85): Promise<Array<SdkSliceSummary>> => 86 query<SdkSliceSummary>( 87 'getTabSdkSliceData', 88 sqlStr, 89 { 90 $startTime: startTime, 91 $leftNs: leftNs, 92 $rightNs: rightNs, 93 $slices: slices, 94 }, 95 { 96 action: `exec-sdk-${componentId}` 97 } 98 ); 99 100export const querySdkSliceData = ( 101 sqlStr: string, 102 column_id: number, 103 startNS: number, 104 endNS: number, 105 componentId: number 106): Promise<Array<SdkSliceStruct>> => 107 query( 108 'querySdkSliceData', 109 sqlStr, 110 { $column_id: column_id, $startNS: startNS, $endNS: endNS }, 111 { 112 action: `exec-sdk-${componentId}` 113 } 114 ); 115 116export const queryCounterMax = ( 117 sqlStr: string, 118 counter_id: number, 119 componentId: number 120): //@ts-ignore 121Promise<Array<unknown>> => 122 query('queryCounterMax', sqlStr, { $counter_id: counter_id }, { 123 action: `exec-sdk-${componentId}` 124 }); 125 126