Eksperymenty z asemblerem ARMv7
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sec_ccnt.c 515B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <stdio.h>
  2. #include <time.h>
  3. // Jan Potocki 2020
  4. unsigned long timestamp();
  5. int main()
  6. {
  7. unsigned long tstamp1, tstamp2;
  8. tstamp1 = timestamp();
  9. // Tego z jakiegos powodu nie mozna zrobic za pomoca sleep(1)...
  10. // ...cykle nie sa zliczane prawidlowo - wiec goraca petla
  11. clock_t t;
  12. do
  13. {
  14. t = clock();
  15. }
  16. while(t < CLOCKS_PER_SEC);
  17. tstamp2 = timestamp();
  18. if(tstamp2 > tstamp1)
  19. {
  20. printf("Cycles: %lu\n", tstamp2-tstamp1);
  21. }
  22. else
  23. {
  24. printf("Cycles: invalid measure\n");
  25. }
  26. return 0;
  27. }