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.

34 lines
736 B

25 years ago
  1. #include <cl_number.h>
  2. #include <cl_io.h>
  3. #include <cl_integer.h>
  4. #include <cl_integer_io.h>
  5. #include <cl_random.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include <cl_timing.h>
  9. #include <cl_malloc.h>
  10. #include <cl_abort.h>
  11. int main (int argc, char * argv[])
  12. {
  13. int repetitions = 1;
  14. if ((argc >= 3) && !strcmp(argv[1],"-r")) {
  15. repetitions = atoi(argv[2]);
  16. argc -= 2; argv += 2;
  17. }
  18. if (argc < 2)
  19. exit(1);
  20. cl_I m = cl_I(argv[1]);
  21. cl_I M = (cl_I)1 << (intDsize*m);
  22. cl_I a = random_I(M);
  23. // One run to fill the cache.
  24. {
  25. char* p = cl_decimal_string(a);
  26. cl_free_hook(p);
  27. }
  28. // Now start the timing.
  29. { CL_TIMING;
  30. for (int rep = repetitions; rep > 0; rep--)
  31. { char* p = cl_decimal_string(a); cl_free_hook(p); }
  32. }
  33. }