stellar support monotonic time and real time
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
add_library(core config.cpp stat.cpp stellar.cpp inject.cpp)
|
||||
target_link_libraries(core timestamp plugin_manager session_manager ip_reassembly packet_io pthread fieldstat4 toml)
|
||||
target_link_libraries(core times plugin_manager session_manager ip_reassembly packet_io pthread fieldstat4 toml)
|
||||
|
||||
add_executable(stellar main.cpp)
|
||||
target_link_libraries(stellar core plugin_manager)
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "logo.h"
|
||||
#include "times.h"
|
||||
#include "config.h"
|
||||
#include "timestamp.h"
|
||||
#include "id_generator.h"
|
||||
#include "stellar_priv.h"
|
||||
|
||||
@@ -65,7 +65,7 @@ static int all_session_have_freed(void)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
timestamp_update();
|
||||
stellar_update_time_cache();
|
||||
|
||||
signal(SIGINT, signal_handler);
|
||||
signal(SIGQUIT, signal_handler);
|
||||
@@ -126,13 +126,13 @@ int main(int argc, char **argv)
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
runtime->stat_last_output_ts = timestamp_get_msec();
|
||||
runtime->stat_last_output_ts = stellar_get_monotonic_time_msec();
|
||||
while (!ATOMIC_READ(&runtime->need_exit))
|
||||
{
|
||||
timestamp_update();
|
||||
if (timestamp_get_msec() - runtime->stat_last_output_ts > 2000)
|
||||
stellar_update_time_cache();
|
||||
if (stellar_get_monotonic_time_msec() - runtime->stat_last_output_ts > 2000)
|
||||
{
|
||||
runtime->stat_last_output_ts = timestamp_get_msec();
|
||||
runtime->stat_last_output_ts = stellar_get_monotonic_time_msec();
|
||||
stellar_stat_output(runtime->stat);
|
||||
}
|
||||
usleep(1000); // 1ms
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include <pthread.h>
|
||||
#include <sys/prctl.h>
|
||||
|
||||
#include "times.h"
|
||||
#include "config.h"
|
||||
#include "timestamp.h"
|
||||
#include "stellar_priv.h"
|
||||
|
||||
struct stellar_runtime __runtime = {0};
|
||||
@@ -122,7 +122,7 @@ static void *work_thread(void *arg)
|
||||
|
||||
while (ATOMIC_READ(&runtime->need_exit) == 0)
|
||||
{
|
||||
now = timestamp_get_msec();
|
||||
now = stellar_get_monotonic_time_msec();
|
||||
memset(packets, 0, sizeof(packets));
|
||||
nr_recv = packet_io_ingress(packet_io, thr_idx, packets, RX_BURST_MAX);
|
||||
if (nr_recv == 0)
|
||||
@@ -247,7 +247,7 @@ void stellar_set_current_thread_index(uint16_t idx)
|
||||
|
||||
int stellar_thread_init(struct stellar_runtime *runtime, struct stellar_config *config)
|
||||
{
|
||||
uint64_t now = timestamp_get_msec();
|
||||
uint64_t now = stellar_get_monotonic_time_msec();
|
||||
for (uint16_t i = 0; i < config->io_opts.nr_threads; i++)
|
||||
{
|
||||
struct stellar_thread *thread = &runtime->threads[i];
|
||||
|
||||
Reference in New Issue
Block a user