Commit 368c430e authored by Andreas Schmidt's avatar Andreas Schmidt

Time sender payload size is now configurable.

parent 269d70ba
Pipeline #2085 failed with stages
in 22 seconds
...@@ -13,6 +13,7 @@ static struct argp_option options[] = { ...@@ -13,6 +13,7 @@ static struct argp_option options[] = {
{"port", 'p', "PORT", 0, "Target Port" }, {"port", 'p', "PORT", 0, "Target Port" },
{"local port", 'l', "PORT", 0, "Local Port" }, {"local port", 'l', "PORT", 0, "Local Port" },
{"rounds", 'r', "ROUNDS", 0, "Rounds" }, {"rounds", 'r', "ROUNDS", 0, "Rounds" },
{"size", 's', "SIZE", 0, "Size" },
{"output", 'o', "FILE", 0, "Output to FILE instead of standard output" }, {"output", 'o', "FILE", 0, "Output to FILE instead of standard output" },
{"threadpinning", 'T', 0, 0, "Enable thread pinning"}, {"threadpinning", 'T', 0, 0, "Enable thread pinning"},
{"pacing", 'P', 0, 0, "Enable pacing"}, {"pacing", 'P', 0, 0, "Enable pacing"},
...@@ -25,6 +26,7 @@ static struct arguments ...@@ -25,6 +26,7 @@ static struct arguments
uint16_t port; uint16_t port;
uint16_t local_port; uint16_t local_port;
uint16_t rounds; uint16_t rounds;
uint16_t size;
char* outfile; char* outfile;
bool thread_pinning; bool thread_pinning;
bool pacing; bool pacing;
...@@ -45,6 +47,9 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state) ...@@ -45,6 +47,9 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state)
case 'p': case 'p':
arguments->port = (uint16_t) strtol(arg, &pEnd, 10); arguments->port = (uint16_t) strtol(arg, &pEnd, 10);
break; break;
case 's':
arguments->size = (uint16_t) strtol(arg, &pEnd, 10);
break;
case 'P': case 'P':
arguments->pacing = true; arguments->pacing = true;
break; break;
...@@ -77,6 +82,7 @@ int main(int argc, char **argv) { ...@@ -77,6 +82,7 @@ int main(int argc, char **argv) {
.target = "127.0.0.1", .target = "127.0.0.1",
.port = 5000, .port = 5000,
.local_port = 6000, .local_port = 6000,
.size = 1500,
.rounds = 127, .rounds = 127,
.pacing = false, .pacing = false,
.outfile = "-", .outfile = "-",
...@@ -125,9 +131,9 @@ int main(int argc, char **argv) { ...@@ -125,9 +131,9 @@ int main(int argc, char **argv) {
XlapTimestampTableInstall(s, ts_redundancy_packet, tstable_redundancy); XlapTimestampTableInstall(s, ts_redundancy_packet, tstable_redundancy);
uint32_t j = 0; uint32_t j = 0;
char buf[6250]; uint16_t buffer_size = arguments.size;
memset(buf, 0x0, sizeof(buf)); char* buf = calloc(buffer_size, sizeof(char));
assert(sizeof(buf) >= sizeof(struct timespec)); assert(sizeof(buf) >= 2* sizeof(struct timespec) + 20);
while (j < rounds) { while (j < rounds) {
struct timespec now; struct timespec now;
clock_gettime(CLOCK_REALTIME, &now); clock_gettime(CLOCK_REALTIME, &now);
...@@ -137,8 +143,6 @@ int main(int argc, char **argv) { ...@@ -137,8 +143,6 @@ int main(int argc, char **argv) {
PrrtSocket_send(s, (unsigned char *) buf, sizeof(buf)); PrrtSocket_send(s, (unsigned char *) buf, sizeof(buf));
j++; j++;
// Send every 100us, as this is a sensible packet interval.
//usleep_nano(100);
} }
sleep_nano(10); sleep_nano(10);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment