duration_type measure100( duration_type overhead) { boost::fibers::fiber( worker).join(); BOOST_PP_REPEAT_FROM_TO(1, 100, CREATE, _); time_point_type start( clock_type::now() ); BOOST_PP_REPEAT_FROM_TO(1, 100, JOIN, _); duration_type total = clock_type::now() - start; total -= overhead_clock(); // overhead of measurement total /= 100; // loops return total; }
duration_type measure50( duration_type overhead) { std::thread( worker).join(); BOOST_PP_REPEAT_FROM_TO(1, 50, CREATE, _); time_point_type start( clock_type::now() ); BOOST_PP_REPEAT_FROM_TO(1, 50, JOIN, _); duration_type total = clock_type::now() - start; total -= overhead_clock(); // overhead of measurement total /= 50; // loops return total; }
duration_type measure( duration_type overhead) { boost::fibers::fiber( worker).join(); duration_type result = duration_type::zero(); BOOST_PP_REPEAT_FROM_TO(1, JOBS, WAIT, _) result /= JOBS; // loops return result; }
typename detail::result_of::target<A0>::type operator()( A0 const& , BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS( BOOST_PHOENIX_ITERATION , A , const& a ) , Context const & ctx ) const { #define EVAL_a(_,n,__) \ BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) boost::phoenix::eval(a ## n, ctx) return typename detail::result_of::target<A0>::type( BOOST_PP_REPEAT_FROM_TO( 1 , BOOST_PHOENIX_ITERATION , EVAL_a, _ ) ); #undef EVAL_a }
// Copyright Aleksey Gurtovoy 2001-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id$ // $Date$ // $Revision$ // Necessary to overcome a strange name lookup bug in GCC 3.3 and 4.0 for Mac OS X #if defined(__APPLE_CC__) && defined(__GNUC__) && (__GNUC__ <= 4) # include <cassert> #endif #include <boost/mpl/size_t.hpp> #include <boost/mpl/identity.hpp> #include <boost/preprocessor/repetition/repeat_from_to.hpp> #include "integral_wrapper_test.hpp" MPL_TEST_CASE() { # define WRAPPER(T, i) mpl::size_t<i> BOOST_PP_REPEAT_FROM_TO(1, 11, INTEGRAL_WRAPPER_TEST, std::size_t) }