In packet I/O dump file mode, force refresh stat before program exit
This commit is contained in:
@@ -327,17 +327,6 @@ static int all_session_have_freed(struct stellar_runtime *runtime, struct stella
|
|||||||
return 1;
|
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)
|
static int stellar_thread_init(struct stellar_runtime *runtime, struct stellar_config *config)
|
||||||
{
|
{
|
||||||
uint64_t now = stellar_get_monotonic_time_msec();
|
uint64_t now = stellar_get_monotonic_time_msec();
|
||||||
@@ -487,10 +476,11 @@ int stellar_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
usleep(1000); // 1ms
|
usleep(1000); // 1ms
|
||||||
|
|
||||||
// Only available in dump file mode, automatically exits when all sessions have been released
|
// 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))
|
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);
|
ATOMIC_SET(&need_exit, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user