boilerplate.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*=============================================================================
  2. Copyright (c) 2001-2010 Joel de Guzman
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. ==============================================================================*/
  6. #include "measure.hpp"
  7. namespace
  8. {
  9. struct f : test::base
  10. {
  11. void benchmark()
  12. {
  13. this->val += 5; // Here is where you put code that you want
  14. // to benchmark. Make sure it returns something.
  15. // Anything.
  16. }
  17. };
  18. }
  19. int main()
  20. {
  21. BOOST_SPIRIT_TEST_BENCHMARK(
  22. 10000000, // This is the maximum repetitions to execute
  23. (f) // Place your tests here. For now, we have only one test: (f)
  24. // If you have 3 tests a, b and c, this line will contain (a)(b)(c)
  25. )
  26. // This is ultimately responsible for preventing all the test code
  27. // from being optimized away. Change this to return 0 and you
  28. // unplug the whole test's life support system.
  29. return test::live_code != 0;
  30. }