Skip to content

Commit 32fca4a

Browse files
committed
Resolving serial timing errors
Small timing errors with INSERT and DELETE
1 parent 9b3371e commit 32fca4a

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

connectEngine.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,13 @@ void run_test_query(struct engineS *engine, const char *query, int max_rows) {
177177

178178
// Execute Insert
179179
clock_t insertStart = clock(); // Start timer for benchmarking
180-
if (executeQueryInsertSerial(engine, parsed.table, &r)) {
181-
printf("Insert successful. Execution Time: %ld\n\n", (clock() - insertStart) / CLOCKS_PER_SEC);
180+
bool success = executeQueryInsertSerial(engine, parsed.table, &r);
181+
double timeTaken = (double)(clock() - insertStart) / CLOCKS_PER_SEC;
182+
183+
if (success) {
184+
printf("Insert successful. Execution Time: %.6f\n\n", timeTaken);
182185
} else {
183-
printf("Insert failed. Execution Time: %ld\n\n", (clock() - insertStart) / CLOCKS_PER_SEC);
186+
printf("Insert failed. Execution Time: %.6f\n\n", timeTaken);
184187
}
185188

186189
return;
@@ -193,12 +196,13 @@ void run_test_query(struct engineS *engine, const char *query, int max_rows) {
193196
// Execute delete
194197
clock_t deleteStart = clock(); // Start timer for benchmarking
195198
struct resultSetS *result = executeQueryDeleteSerial(engine, parsed.table, whereClause);
199+
double timeTaken = (double)(clock() - deleteStart) / CLOCKS_PER_SEC;
196200

197201
if (result) {
198-
printf("Delete successful. Rows affected: %d. Execution Time: %ld\n\n", result->numRecords, ((clock() - deleteStart) / CLOCKS_PER_SEC));
202+
printf("Delete successful. Rows affected: %d. Execution Time: %.6f\n\n", result->numRecords, timeTaken);
199203
freeResultSet(result);
200204
} else {
201-
printf("Delete failed. Execution Time: %ld\n\n", ((clock() - deleteStart) / CLOCKS_PER_SEC));
205+
printf("Delete failed. Execution Time: %.6f\n\n", timeTaken);
202206
}
203207

204208
free_where_clause_list(whereClause);

docs/schema.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ There should be minimal default row indexes, as each one will require a seperate
3131

3232
## Generation
3333

34-
Acheived via `generate_commands.py`. Will use some C-level ML to dynamically assign risk level at runtime at later phases.
34+
Acheived via `generate_commands.py`. Could use some C-level ML to dynamically assign risk level at runtime at later phases.

0 commit comments

Comments
 (0)