tests: app_kernel: Remove unused symbols
Begin cleaning the the app_kernel benchmark project by removing unused symbols. Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
This commit is contained in:
parent
6899c0d73a
commit
56011222a4
14 changed files with 11 additions and 233 deletions
|
@ -12,28 +12,4 @@
|
|||
/* Max size of a message string */
|
||||
#define MAX_MSG 256
|
||||
|
||||
/* flag for performing the Mailbox benchmark */
|
||||
#define MAILBOX_BENCH
|
||||
|
||||
/* flag for performing the Sema benchmark */
|
||||
#define SEMA_BENCH
|
||||
|
||||
/* flag for performing the FIFO benchmark */
|
||||
#define FIFO_BENCH
|
||||
|
||||
/* flag for performing the Mutex benchmark */
|
||||
#define MUTEX_BENCH
|
||||
|
||||
/* flag for performing the Memory Map benchmark */
|
||||
#define MEMMAP_BENCH
|
||||
|
||||
/* flag for performing the Memory Pool benchmark*/
|
||||
#define MEMPOOL_BENCH
|
||||
|
||||
/* flag for performing the Pipes benchmark */
|
||||
#define PIPE_BENCH
|
||||
|
||||
/* flag for performing the Event benchmark */
|
||||
#define EVENT_BENCH
|
||||
|
||||
#endif /* _CONFIG_H */
|
||||
|
|
|
@ -8,12 +8,8 @@
|
|||
|
||||
#include "master.h"
|
||||
|
||||
#ifdef FIFO_BENCH
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Queue transfer speed test
|
||||
*
|
||||
*/
|
||||
void queue_test(void)
|
||||
{
|
||||
|
@ -84,5 +80,3 @@ void queue_test(void)
|
|||
"enqueue 4 bytes in FIFO to a waiting higher priority task",
|
||||
SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
|
||||
}
|
||||
|
||||
#endif /* FIFO_BENCH */
|
||||
|
|
|
@ -9,13 +9,10 @@
|
|||
#include "receiver.h"
|
||||
#include "master.h"
|
||||
|
||||
#ifdef FIFO_BENCH
|
||||
|
||||
/* queue transfer speed test */
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Data receive task
|
||||
*
|
||||
*/
|
||||
void dequtask(void)
|
||||
{
|
||||
|
@ -29,6 +26,3 @@ void dequtask(void)
|
|||
k_msgq_get(&DEMOQX4, &x, K_FOREVER);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif /* FIFO_BENCH */
|
||||
|
|
|
@ -8,31 +8,8 @@
|
|||
|
||||
#include "master.h"
|
||||
|
||||
#ifdef MAILBOX_BENCH
|
||||
|
||||
static struct k_mbox_msg message;
|
||||
|
||||
#ifdef FLOAT
|
||||
#define PRINT_HEADER() \
|
||||
(PRINT_STRING \
|
||||
("| size(B) | time/packet (usec) | MB/sec" \
|
||||
" |\n"))
|
||||
#define PRINT_ONE_RESULT() \
|
||||
PRINT_F("|%11u|%32.3f|%32f|\n", putsize, puttime / 1000.0, \
|
||||
(1000.0 * putsize) / SAFE_DIVISOR(puttime))
|
||||
|
||||
#define PRINT_OVERHEAD() \
|
||||
PRINT_F("| message overhead: %10.3f usec/packet " \
|
||||
" |\n", empty_msg_put_time / 1000.0)
|
||||
|
||||
#define PRINT_XFER_RATE() \
|
||||
double netto_transfer_rate; \
|
||||
netto_transfer_rate = 1000.0 * \
|
||||
(putsize >> 1) / SAFE_DIVISOR(puttime - empty_msg_put_time); \
|
||||
PRINT_F("| raw transfer rate: %10.3f MB/sec (without" \
|
||||
" overhead) |\n", netto_transfer_rate)
|
||||
|
||||
#else
|
||||
#define PRINT_HEADER() \
|
||||
(PRINT_STRING \
|
||||
("| size(B) | time/packet (nsec) | KB/sec" \
|
||||
|
@ -53,9 +30,6 @@ static struct k_mbox_msg message;
|
|||
(uint32_t)((uint64_t)(putsize >> 1) * 1000000U / \
|
||||
SAFE_DIVISOR(puttime - empty_msg_put_time)))
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Function prototypes.
|
||||
*/
|
||||
|
@ -66,9 +40,7 @@ void mailbox_put(uint32_t size, int count, uint32_t *time);
|
|||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Mailbox transfer speed test
|
||||
*
|
||||
*/
|
||||
void mailbox_test(void)
|
||||
{
|
||||
|
@ -115,13 +87,11 @@ void mailbox_test(void)
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Write the number of data chunks into the mailbox
|
||||
*
|
||||
* @param size The size of the data chunk.
|
||||
* @param count Number of data chunks.
|
||||
* @param time The total time.
|
||||
*
|
||||
*/
|
||||
void mailbox_put(uint32_t size, int count, uint32_t *time)
|
||||
{
|
||||
|
@ -141,5 +111,3 @@ void mailbox_put(uint32_t size, int count, uint32_t *time)
|
|||
*time = SYS_CLOCK_HW_CYCLES_TO_NS_AVG(t, count);
|
||||
check_result();
|
||||
}
|
||||
|
||||
#endif /* MAILBOX_BENCH */
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
#include "receiver.h"
|
||||
#include "master.h"
|
||||
|
||||
#ifdef MAILBOX_BENCH
|
||||
|
||||
/*
|
||||
* Function prototypes.
|
||||
*/
|
||||
|
@ -26,9 +24,7 @@ void mailbox_get(struct k_mbox *mailbox,
|
|||
/* mailbox transfer speed test */
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Receive task
|
||||
*
|
||||
*/
|
||||
void mailrecvtask(void)
|
||||
{
|
||||
|
@ -59,7 +55,6 @@ void mailrecvtask(void)
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Receive data portions from the specified mailbox
|
||||
*
|
||||
* @return 0
|
||||
|
@ -101,5 +96,3 @@ void mailbox_get(struct k_mbox *mailbox,
|
|||
k_panic();
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* MAILBOX_BENCH */
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
*File Naming information.
|
||||
* ------------------------
|
||||
* File Naming information.
|
||||
* ------------------------
|
||||
* Files that end with:
|
||||
* _B : Is a file that contains a benchmark function
|
||||
* _R : Is a file that contains the receiver task
|
||||
|
@ -20,11 +20,8 @@
|
|||
char msg[MAX_MSG];
|
||||
char data_bench[MESSAGE_SIZE];
|
||||
|
||||
#ifdef PIPE_BENCH
|
||||
struct k_pipe *test_pipes[] = {&PIPE_NOBUFF, &PIPE_SMALLBUFF, &PIPE_BIGBUFF};
|
||||
#endif
|
||||
char sline[SLINE_LEN + 1];
|
||||
const char newline[] = "\n";
|
||||
|
||||
/*
|
||||
* Time in timer cycles necessary to read time.
|
||||
|
@ -60,7 +57,6 @@ K_PIPE_DEFINE(PIPE_SMALLBUFF, 256, 4);
|
|||
K_PIPE_DEFINE(PIPE_BIGBUFF, 4096, 4);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Check for keypress
|
||||
*
|
||||
* @return 1 when a keyboard key is pressed, or 0 if no keyboard support
|
||||
|
@ -71,7 +67,6 @@ int kbhit(void)
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Close output for the test
|
||||
*
|
||||
*/
|
||||
|
@ -84,7 +79,6 @@ void output_close(void)
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Perform all selected benchmarks
|
||||
* see config.h to select or to unselect
|
||||
*
|
||||
|
@ -95,7 +89,7 @@ int main(void)
|
|||
|
||||
bench_test_init();
|
||||
|
||||
PRINT_STRING(newline);
|
||||
PRINT_STRING("\n");
|
||||
do {
|
||||
PRINT_STRING(dashline);
|
||||
PRINT_STRING("| S I M P L E S E R V I C E "
|
||||
|
@ -121,13 +115,3 @@ int main(void)
|
|||
output_close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Dummy test
|
||||
*
|
||||
*/
|
||||
void dummy_test(void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -21,36 +21,25 @@
|
|||
|
||||
#include <zephyr/sys/util.h>
|
||||
|
||||
|
||||
/* uncomment the define below to use floating point arithmetic */
|
||||
/* #define FLOAT */
|
||||
|
||||
/* printf format defines. */
|
||||
#define FORMAT "| %-65s|%10u|\n"
|
||||
|
||||
/* length of the output line */
|
||||
#define SLINE_LEN 256
|
||||
|
||||
#define SLEEP_TIME ((CONFIG_SYS_CLOCK_TICKS_PER_SEC / 4) > 0 ? \
|
||||
CONFIG_SYS_CLOCK_TICKS_PER_SEC / 4 : 1)
|
||||
#define WAIT_TIME ((CONFIG_SYS_CLOCK_TICKS_PER_SEC / 10) > 0 ? \
|
||||
CONFIG_SYS_CLOCK_TICKS_PER_SEC / 10 : 1)
|
||||
#define NR_OF_NOP_RUNS 10000
|
||||
#define NR_OF_FIFO_RUNS 500
|
||||
#define NR_OF_SEMA_RUNS 500
|
||||
#define NR_OF_MUTEX_RUNS 1000
|
||||
#define NR_OF_POOL_RUNS 1000
|
||||
#define NR_OF_MAP_RUNS 1000
|
||||
#define NR_OF_EVENT_RUNS 1000
|
||||
#define NR_OF_MBOX_RUNS 128
|
||||
#define NR_OF_PIPE_RUNS 256
|
||||
/* #define SEMA_WAIT_TIME (5 * CONFIG_SYS_CLOCK_TICKS_PER_SEC) */
|
||||
#define SEMA_WAIT_TIME (5000)
|
||||
|
||||
/* global data */
|
||||
|
||||
extern char msg[MAX_MSG];
|
||||
extern char data_bench[MESSAGE_SIZE];
|
||||
extern struct k_pipe *test_pipes[];
|
||||
extern const char newline[];
|
||||
extern char sline[];
|
||||
|
||||
#define dashline \
|
||||
|
@ -60,7 +49,7 @@ extern char sline[];
|
|||
/*
|
||||
* To avoid divisions by 0 faults, wrap the divisor with this macro
|
||||
*/
|
||||
#define SAFE_DIVISOR(a) (((a) != 0)?(a):1)
|
||||
#define SAFE_DIVISOR(a) (((a) != 0) ? (a) : 1)
|
||||
|
||||
|
||||
/* pipe amount of content to receive (0+, 1+, all) */
|
||||
|
@ -70,56 +59,16 @@ enum pipe_options {
|
|||
_ALL_N = 0x2,
|
||||
};
|
||||
|
||||
/* dummy_test is a function that is mapped when we */
|
||||
/* do not want to test a specific Benchmark */
|
||||
extern void dummy_test(void);
|
||||
|
||||
/* other external functions */
|
||||
|
||||
extern void bench_task(void *p1, void *p2, void *p3);
|
||||
extern void recvtask(void *p1, void *p2, void *p3);
|
||||
|
||||
#ifdef MAILBOX_BENCH
|
||||
extern void mailbox_test(void);
|
||||
#else
|
||||
#define mailbox_test dummy_test
|
||||
#endif
|
||||
|
||||
#ifdef SEMA_BENCH
|
||||
extern void sema_test(void);
|
||||
#else
|
||||
#define sema_test dummy_test
|
||||
#endif
|
||||
|
||||
#ifdef FIFO_BENCH
|
||||
extern void queue_test(void);
|
||||
#else
|
||||
#define queue_test dummy_test
|
||||
#endif
|
||||
|
||||
#ifdef MUTEX_BENCH
|
||||
extern void mutex_test(void);
|
||||
#else
|
||||
#define mutex_test dummy_test
|
||||
#endif
|
||||
|
||||
#ifdef MEMMAP_BENCH
|
||||
extern void memorymap_test(void);
|
||||
#else
|
||||
#define memorymap_test dummy_test
|
||||
#endif
|
||||
|
||||
#ifdef MEMPOOL_BENCH
|
||||
extern void mempool_test(void);
|
||||
#else
|
||||
#define mempool_test dummy_test
|
||||
#endif
|
||||
|
||||
#ifdef PIPE_BENCH
|
||||
extern void pipe_test(void);
|
||||
#else
|
||||
#define pipe_test dummy_test
|
||||
#endif
|
||||
|
||||
/* kernel objects needed for benchmarking */
|
||||
extern struct k_mutex DEMO_MUTEX;
|
||||
|
@ -138,7 +87,6 @@ extern struct k_msgq CH_COMM;
|
|||
|
||||
extern struct k_mbox MAILB1;
|
||||
|
||||
|
||||
extern struct k_pipe PIPE_NOBUFF;
|
||||
extern struct k_pipe PIPE_SMALLBUFF;
|
||||
extern struct k_pipe PIPE_BIGBUFF;
|
||||
|
@ -146,8 +94,6 @@ extern struct k_pipe PIPE_BIGBUFF;
|
|||
|
||||
extern struct k_mem_slab MAP1;
|
||||
|
||||
|
||||
|
||||
/* PRINT_STRING
|
||||
* Macro to print an ASCII NULL terminated string.
|
||||
*/
|
||||
|
@ -181,7 +127,6 @@ static inline void check_result(void)
|
|||
{
|
||||
if (bench_test_end() < 0) {
|
||||
PRINT_OVERFLOW_ERROR();
|
||||
return; /* error */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,13 +9,8 @@
|
|||
#include "master.h"
|
||||
#include <zephyr/kernel.h>
|
||||
|
||||
#ifdef MEMMAP_BENCH
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Memory map get/free test
|
||||
*
|
||||
*/
|
||||
void memorymap_test(void)
|
||||
{
|
||||
|
@ -41,5 +36,3 @@ void memorymap_test(void)
|
|||
PRINT_F(FORMAT, "average alloc and dealloc memory page",
|
||||
SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, (2 * NR_OF_MAP_RUNS)));
|
||||
}
|
||||
|
||||
#endif /* MEMMAP_BENCH */
|
||||
|
|
|
@ -8,12 +8,8 @@
|
|||
|
||||
#include "master.h"
|
||||
|
||||
#ifdef MUTEX_BENCH
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Mutex lock/unlock test
|
||||
*
|
||||
*/
|
||||
void mutex_test(void)
|
||||
{
|
||||
|
@ -32,5 +28,3 @@ void mutex_test(void)
|
|||
PRINT_F(FORMAT, "average lock and unlock mutex",
|
||||
SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, (2 * NR_OF_MUTEX_RUNS)));
|
||||
}
|
||||
|
||||
#endif /* MUTEX_BENCH */
|
||||
|
|
|
@ -8,40 +8,6 @@
|
|||
|
||||
#include "master.h"
|
||||
|
||||
#ifdef PIPE_BENCH
|
||||
|
||||
#ifdef FLOAT
|
||||
#define PRINT_ALL_TO_N_HEADER_UNIT() \
|
||||
PRINT_STRING("| size(B) | time/packet (usec) | " \
|
||||
" MB/sec |\n")
|
||||
|
||||
#define PRINT_ALL_TO_N() \
|
||||
PRINT_F("|%5u|%5u|%10.3f|%10.3f|%10.3f|%10.3f|%10.3f|%10.3f|\n", \
|
||||
putsize, putsize, puttime[0] / 1000.0, puttime[1] / 1000.0, \
|
||||
puttime[2] / 1000.0, \
|
||||
(1000.0 * putsize) / SAFE_DIVISOR(puttime[0]), \
|
||||
(1000.0 * putsize) / SAFE_DIVISOR(puttime[1]), \
|
||||
(1000.0 * putsize) / SAFE_DIVISOR(puttime[2]))
|
||||
|
||||
#define PRINT_1_TO_N_HEADER() \
|
||||
do { \
|
||||
PRINT_STRING("| size(B) | time/packet (usec) |" \
|
||||
" MB/sec |\n"); \
|
||||
PRINT_STRING(dashline); \
|
||||
} while (0)
|
||||
|
||||
#define PRINT_1_TO_N() \
|
||||
PRINT_F("|%5u|%5d|%10.3f|%10.3f|%10.3f|%10.3f|%10.3f|%10.3f|\n", \
|
||||
putsize, \
|
||||
getsize, \
|
||||
puttime[0] / 1000.0, \
|
||||
puttime[1] / 1000.0, \
|
||||
puttime[2] / 1000.0, \
|
||||
(1000.0 * putsize) / SAFE_DIVISOR(puttime[0]), \
|
||||
(1000.0 * putsize) / SAFE_DIVISOR(puttime[1]), \
|
||||
(1000.0 * putsize) / SAFE_DIVISOR(puttime[2]))
|
||||
|
||||
#else
|
||||
#define PRINT_ALL_TO_N_HEADER_UNIT() \
|
||||
PRINT_STRING("| size(B) | time/packet (nsec) | " \
|
||||
" KB/sec |\n")
|
||||
|
@ -74,7 +40,6 @@
|
|||
SAFE_DIVISOR(puttime[1])), \
|
||||
(uint32_t)(((uint64_t)putsize * 1000000U) / \
|
||||
SAFE_DIVISOR(puttime[2])))
|
||||
#endif /* FLOAT */
|
||||
|
||||
/*
|
||||
* Function prototypes.
|
||||
|
@ -87,9 +52,7 @@ int pipeput(struct k_pipe *pipe, enum pipe_options
|
|||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Test the pipes transfer speed
|
||||
*
|
||||
*/
|
||||
void pipe_test(void)
|
||||
{
|
||||
|
@ -179,7 +142,6 @@ void pipe_test(void)
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Write a data portion to the pipe and measure time
|
||||
*
|
||||
* @return 0 on success, 1 on error
|
||||
|
@ -245,5 +207,3 @@ int pipeput(struct k_pipe *pipe,
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* PIPE_BENCH */
|
||||
|
|
|
@ -9,9 +9,6 @@
|
|||
#include "receiver.h"
|
||||
#include "master.h"
|
||||
|
||||
#ifdef PIPE_BENCH
|
||||
|
||||
|
||||
/*
|
||||
* Function prototypes.
|
||||
*/
|
||||
|
@ -25,9 +22,7 @@ int pipeget(struct k_pipe *pipe, enum pipe_options option,
|
|||
/* pipes transfer speed test */
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Receive task
|
||||
*
|
||||
*/
|
||||
void piperecvtask(void)
|
||||
{
|
||||
|
@ -74,7 +69,6 @@ void piperecvtask(void)
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Read a data portion from the pipe and measure time
|
||||
*
|
||||
* @return 0 on success, 1 on error
|
||||
|
@ -136,5 +130,3 @@ int pipeget(struct k_pipe *pipe, enum pipe_options option, int size, int count,
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* PIPE_BENCH */
|
||||
|
|
|
@ -25,27 +25,21 @@ void mailrecvtask(void);
|
|||
void piperecvtask(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Main function of the task that receives data in the test
|
||||
*
|
||||
*/
|
||||
void recvtask(void *p1, void *p2, void *p3)
|
||||
{
|
||||
/* order must be compatible with master.c ! */
|
||||
#ifdef FIFO_BENCH
|
||||
|
||||
k_sem_take(&STARTRCV, K_FOREVER);
|
||||
dequtask();
|
||||
#endif
|
||||
#ifdef SEMA_BENCH
|
||||
|
||||
k_sem_take(&STARTRCV, K_FOREVER);
|
||||
waittask();
|
||||
#endif
|
||||
#ifdef MAILBOX_BENCH
|
||||
|
||||
k_sem_take(&STARTRCV, K_FOREVER);
|
||||
mailrecvtask();
|
||||
#endif
|
||||
#ifdef PIPE_BENCH
|
||||
|
||||
k_sem_take(&STARTRCV, K_FOREVER);
|
||||
piperecvtask();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
|
||||
#include "master.h"
|
||||
|
||||
#ifdef SEMA_BENCH
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Semaphore signal speed test
|
||||
|
@ -56,5 +53,3 @@ void sema_test(void)
|
|||
SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
|
||||
|
||||
}
|
||||
|
||||
#endif /* SEMA_BENCH */
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
#include "receiver.h"
|
||||
#include "master.h"
|
||||
|
||||
#ifdef SEMA_BENCH
|
||||
|
||||
/* semaphore signal speed test */
|
||||
|
||||
/**
|
||||
|
@ -30,5 +28,3 @@ void waittask(void)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
#endif /* SEMA_BENCH */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue