25#include <zephyr/kernel.h>
28#include "posix_native_task.h"
30#include "bsim_args_runner.h"
36#include "../bluesync_bitfields.h"
38#include <zephyr/logging/log.h>
44#define SEPARATION_TOKEN ";"
69 packet_status->
valid);
82 for (
size_t i = 0; i < size; i++) {
87 .estimation_master_ticks = elem_slave->remote_est_ticks[i],
96static FILE *
open_stat(
char *filename, uint32_t device_number)
99 static char path[250];
100 memset(path, 0,
sizeof(path));
102 snprintf(path,
sizeof(path) - 1,
103 "%s%s_%i.csv", CONFIG_BLUESYNC_TEST_BABBLESIM_PATH, filename,
106 fp = fopen(path,
"w");
107 __ASSERT(fp != NULL,
"Cannot open file");
116 uint32_t device_number = bsim_args_get_global_device_nbr();
void bitwise_and_bitfields(uint8_t *result, const bluesync_timestamps_t *rcv, const bluesync_timestamps_t *local, size_t num_bytes)
Perform a bitwise AND between two bitfields and store the result.
bool is_bit_set(uint8_t *bitfield, size_t bit_index)
Check if a specific bit is set in the bitfield.
static struct node_stat node
static FILE * open_stat(char *filename, uint32_t device_number)
LOG_MODULE_REGISTER(bluesync_statistic_bsim, CONFIG_BLUESYNC_LOG_LEVEL)
void bluesync_statistic_init()
Initialize the BlueSync statistics module.
NATIVE_TASK(bluesync_statistic_init, BOOT, 101)
void bluesync_statistic_deinit()
Deinitialize the BlueSync statistics module.
void bluesync_statistic_packet_status(struct bluesync_msg_client_statistic *packet_status)
void statistic_bluesync_status(bluesync_timestamps_t *elem_master, bluesync_timestamps_t *elem_slave, size_t size)
Analyze and log synchronization statistics based on a series of timestamps.
#define NB_BYTES_BITFIELD
uint64_t estimation_master_ticks
uint64_t master_timer_ticks
uint64_t client_timer_ticks
uint64_t timer_ticks[SLOT_NUMBER]
void synced_time_logger_deinit()
Deinitialize the timer that store regularly timestamp of the node.
void synced_time_logger_init()
Initialize the timer that store regularly timestamp of the node.