Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. diff --git test/CMakeLists.txt test/CMakeLists.txt
  2. index 8e4b4d1..0aff1eb 100644
  3. --- test/CMakeLists.txt
  4. +++ test/CMakeLists.txt
  5. @@ -9,6 +9,6 @@ include_directories(../src/common/)
  6. foreach(TEST_NAME cpu disk memory network process swap)
  7. add_executable(${TEST_NAME} test_${TEST_NAME}.c)
  8. add_dependencies(${TEST_NAME} sysactivity)
  9. - target_link_libraries(${TEST_NAME} sysactivity pthread)
  10. + target_link_libraries(${TEST_NAME} sysactivity pthread m)
  11. add_test(${TEST_NAME} ${TEST_NAME})
  12. endforeach(TEST_NAME)
  13. diff --git test/test_cpu.c test/test_cpu.c
  14. index 69d9ceb..c9cfaf7 100644
  15. --- test/test_cpu.c
  16. +++ test/test_cpu.c
  17. @@ -23,6 +23,7 @@
  18. #include <pthread.h>
  19. #include <stdlib.h>
  20. #include <string.h>
  21. +#include <math.h>
  22.  
  23. #include "libsysactivity.h"
  24.  
  25. @@ -60,6 +61,7 @@ void print_cpu_info(struct sa_cpu* cpu) {
  26. }
  27.  
  28. void check_range(float cpu_time) {
  29. + cpu_time = roundf(cpu_time);
  30. if (cpu_time > 100.0 || cpu_time < 0.0) {
  31. printf("%s:%d ERROR: cpu time out of range: %f\n", __FILE__, __LINE__, cpu_time);
  32. error = 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement