timeTest.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* ----------------------------------------------------------------------------
  2. * GTSAM Copyright 2010, Georgia Tech Research Corporation,
  3. * Atlanta, Georgia 30332-0415
  4. * All Rights Reserved
  5. * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
  6. * See LICENSE for the license information
  7. * -------------------------------------------------------------------------- */
  8. /**
  9. * @file timing.h
  10. * @author Richard Roberts (extracted from Michael Kaess' timing functions)
  11. * @date Oct 5, 2010
  12. */
  13. #include <gtsam/base/timing.h>
  14. using namespace gtsam;
  15. int main(int argc, char *argv[]) {
  16. // FIXME: ticPush_ does not exist
  17. {
  18. gttic_(top1);
  19. gttic_(sub1);
  20. gttic_(sub_sub_a);
  21. gttoc_(sub_sub_a);
  22. gttoc_(sub1);
  23. gttic_(sub2);
  24. gttic_(sub_sub_b);
  25. gttoc_(sub_sub_b);
  26. gttoc_(sub2);
  27. gttoc_(top1);
  28. }
  29. {
  30. gttic_(top2);
  31. gttic_(sub1);
  32. gttic_(sub_sub_a);
  33. gttoc_(sub_sub_a);
  34. gttoc_(sub1);
  35. gttic_(sub2);
  36. gttic_(sub_sub_b);
  37. gttoc_(sub_sub_b);
  38. gttoc_(sub2);
  39. gttoc_(top2);
  40. }
  41. gttic_(top3);
  42. for(size_t i=0; i<1000000; ++i) {
  43. gttic_(overhead);
  44. gttic_(sub_overhead);
  45. gttoc_(sub_overhead);
  46. gttoc_(overhead);
  47. tictoc_finishedIteration_();
  48. }
  49. gttoc_(top3);
  50. gttic_(top4);
  51. for(size_t i=0; i<1000000; ++i) {
  52. gttic(overhead_a);
  53. gttic(overhead_b);
  54. gttoc(overhead_b);
  55. gttoc(overhead_a);
  56. tictoc_finishedIteration();
  57. }
  58. gttoc_(top4);
  59. tictoc_print_();
  60. return 0;
  61. }