1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

examples/benchmark_udp: add example for UDP benchmark

This commit is contained in:
Benjamin Valentin 2021-08-26 19:19:18 +02:00
parent 1bc6b7eec7
commit f3aee01e29
4 changed files with 169 additions and 0 deletions

View File

@ -0,0 +1,53 @@
# name of your application
APPLICATION = benchmark_udp
# If no BOARD is found in the environment, use this default:
BOARD ?= native
# This has to be the absolute path to the RIOT base directory:
RIOTBASE ?= $(CURDIR)/../..
# use GNRC by default
LWIP ?= 0
# Include packages that pull up and auto-init the link layer.
# NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present
ifeq (0,$(LWIP))
USEMODULE += auto_init_gnrc_netif
USEMODULE += gnrc_ipv6_default
USEMODULE += gnrc_netdev_default
else
USEMODULE += lwip_ipv6
USEMODULE += lwip_netdev
USEMODULE += netdev_default
endif
# Add also the shell, some shell commands
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps
USEMODULE += netstats_l2
USEMODULE += netstats_ipv6
# Add the benchmark module
USEMODULE += benchmark_udp
# Uncomment this to automatically start sending packets to a pre-defined
# benchmark server
#
# USEMODULE += auto_init_benchmark_udp
# CFLAGS += -DBENCH_SERVER_DEFAULT=\"fd00:dead:beef::1\"
# CFLAGS += -DBENCH_PORT_DEFAULT=12345
# Comment this out to disable code in RIOT that does safety checking
# which is not needed in a production environment but helps in the
# development process:
DEVELHELP ?= 0
# Change this to 0 show compiler invocation lines by default:
QUIET ?= 1
include $(RIOTBASE)/Makefile.include
# Set a custom channel if needed
include $(RIOTMAKE)/default-radio-settings.inc.mk

View File

@ -0,0 +1,40 @@
BOARD_INSUFFICIENT_MEMORY := \
arduino-duemilanove \
arduino-leonardo \
arduino-mega2560 \
arduino-nano \
arduino-uno \
atmega1284p \
atmega328p \
atmega328p-xplained-mini \
atxmega-a1u-xpro \
atxmega-a3bu-xplained \
bluepill-stm32f030c8 \
derfmega128 \
i-nucleo-lrwan1 \
ict_panhead \
im880b \
m1284p \
mega-xplained \
microduino-corerf \
msb-430 \
msb-430h \
nucleo-f030r8 \
nucleo-f031k6 \
nucleo-f042k6 \
nucleo-f303k8 \
nucleo-f334r8 \
nucleo-l011k4 \
nucleo-l031k6 \
nucleo-l053r8 \
samd10-xmini \
slstk3400a \
stk3200 \
stm32f030f4-demo \
stm32f0discovery \
stm32l0538-disco \
telosb \
waspmote-pro \
z1 \
zigduino \
#

View File

@ -0,0 +1,41 @@
# UDP Benchmark
This example uses the `benchmark_udp` module to create a stress-test for the RIOT
network stack.
This firmware will act as a client and connect to the benchmark server you can find
in `dist/tools/benchmark_udp`.
## Setup on Hardware
Determine the address of your host machine that will communicate with the RIOT node.
This could be the address of your ethernet interface, or `fd00:dead:beef::1` if you
used the `gnrc_border_router` example and want to run the benchmark on a 6LoWPAN node.
You can either start the benchmark manually by using the `bench_udp start` shell command
or you can configure it to start automatically:
USEMODULE += auto_init_benchmark_udp
CFLAGS += -DBENCH_SERVER_DEFAULT=\"fd00:dead:beef::1\"
## Setup on RIOT native
First, make sure you've compiled the application by calling `make`.
Now, create a tap interface:
sudo ip tuntap add tap0 mode tap user ${USER}
sudo ip link set tap0 up
If you only have a single tap device you can just use the broadcast address
bench_udp start ff02::1
Otherwise use the link-local address of the `tapbr0` interface (if you did set up the tap
devices using `tapsetup`.
## Running the benchmark server
To run the benchmark server on your host machine, follow the instructions found in
dist/tools/benchmark_udp

View File

@ -0,0 +1,35 @@
/*
* Copyright (C) 2021 ML!PA Consulting GmbH
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup examples
* @{
*
* @file
* @brief Example application for exercising the RIOT network stack
*
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
*
* @}
*/
#include <stdio.h>
#include "shell.h"
int main(void)
{
puts("RIOT UDP stress-test application");
/* start shell */
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, sizeof(line_buf));
/* should be never reached */
return 0;
}