Skip to content

Commit

Permalink
123
Browse files Browse the repository at this point in the history
  • Loading branch information
paranoidFrappe committed Jun 22, 2023
1 parent 805be45 commit 6e50ce7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
11 changes: 8 additions & 3 deletions backend/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions frontend/components/views/QueryView/QuerySummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion frontend/lib/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
};

Expand Down
9 changes: 5 additions & 4 deletions frontend/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
///////////////////////////////////////////////////////////////////////////
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6e50ce7

Please sign in to comment.