From 6e50ce7c77a394ae8ef584b5bf08f39a7a639d90 Mon Sep 17 00:00:00 2001 From: paranoidFrappe Date: Thu, 22 Jun 2023 08:29:50 -0700 Subject: [PATCH] 123 --- backend/channels.ts | 11 ++++++++--- frontend/components/views/QueryView/QuerySummary.tsx | 12 ++++++------ frontend/lib/queries.ts | 4 +++- frontend/types.ts | 9 +++++---- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/backend/channels.ts b/backend/channels.ts index df3c3d6f..15ace26a 100644 --- a/backend/channels.ts +++ b/backend/channels.ts @@ -502,9 +502,13 @@ ipcMain.handle( } console.log('ericCheck------------------------------------------------------------------ericCheck'); console.log('totalSampleTime------------------------------------------------------------------------------------------totalSampleTime', totalSampleTime); - minmumSampleTime = Math.min(...arr); - maximumSampleTime = Math.max(...arr); - averageSampleTime = totalSampleTime/numberOfSample; + // minmumSampleTime = Math.min(...arr); + // maximumSampleTime = Math.max(...arr); + // averageSampleTime = totalSampleTime/numberOfSample; + minmumSampleTime = Math.round(Math.min(...arr) * 10 ** 5) / 10 ** 5; + maximumSampleTime = Math.round(Math.max(...arr) * 10 ** 5) / 10 ** 5; + averageSampleTime = Math.round((totalSampleTime/numberOfSample) * 10 ** 5) / 10 ** 5; + totalSampleTime = Math.round(totalSampleTime * 10 ** 5) / 10 ** 5; console.log('minmumSampleTime------------------------------------------------------------------------------------------minmumSampleTime', minmumSampleTime); console.log('maximumSampleTime------------------------------------------------------------------------------------------maximumSampleTime', maximumSampleTime); console.log('averageSampleTime------------------------------------------------------------------------------------------averageSampleTime', averageSampleTime); @@ -793,6 +797,7 @@ ipcMain.handle( try { // Generates query from backendObj const query = backendObjToQuery(backendObj, dbType); + console.log('ipcMain-------------------------------------------------------------ipcMain', backendObj); console.log('query=======================================================query', query); // run sql command await db.query('Begin;', null, dbType); diff --git a/frontend/components/views/QueryView/QuerySummary.tsx b/frontend/components/views/QueryView/QuerySummary.tsx index 7abbde59..e4684b33 100644 --- a/frontend/components/views/QueryView/QuerySummary.tsx +++ b/frontend/components/views/QueryView/QuerySummary.tsx @@ -23,13 +23,13 @@ interface QuerySummaryProps { const QuerySummary = ({ executionPlan }: QuerySummaryProps) => { const summaryData = { - 'Planning Time': executionPlan?.['Planning Time'], - 'Execution Time': executionPlan?.['Execution Time'], + // 'Planning Time': executionPlan?.['Planning Time'], + // 'Execution Time': executionPlan?.['Execution Time'], 'Number of Sample': executionPlan?.numberOfSample, - 'Total Sample Time': executionPlan?.totalSampleTime, - 'Minmum Sample Time': executionPlan?.minmumSampleTime, - 'Maximum Sample Time': executionPlan?.maximumSampleTime, - 'Average Sample Time': executionPlan?.averageSampleTime, + 'Total Sample Time': executionPlan?.totalSampleTime + 'ms', + 'Minmum Sample Time': executionPlan?.minmumSampleTime + 'ms', + 'Maximum Sample Time': executionPlan?.maximumSampleTime + 'ms', + 'Average Sample Time': executionPlan?.averageSampleTime + 'ms', }; if (!executionPlan) return null; diff --git a/frontend/lib/queries.ts b/frontend/lib/queries.ts index b42607f7..1d2e45ca 100644 --- a/frontend/lib/queries.ts +++ b/frontend/lib/queries.ts @@ -140,7 +140,9 @@ export const setCompare = ( export const getTotalTime = (query: QueryData | undefined) => { if (!query?.executionPlan) return 0; return ( - query.executionPlan['Execution Time'] + query.executionPlan['Planning Time'] + // query.executionPlan['Execution Time'] + query.executionPlan['Planning Time'] + // eric //////// + query.executionPlan.averageSampleTime ); }; diff --git a/frontend/types.ts b/frontend/types.ts index ebb41a59..13a2dc9b 100644 --- a/frontend/types.ts +++ b/frontend/types.ts @@ -79,10 +79,10 @@ export interface QueryData { /////////////////////////eric////////////////////////////////////////////// numberOfSample: number, - totalSampleTime: number, - minmumSampleTime: number, - maximumSampleTime: number, - averageSampleTime: number, + totalSampleTime: number | string, + minmumSampleTime: number | string, + maximumSampleTime: number | string, + averageSampleTime: number| string, /////////////////////////////////////////////////////////////////////////// } @@ -278,6 +278,7 @@ export type ERTableColumnData = { auto_increment?: boolean; // optional until implemented }; export type DataTypes = 'integer' | 'bigint' | 'varchar' | 'date' | null; +export type DataTypesMySQL = 'int' | 'bigint' | 'varchar' | 'date' | null; export type AddColumnsObjType = { column_name: string | null;