Optimize the output of log and stat
This commit is contained in:
@@ -63,6 +63,17 @@ static int all_session_have_freed(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int all_stat_have_output(void)
|
||||
{
|
||||
static int count = 0;
|
||||
if (runtime->stat_last_output_ts == stellar_get_monotonic_time_msec())
|
||||
{
|
||||
count++;
|
||||
}
|
||||
|
||||
return count == 2;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
stellar_update_time_cache();
|
||||
@@ -138,8 +149,9 @@ int 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())
|
||||
if (packet_io_wait_exit(runtime->packet_io) && all_session_have_freed() && all_stat_have_output())
|
||||
{
|
||||
STELLAR_LOG_STATE("all sessions have been released and all stat have been output, notify threads to exit !!!");
|
||||
ATOMIC_SET(&runtime->need_exit, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user