benchmark_driver.c 968 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include "cmsis_os.h"
  2. #include "ImC/imc_kernel.h"
  3. #include "ImC/imc_extension.h"
  4. #include <stdio.h>
  5. void vBenchmarkDriver(void *_benchmark)
  6. {
  7. void (*benchmark)(void) = _benchmark;
  8. #if (imcBENCH_INFINITE_LOOP)
  9. while(1) {
  10. #endif
  11. portDISABLE_INTERRUPTS();
  12. printf("Start benchmark\r\n");
  13. portENABLE_INTERRUPTS();
  14. benchmark();
  15. #if(imcPRINT_STATS)
  16. portDISABLE_INTERRUPTS();
  17. printf("(STAT) checkpoint triggered: %d\r\n", imc_checkpoint_triggered);
  18. printf("(STAT) checkpoint executed: %d\r\n", imc_checkpoint_executed);
  19. portENABLE_INTERRUPTS();
  20. imc_checkpoint_triggered = 0;
  21. imc_checkpoint_executed = 0;
  22. #endif
  23. portDISABLE_INTERRUPTS();
  24. printf("End benchmark\r\n");
  25. portENABLE_INTERRUPTS();
  26. imcREQUEST_CHECKPOINT();
  27. #if (imcBENCH_INFINITE_LOOP)
  28. // osDelay(10);
  29. }
  30. #endif
  31. #if (imcUSE_IMC_KERNEL == 1)
  32. vImcInvalidateRecovery();
  33. #endif
  34. }