2019-09-24 13:37:12 +00:00
|
|
|
#pragma once
|
2019-09-23 14:32:59 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "utils.h"
|
|
|
|
|
|
|
|
struct measure_conf {
|
|
|
|
uint64_t max_measure;
|
|
|
|
uint64_t payload_size;
|
|
|
|
uint64_t interval;
|
|
|
|
char* payload;
|
|
|
|
uint64_t counter;
|
2019-09-24 13:37:12 +00:00
|
|
|
uint8_t is_server, is_rtt;
|
2019-09-23 14:32:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct measure_packet {
|
|
|
|
uint64_t counter;
|
2019-09-24 13:37:12 +00:00
|
|
|
uint8_t is_echo;
|
2019-09-23 14:32:59 +00:00
|
|
|
struct timespec emit_time;
|
|
|
|
};
|
|
|
|
|
|
|
|
void measure_parse(int size, struct measure_conf* mc);
|
|
|
|
void measure_prepare(struct measure_conf* mc);
|
2019-09-24 13:37:12 +00:00
|
|
|
struct measure_packet* measure_generate(struct measure_conf* mc);
|
|
|
|
uint8_t measure_need_reply(struct measure_conf* mc);
|
|
|
|
void measure_next_tick(struct measure_conf *mc, struct timespec *next);
|