Skip to content

Commit

Permalink
fix: zero div
Browse files Browse the repository at this point in the history
  • Loading branch information
DuanKuanJun committed Jun 1, 2024
1 parent 1398ccc commit 4eb2937
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/benchInsert.c
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ static int createChildTables() {
"start creating %" PRId64 " table(s) with %d thread(s)\n",
g_arguments->totalChildTables, g_arguments->table_threads);
}
double start = (double)toolsGetTimestampMs();
int64_t start = (double)toolsGetTimestampMs();

for (int i = 0; (i < g_arguments->databases->size
&& !g_arguments->terminate); i++) {
Expand Down Expand Up @@ -1120,16 +1120,19 @@ static int createChildTables() {
}
}

double end = (double)toolsGetTimestampMs();
int64_t end = toolsGetTimestampMs();
if(end == start) {
end += 1;
}
succPrint(
"Spent %.4f seconds to create %" PRId64
" table(s) with %d thread(s) speed: %.0f tables/s, already exist %" PRId64
" table(s), actual %" PRId64 " table(s) pre created, %" PRId64
" table(s) will be auto created\n",
(end - start) / 1000.0,
(float)(end - start) / 1000.0,
g_arguments->totalChildTables,
g_arguments->table_threads,
g_arguments->actualChildTables * 1000 / (end - start),
g_arguments->actualChildTables * 1000 / (float)(end - start),
g_arguments->existedChildTables,
g_arguments->actualChildTables,
g_arguments->autoCreatedChildTables);
Expand Down

0 comments on commit 4eb2937

Please sign in to comment.