Commit a5d61f05 authored by Michael Quigley's avatar Michael Quigley
Browse files

Finish context switch benchmark test. Still need to disable NMIs and...

Finish context switch benchmark test. Still need to disable NMIs and preemption to decrease variance in results.
parent fb125ea3
......@@ -114,6 +114,7 @@ AC_CONFIG_FILES(
src/tests/simple/Kbuild
src/tests/dispatch/Kbuild
src/tests/ctx-switch/Kbuild
)
AC_OUTPUT
obj-m += simple/
obj-m += dispatch/
obj-m += ctx-switch/
......@@ -3,3 +3,4 @@
install-tests:
cp $(LIBASYNC_TESTS_KBUILD)/simple/libasync_test_simple.ko $(D)
cp $(LIBASYNC_TESTS_KBUILD)/dispatch/libfipc_test_dispatch_loop.ko $(D)
cp $(LIBASYNC_TESTS_KBUILD)/ctx-switch/ctx_switch_test.ko $(D)
# @ASYNC_AUTOCONF_NOTICE@
# Magic line so we can do out-of-source build
src = @abs_top_srcdir@/src/tests/ctx-switch
obj-m = ctx_switch_test.o
# Paths are relative to ctx-switch/ build dir
ctx_switch_test-y += ../test_helpers.o main.o
# src/Makefile.am.
ctx_switch_test-y += ../../$(LIBASYNC_PATH)
ctx_switch_test-y += ../../$(LIBFIPC_LIB)
ccflags-y += $(CFLAGS) $(AM_CPPFLAGS) $(AM_CFLAGS)
......@@ -9,13 +9,16 @@
*/
#include <libfipc.h>
#include <thc.h>
#include <thcinternal.h>
#include <awe_mapper.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include "../test_helpers.h"
MODULE_LICENSE("GPL");
#define NUM_SWITCH_MEASUREMENTS 1000
#define NUM_SWITCH_MEASUREMENTS 100000
static unsigned long ctx_switch_measurements[NUM_SWITCH_MEASUREMENTS];
......@@ -26,8 +29,8 @@ static int setup_and_run_test(void)
uint32_t msg_id;
thc_init();
for( int i = 0; i < NUM_SWITCH_MEASUREMENTS; i++ )
int i;
for( i = 0; i < NUM_SWITCH_MEASUREMENTS; i++ )
{
DO_FINISH_(ctx_switch,{
ASYNC({
......
......@@ -15,4 +15,27 @@ static int test_fipc_compare(const void *_a, const void *_b){
}
void test_fipc_dump_time(unsigned long *time, unsigned long num_transactions)
{
int i;
unsigned long long counter = 0;
unsigned long min;
unsigned long max;
for (i = 0; i < num_transactions; i++) {
counter+= time[i];
}
sort(time, num_transactions, sizeof(unsigned long), test_fipc_compare, NULL);
min = time[0];
max = time[num_transactions-1];
//counter = min;
printk(KERN_ERR "MIN\tMAX\tAVG\tMEDIAN\n");
printk(KERN_ERR "%lu & %lu & %llu & %lu \n", min, max, counter/num_transactions, time[num_transactions/2]);
}
EXPORT_SYMBOL(test_fipc_dump_time);
......@@ -262,31 +262,7 @@ static inline unsigned long test_fipc_stop_stopwatch(void)
}
static int test_fipc_compare(const void *_a, const void *_b);
static inline void test_fipc_dump_time(unsigned long *time, unsigned long num_transactions)
{
int i;
unsigned long long counter = 0;
unsigned long min;
unsigned long max;
for (i = 0; i < num_transactions; i++) {
counter+= time[i];
}
sort(time, num_transactions, sizeof(unsigned long), test_fipc_compare, NULL);
min = time[0];
max = time[num_transactions-1];
counter = min;
printk(KERN_ERR "MIN\tMAX\tAVG\tMEDIAN\n");
printk(KERN_ERR "%lu & %lu & %llu & %lu \n", min, max, counter/num_transactions, time[num_transactions/2]);
}
void test_fipc_dump_time(unsigned long *time, unsigned long num_transactions);
#endif /* FIPC_KERNEL_TEST_HELPERS_H */
Supports Markdown
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