Optimize the output of log and stat
This commit is contained in:
@@ -230,6 +230,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;
|
||||
}
|
||||
|
||||
static void usage(char *cmd)
|
||||
{
|
||||
printf("Usage: %s [options]\n\n", cmd);
|
||||
@@ -449,8 +460,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