bench_mutex_pingpong: Add number of clock ticks per cycle

This commit is contained in:
Koen Zandberg 2020-07-30 21:51:33 +02:00
parent f2a27dd46b
commit 86035661a3
No known key found for this signature in database
GPG Key ID: 0895A893E6D2985B
2 changed files with 8 additions and 2 deletions

View File

@ -20,6 +20,7 @@
#include <stdio.h>
#include "macros/units.h"
#include "mutex.h"
#include "thread.h"
#include "xtimer.h"
@ -78,7 +79,12 @@ int main(void)
n++;
}
printf("{ \"result\" : %"PRIu32" }\n", n);
printf("{ \"result\" : %"PRIu32, n);
#ifdef CLOCK_CORECLOCK
printf(", \"ticks\" : %"PRIu32,
(uint32_t)((TEST_DURATION/US_PER_MS) * (CLOCK_CORECLOCK/KHZ(1)))/n);
#endif
puts(" }");
return 0;
}

View File

@ -12,7 +12,7 @@ from testrunner import run
def testfunc(child):
child.expect(r"{ \"result\" : \d+ }")
child.expect(r"{ \"result\" : \d+(, \"ticks\" : \d+)? }")
if __name__ == "__main__":