Skip to content

Commit

Permalink
Merge pull request #66 from pengjianzhang/main
Browse files Browse the repository at this point in the history
FIX: divide by zero
  • Loading branch information
pengjianzhang committed Mar 26, 2022
2 parents 35e3d0d + ca20397 commit 2194dbf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ static void ctl_slow_start(FILE *fp, int *seconds)
int slow_start = g_config.slow_start;

step = (g_config.cps / g_config.cpu_num) / slow_start;
if (step <= 0) {
step = 1;
}

for (i = 1; i <= slow_start; i++) {
cps = step * i;
launch_interval = (g_tsc_per_second / (cps / launch_num));
launch_interval = (g_tsc_per_second * launch_num) / cps;
work_space_set_launch_interval(launch_interval);
sleep(1);
net_stats_print_speed(fp, (*seconds)++);
Expand Down

0 comments on commit 2194dbf

Please sign in to comment.