diff --git a/src/stellar/stellar.cpp b/src/stellar/stellar.cpp index 21e9959..be2a3a4 100644 --- a/src/stellar/stellar.cpp +++ b/src/stellar/stellar.cpp @@ -327,17 +327,6 @@ static int all_session_have_freed(struct stellar_runtime *runtime, struct stella return 1; } -static int all_stat_have_output(struct stellar_runtime *runtime, struct stellar_config *config) -{ - static int count = 0; - if (runtime->stat_last_output_ts == stellar_get_monotonic_time_msec()) - { - count++; - } - - return count == 2; -} - static int stellar_thread_init(struct stellar_runtime *runtime, struct stellar_config *config) { uint64_t now = stellar_get_monotonic_time_msec(); @@ -487,10 +476,11 @@ int stellar_main(int argc, char **argv) } usleep(1000); // 1ms - // Only available in dump file mode, automatically exits when all sessions have been released - if (packet_io_wait_exit(runtime->packet_io) && all_session_have_freed(runtime, config) && all_stat_have_output(runtime, config)) + // only available in dump file mode, automatically exits when all sessions have been released + if (packet_io_wait_exit(runtime->packet_io) && all_session_have_freed(runtime, config)) { - STELLAR_LOG_STATE("all sessions have been released and all stat have been output, notify threads to exit !!!"); + stellar_stat_output(runtime->stat); // flush stat + STELLAR_LOG_STATE("all sessions have been released, notify threads to exit !!!"); ATOMIC_SET(&need_exit, 1); } }