static inline void report_progress()

in src/util.h [37:58]


static inline void report_progress(struct lagscope_test_runtime *test_runtime)
{
	/*
	 * Only report progress once in every lazy_prog_report_factor of pings
	 * (try to increase ~1%, by estimation)
	 */
	if (test_runtime->ping_elapsed % test_runtime->lazy_prog_report_factor != 0)
		return;

	if (test_runtime->test->test_mode == PING_ITERATION) {
		printf("%s: %lu%% completed.\r",
		test_runtime->test->bind_address,
		test_runtime->ping_elapsed * 100 / test_runtime->test->iteration);
	}
	else {
		double time_elapsed = test_runtime->current_time - test_runtime->start_time;
		printf("%s: %.0f%% completed.\r",
		test_runtime->test->bind_address,
		time_elapsed / 10000 / test_runtime->test->duration);
	}
	fflush(stdout);
}