这是一个本人学习 csapp 的 learning 库
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.

41 regels
1.3 KiB

1 jaar geleden
  1. /* Find number of cycles used by function that takes 2 arguments */
  2. /* Function to be tested takes two integer arguments */
  3. typedef int (*test_funct)(int, int);
  4. /* Compute time used by function f */
  5. double fcyc2(test_funct f, int param1, int param2, int clear_cache);
  6. /********* These routines are used to help with the analysis *********/
  7. /*
  8. Parameters:
  9. k: How many samples must be within epsilon for convergence
  10. epsilon: What is tolerance
  11. maxsamples: How many samples until give up?
  12. */
  13. /* Full version of fcyc with control over parameters */
  14. double fcyc2_full(test_funct f, int param1, int param2, int clear_cache,
  15. int k, double epsilon, int maxsamples, int compensate);
  16. /* Get current minimum */
  17. double get_min();
  18. /* What is convergence status for k minimum measurements within epsilon
  19. Returns 0 if not converged, #samples if converged, and -1 if can't
  20. reach convergence
  21. */
  22. int has_converged(int k, double epsilon, int maxsamples);
  23. /* What is error of current measurement */
  24. double err(int k);
  25. /************* Try other clocking methods *****************/
  26. /* Full version that uses the time of day clock */
  27. double fcyc2_full_tod(test_funct f, int param1, int param2, int clear_cache,
  28. int k, double epsilon, int maxsamples, int compensate);
  29. double fcyc2_tod(test_funct f, int param1, int param2, int clear_cache);