adapt new execution_context API

This commit is contained in:
Oliver Kowalke
2015-11-10 20:02:33 +01:00
parent fb8254cadb
commit a73e4b1ace
22 changed files with 501 additions and 544 deletions

View File

@@ -20,7 +20,6 @@
typedef boost::coroutines2::protected_fixedsize_stack stack_allocator;
typedef boost::coroutines2::coroutine< void > coro_type;
bool preserve = false;
boost::uint64_t jobs = 1000;
void fn( coro_type::pull_type & c)
@@ -32,7 +31,7 @@ duration_type measure_time( duration_type overhead)
time_point_type start( clock_type::now() );
for ( std::size_t i = 0; i < jobs; ++i) {
coro_type::push_type c( stack_alloc, fn, preserve);
coro_type::push_type c( stack_alloc, fn);
}
duration_type total = clock_type::now() - start;
total -= overhead_clock(); // overhead of measurement
@@ -48,7 +47,7 @@ cycle_type measure_cycles( cycle_type overhead)
cycle_type start( cycles() );
for ( std::size_t i = 0; i < jobs; ++i) {
coro_type::push_type c( stack_alloc, fn, preserve);
coro_type::push_type c( stack_alloc, fn);
}
cycle_type total = cycles() - start;
total -= overhead; // overhead of measurement
@@ -67,7 +66,6 @@ int main( int argc, char * argv[])
desc.add_options()
("help", "help message")
("bind,b", boost::program_options::value< bool >( & bind), "bind thread to CPU")
("fpu,f", boost::program_options::value< bool >( & preserve), "preserve FPU registers")
("jobs,j", boost::program_options::value< boost::uint64_t >( & jobs), "jobs to run");
boost::program_options::variables_map vm;

View File

@@ -20,7 +20,6 @@
typedef boost::coroutines2::fixedsize_stack stack_allocator;
typedef boost::coroutines2::coroutine< void > coro_type;
bool preserve = false;
boost::uint64_t jobs = 1000;
void fn( coro_type::pull_type & c)
@@ -32,7 +31,7 @@ duration_type measure_time( duration_type overhead)
time_point_type start( clock_type::now() );
for ( std::size_t i = 0; i < jobs; ++i) {
coro_type::push_type c( stack_alloc, fn, preserve);
coro_type::push_type c( stack_alloc, fn);
}
duration_type total = clock_type::now() - start;
total -= overhead_clock(); // overhead of measurement
@@ -48,7 +47,7 @@ cycle_type measure_cycles( cycle_type overhead)
cycle_type start( cycles() );
for ( std::size_t i = 0; i < jobs; ++i) {
coro_type::push_type c( stack_alloc, fn, preserve);
coro_type::push_type c( stack_alloc, fn);
}
cycle_type total = cycles() - start;
total -= overhead; // overhead of measurement
@@ -67,7 +66,6 @@ int main( int argc, char * argv[])
desc.add_options()
("help", "help message")
("bind,b", boost::program_options::value< bool >( & bind), "bind thread to CPU")
("fpu,f", boost::program_options::value< bool >( & preserve), "preserve FPU registers")
("jobs,j", boost::program_options::value< boost::uint64_t >( & jobs), "jobs to run");
boost::program_options::variables_map vm;

View File

@@ -18,7 +18,6 @@
#include "clock.hpp"
#include "cycle.hpp"
bool preserve = false;
boost::uint64_t jobs = 1000;
struct X
@@ -45,7 +44,7 @@ void fn_x( boost::coroutines2::coroutine< X >::push_type & c)
duration_type measure_time_void( duration_type overhead)
{
boost::coroutines2::coroutine< void >::pull_type c( fn_void, preserve);
boost::coroutines2::coroutine< void >::pull_type c( fn_void);
time_point_type start( clock_type::now() );
for ( std::size_t i = 0; i < jobs; ++i) {
@@ -61,7 +60,7 @@ duration_type measure_time_void( duration_type overhead)
duration_type measure_time_int( duration_type overhead)
{
boost::coroutines2::coroutine< int >::pull_type c( fn_int, preserve);
boost::coroutines2::coroutine< int >::pull_type c( fn_int);
time_point_type start( clock_type::now() );
for ( std::size_t i = 0; i < jobs; ++i) {
@@ -77,7 +76,7 @@ duration_type measure_time_int( duration_type overhead)
duration_type measure_time_x( duration_type overhead)
{
boost::coroutines2::coroutine< X >::pull_type c( fn_x, preserve);
boost::coroutines2::coroutine< X >::pull_type c( fn_x);
time_point_type start( clock_type::now() );
for ( std::size_t i = 0; i < jobs; ++i) {
@@ -94,7 +93,7 @@ duration_type measure_time_x( duration_type overhead)
# ifdef BOOST_CONTEXT_CYCLE
cycle_type measure_cycles_void( cycle_type overhead)
{
boost::coroutines2::coroutine< void >::pull_type c( fn_void, preserve);
boost::coroutines2::coroutine< void >::pull_type c( fn_void);
cycle_type start( cycles() );
for ( std::size_t i = 0; i < jobs; ++i) {
@@ -110,7 +109,7 @@ cycle_type measure_cycles_void( cycle_type overhead)
cycle_type measure_cycles_int( cycle_type overhead)
{
boost::coroutines2::coroutine< int >::pull_type c( fn_int, preserve);
boost::coroutines2::coroutine< int >::pull_type c( fn_int);
cycle_type start( cycles() );
for ( std::size_t i = 0; i < jobs; ++i) {
@@ -126,7 +125,7 @@ cycle_type measure_cycles_int( cycle_type overhead)
cycle_type measure_cycles_x( cycle_type overhead)
{
boost::coroutines2::coroutine< X >::pull_type c( fn_x, preserve);
boost::coroutines2::coroutine< X >::pull_type c( fn_x);
cycle_type start( cycles() );
for ( std::size_t i = 0; i < jobs; ++i) {
@@ -150,7 +149,6 @@ int main( int argc, char * argv[])
desc.add_options()
("help", "help message")
("bind,b", boost::program_options::value< bool >( & bind), "bind thread to CPU")
("fpu,f", boost::program_options::value< bool >( & preserve), "preserve FPU registers")
("jobs,j", boost::program_options::value< boost::uint64_t >( & jobs), "jobs to run");
boost::program_options::variables_map vm;

View File

@@ -20,7 +20,6 @@
typedef boost::coroutines2::segmented_stack stack_allocator;
typedef boost::coroutines2::coroutine< void > coro_type;
bool preserve = false;
boost::uint64_t jobs = 1000;
void fn( coro_type::push_type & c)
@@ -32,7 +31,7 @@ duration_type measure_time( duration_type overhead)
time_point_type start( clock_type::now() );
for ( std::size_t i = 0; i < jobs; ++i) {
coro_type::pull_type c( stack_alloc, fn, preserve);
coro_type::pull_type c( stack_alloc, fn);
}
duration_type total = clock_type::now() - start;
total -= overhead_clock(); // overhead of measurement
@@ -48,7 +47,7 @@ cycle_type measure_cycles( cycle_type overhead)
cycle_type start( cycles() );
for ( std::size_t i = 0; i < jobs; ++i) {
coro_type::pull_type c( stack_alloc, fn, preserve);
coro_type::pull_type c( stack_alloc, fn);
}
cycle_type total = cycles() - start;
total -= overhead; // overhead of measurement
@@ -62,12 +61,11 @@ int main( int argc, char * argv[])
{
try
{
bool preserve = false, unwind = true, bind = false;
bool bind = false;
boost::program_options::options_description desc("allowed options");
desc.add_options()
("help", "help message")
("bind,b", boost::program_options::value< bool >( & bind), "bind thread to CPU")
("fpu,f", boost::program_options::value< bool >( & preserve), "preserve FPU registers")
("jobs,j", boost::program_options::value< boost::uint64_t >( & jobs), "jobs to run");
boost::program_options::variables_map vm;

View File

@@ -18,7 +18,6 @@
#include "../clock.hpp"
#include "../cycle.hpp"
bool preserve = false;
boost::uint64_t jobs = 1000;
struct X
@@ -46,7 +45,7 @@ void fn_x( boost::coroutines2::coroutine< X >::push_type & c)
duration_type measure_time_void( duration_type overhead)
{
boost::coroutines2::segmented_stack stack_alloc;
boost::coroutines2::coroutine< void >::pull_type c( stack_alloc, fn_void, preserve);
boost::coroutines2::coroutine< void >::pull_type c( stack_alloc, fn_void);
time_point_type start( clock_type::now() );
for ( std::size_t i = 0; i < jobs; ++i) {
@@ -63,7 +62,7 @@ duration_type measure_time_void( duration_type overhead)
duration_type measure_time_int( duration_type overhead)
{
boost::coroutines2::segmented_stack stack_alloc;
boost::coroutines2::coroutine< int >::pull_type c( stack_alloc, fn_int, preserve);
boost::coroutines2::coroutine< int >::pull_type c( stack_alloc, fn_int);
time_point_type start( clock_type::now() );
for ( std::size_t i = 0; i < jobs; ++i) {
@@ -80,7 +79,7 @@ duration_type measure_time_int( duration_type overhead)
duration_type measure_time_x( duration_type overhead)
{
boost::coroutines2::segmented_stack stack_alloc;
boost::coroutines2::coroutine< X >::pull_type c( stack_alloc, fn_x, preserve);
boost::coroutines2::coroutine< X >::pull_type c( stack_alloc, fn_x);
time_point_type start( clock_type::now() );
for ( std::size_t i = 0; i < jobs; ++i) {
@@ -98,7 +97,7 @@ duration_type measure_time_x( duration_type overhead)
cycle_type measure_cycles_void( cycle_type overhead)
{
boost::coroutines2::segmented_stack stack_alloc;
boost::coroutines2::coroutine< void >::pull_type c( stack_alloc, fn_void, preserve);
boost::coroutines2::coroutine< void >::pull_type c( stack_alloc, fn_void);
cycle_type start( cycles() );
for ( std::size_t i = 0; i < jobs; ++i) {
@@ -115,7 +114,7 @@ cycle_type measure_cycles_void( cycle_type overhead)
cycle_type measure_cycles_int( cycle_type overhead)
{
boost::coroutines2::segmented_stack stack_alloc;
boost::coroutines2::coroutine< int >::pull_type c( stack_alloc, fn_int, preserve);
boost::coroutines2::coroutine< int >::pull_type c( stack_alloc, fn_int);
cycle_type start( cycles() );
for ( std::size_t i = 0; i < jobs; ++i) {
@@ -132,7 +131,7 @@ cycle_type measure_cycles_int( cycle_type overhead)
cycle_type measure_cycles_x( cycle_type overhead)
{
boost::coroutines2::segmented_stack stack_alloc;
boost::coroutines2::coroutine< X >::pull_type c( stack_alloc, fn_x, preserve);
boost::coroutines2::coroutine< X >::pull_type c( stack_alloc, fn_x);
cycle_type start( cycles() );
for ( std::size_t i = 0; i < jobs; ++i) {
@@ -156,7 +155,6 @@ int main( int argc, char * argv[])
desc.add_options()
("help", "help message")
("bind,b", boost::program_options::value< bool >( & bind), "bind thread to CPU")
("fpu,f", boost::program_options::value< bool >( & preserve), "preserve FPU registers")
("jobs,j", boost::program_options::value< boost::uint64_t >( & jobs), "jobs to run");
boost::program_options::variables_map vm;