这是一个本人学习 csapp 的 learning 库
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

41 行
1.3 KiB

  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);