Skip to content

Commit

Permalink
results: implement elapsed time (#116)
Browse files Browse the repository at this point in the history
results: implement elapsed time
  • Loading branch information
joacoc authored Oct 26, 2023
1 parent d9d4b2a commit 21c212a
Show file tree
Hide file tree
Showing 2 changed files with 189 additions and 158 deletions.
9 changes: 5 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ export function activate(vsContext: vscode.ExtensionContext) {
const id = randomUUID();
context.emit("event", { type: EventType.newQuery, data: { id } });

// Benchmark
const startTime = Date.now();
try {
// Benchmark
const startTime = Date.now();
const results = await context.query(query);
const endTime = Date.now();

const elapsedTime = endTime - startTime;

console.log("[RunSQLCommand]", "Results: ", results);
Expand All @@ -80,12 +79,14 @@ export function activate(vsContext: vscode.ExtensionContext) {
} catch (error: any) {
console.log("[RunSQLCommand]", error.toString());
console.log("[RunSQLCommand]", JSON.stringify(error));
const endTime = Date.now();
const elapsedTime = endTime - startTime;

context.emit("event", { type: EventType.queryResults, data: { id, rows: [], fields: [], error: {
message: error.toString(),
position: error.position,
query,
}}});
}, elapsedTime }});
} finally {
resultsProvider._view?.show();
}
Expand Down
Loading

0 comments on commit 21c212a

Please sign in to comment.