diff options
author | Christian Cunningham <cc@localhost> | 2022-03-22 21:15:27 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-03-22 21:15:27 -0700 |
commit | 04c9763cf581c3c9feeb51d88b638e38aad6f614 (patch) | |
tree | b1487c53ccc045f8c0e38466da164a79791c9c81 /src/tests | |
parent | 4481ae56e80a3a425cfcbf81cd75ccc1619cdeaa (diff) |
Test with microsecond counter
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/test.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/tests/test.c b/src/tests/test.c index b6ba5d3..69c150e 100644 --- a/src/tests/test.c +++ b/src/tests/test.c @@ -39,11 +39,11 @@ void test_entry(void) bins[i] = 0; } - // Test 1: Tracing Time + // Test 2: Yield Time dt = 0; for(int i = 0; i < TEST_COUNT; i++) { - sys0_32(SYS_TIME_2, &tf); - sys0_32(SYS_TIME_2, &ti); + sys0_64(SYS_TIME, &ti); + sys0_64(SYS_TIME, &tf); dt += tf - ti; if ((tf-ti) < TEST_BIN_COUNT) bins[(tf-ti)]++; @@ -63,9 +63,9 @@ void test_entry(void) // Test 2: Yield Time dt = 0; for(int i = 0; i < TEST_COUNT; i++) { - sys0_32(SYS_TIME_2, &tf); + sys0_64(SYS_TIME, &ti); sys0(SYS_YIELD); - sys0_32(SYS_TIME_2, &ti); + sys0_64(SYS_TIME, &tf); dt += tf - ti; if ((tf-ti) < TEST_BIN_COUNT) bins[(tf-ti)]++; @@ -85,9 +85,9 @@ void test_entry(void) // Test 3: Add Thread, Lower Priority dt = 0; for(int i = 0; i < TEST_COUNT; i++) { - sys0_32(SYS_TIME_2, &tf); + sys0_64(SYS_TIME, &ti); add_thread(nooptest, 0, 3); - sys0_32(SYS_TIME_2, &ti); + sys0_64(SYS_TIME, &tf); dt += tf - ti; if ((tf-ti) < TEST_BIN_COUNT) bins[(tf-ti)]++; @@ -107,9 +107,9 @@ void test_entry(void) // Test 4: Add Thread, Higher Priority dt = 0; for(int i = 0; i < TEST_COUNT; i++) { - sys0_32(SYS_TIME_2, &tf); + sys0_64(SYS_TIME, &ti); add_thread(nooptest, 0, 0); - sys0_32(SYS_TIME_2, &ti); + sys0_64(SYS_TIME, &tf); dt += tf - ti; if ((tf-ti) < TEST_BIN_COUNT) bins[(tf-ti)]++; @@ -129,9 +129,9 @@ void test_entry(void) // Test 5: Create Mutex dt = 0; for(int i = 0; i < TEST_COUNT; i++) { - sys0_32(SYS_TIME_2, &tf); + sys0_64(SYS_TIME, &ti); struct Mutex* m = create_mutex(0); - sys0_32(SYS_TIME_2, &ti); + sys0_64(SYS_TIME, &tf); delete_mutex(m); dt += tf - ti; if ((tf-ti) < TEST_BIN_COUNT) @@ -153,9 +153,9 @@ void test_entry(void) dt = 0; for(int i = 0; i < TEST_COUNT; i++) { struct Mutex* m = create_mutex(0); - sys0_32(SYS_TIME_2, &tf); + sys0_64(SYS_TIME, &ti); delete_mutex(m); - sys0_32(SYS_TIME_2, &ti); + sys0_64(SYS_TIME, &tf); dt += tf - ti; if ((tf-ti) < TEST_BIN_COUNT) bins[(tf-ti)]++; @@ -176,9 +176,9 @@ void test_entry(void) dt = 0; for(int i = 0; i < TEST_COUNT; i++) { struct Mutex* m = create_mutex(0); - sys0_32(SYS_TIME_2, &tf); + sys0_64(SYS_TIME, &ti); lock_mutex(m); - sys0_32(SYS_TIME_2, &ti); + sys0_64(SYS_TIME, &tf); delete_mutex(m); dt += tf - ti; if ((tf-ti) < TEST_BIN_COUNT) @@ -202,9 +202,9 @@ void test_entry(void) struct Mutex* m = create_mutex(0); add_thread(mutex_contention_helper, m, 2); sys0(SYS_YIELD); - sys0_32(SYS_TIME_2, &tf); + sys0_64(SYS_TIME, &ti); lock_mutex(m); - sys0_32(SYS_TIME_2, &ti); + sys0_64(SYS_TIME, &tf); delete_mutex(m); dt += tf - ti; if ((tf-ti) < TEST_BIN_COUNT) @@ -227,9 +227,9 @@ void test_entry(void) for(int i = 0; i < TEST_COUNT; i++) { struct Mutex* m = create_mutex(0); lock_mutex(m); - sys0_32(SYS_TIME_2, &tf); + sys0_64(SYS_TIME, &ti); unlock_mutex(m); - sys0_32(SYS_TIME_2, &ti); + sys0_64(SYS_TIME, &tf); delete_mutex(m); dt += tf - ti; if ((tf-ti) < TEST_BIN_COUNT) @@ -254,9 +254,9 @@ void test_entry(void) dt = 0; for(int i = 0; i < TEST_COUNT; i++) { sem = 1; - sys0_32(SYS_TIME_2, &tf); + sys0_64(SYS_TIME, &ti); sys1(SYS_SEMAPHORE_P, &sem); - sys0_32(SYS_TIME_2, &ti); + sys0_64(SYS_TIME, &tf); dt += tf - ti; if ((tf-ti) < TEST_BIN_COUNT) bins[(tf-ti)]++; @@ -277,9 +277,9 @@ void test_entry(void) dt = 0; for(int i = 0; i < TEST_COUNT; i++) { sem = 0; - sys0_32(SYS_TIME_2, &tf); + sys0_64(SYS_TIME, &ti); sys1(SYS_SEMAPHORE_V, &sem); - sys0_32(SYS_TIME_2, &ti); + sys0_64(SYS_TIME, &tf); dt += tf - ti; if ((tf-ti) < TEST_BIN_COUNT) bins[(tf-ti)]++; @@ -300,9 +300,9 @@ void test_entry(void) dt = 0; for(int i = 0; i < TEST_COUNT; i++) { sem = 1; - sys0_32(SYS_TIME_2, &tf); + sys0_64(SYS_TIME, &ti); sys1(SYS_SEMAPHORE_V, &sem); - sys0_32(SYS_TIME_2, &ti); + sys0_64(SYS_TIME, &tf); dt += tf - ti; if ((tf-ti) < TEST_BIN_COUNT) bins[(tf-ti)]++; @@ -322,18 +322,18 @@ void test_entry(void) // // Test 7: Tick Latency //#define DELAY_TIME 512000 // unsigned long center = 0; -// sys0_32(SYS_TIME_2, &tf); +// sys0_64(SYS_TIME, &ti); // delay(DELAY_TIME); -// sys0_32(SYS_TIME_2, &ti); +// sys0_64(SYS_TIME, &tf); // center = (tf - ti - 10); // if (10 > (tf-ti)) // center = 0; // dt = 0; // unsigned long j = 0; // for(int i = 0; i < TEST_COUNT; i++) { -// sys0_32(SYS_TIME_2, &tf); +// sys0_64(SYS_TIME, &ti); // delay(DELAY_TIME); -// sys0_32(SYS_TIME_2, &ti); +// sys0_64(SYS_TIME, &tf); // dt += tf - ti; // if ((tf-ti-center) < TEST_BIN_COUNT) // bins[(tf-ti)-center]++; |