refactor: move times API to utils.h
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "log.h"
|
||||
#include "logo.h"
|
||||
#include "times.h"
|
||||
#include "utils.h"
|
||||
#include "packet_io.h"
|
||||
#include "packet_def.h"
|
||||
#include "packet_utils.h"
|
||||
@@ -209,7 +209,7 @@ static void *work_thread(void *arg)
|
||||
* Note: Modifying the system time will affect the timing wheel, impacting session expiration, IP reassembly expiration, and TCP reassembly expiration.
|
||||
* Suggestion: After modifying the system time, restart the service to ensure consistent timing.
|
||||
*/
|
||||
now_ms = stellar_get_real_time_msec();
|
||||
now_ms = clock_get_real_time_ms();
|
||||
nr_recv = packet_io_ingress(packet_io, thr_idx, packets, RX_BURST_MAX);
|
||||
if (nr_recv == 0)
|
||||
{
|
||||
@@ -398,7 +398,7 @@ static int all_session_have_freed(struct stellar_runtime *runtime, struct stella
|
||||
|
||||
static int stellar_thread_init(struct stellar_runtime *runtime, struct stellar_config *config)
|
||||
{
|
||||
uint64_t now_ms = stellar_get_real_time_msec();
|
||||
uint64_t now_ms = clock_get_real_time_ms();
|
||||
for (uint16_t i = 0; i < config->pkt_io_opts.nr_threads; i++)
|
||||
{
|
||||
struct stellar_thread *thread = &runtime->threads[i];
|
||||
@@ -543,12 +543,12 @@ int stellar_run(int argc __attribute__((unused)), char **argv __attribute__((unu
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
runtime->stat_last_output_ts = stellar_get_real_time_msec();
|
||||
runtime->stat_last_output_ts = clock_get_real_time_ms();
|
||||
while (!ATOMIC_READ(&need_exit))
|
||||
{
|
||||
if (stellar_get_real_time_msec() - runtime->stat_last_output_ts > config->sched_opts.output_stat_interval)
|
||||
if (clock_get_real_time_ms() - runtime->stat_last_output_ts > config->sched_opts.output_stat_interval)
|
||||
{
|
||||
runtime->stat_last_output_ts = stellar_get_real_time_msec();
|
||||
runtime->stat_last_output_ts = clock_get_real_time_ms();
|
||||
stellar_stat_output(runtime->stat);
|
||||
}
|
||||
usleep(1000); // 1ms
|
||||
|
||||
Reference in New Issue
Block a user