mirror of
https://github.com/boostorg/coroutine.git
synced 2026-01-30 19:52:18 +00:00
print overhead of measurement in preformance tests
This commit is contained in:
@@ -28,8 +28,8 @@ struct X
|
||||
{}
|
||||
};
|
||||
|
||||
typedef boost::coroutines::symmetric_coroutine< X&> coro1_t;
|
||||
typedef boost::coroutines::symmetric_coroutine< X&> coro2_t;
|
||||
typedef boost::coroutines::symmetric_coroutine< X* > coro1_t;
|
||||
typedef boost::coroutines::symmetric_coroutine< X* > coro2_t;
|
||||
|
||||
coro1_t * c1;
|
||||
coro2_t * c2;
|
||||
@@ -37,28 +37,31 @@ coro2_t * c2;
|
||||
void fn1( coro1_t::self_type & self)
|
||||
{
|
||||
Y y;
|
||||
X x( 0);
|
||||
X * x = 0;
|
||||
std::cout << "fn1: start" << std::endl;
|
||||
|
||||
if ( self) x = self.get();
|
||||
std::cout << "fn1: i == " << x.i << std::endl;
|
||||
self( * c2, X(x.i + 1));
|
||||
std::cout << "fn1: i == " << x->i << std::endl;
|
||||
x->i += 1;
|
||||
self( * c2, x);
|
||||
|
||||
if ( self) x = self.get();
|
||||
std::cout << "fn1: i == " << x.i << std::endl;
|
||||
self( * c2, X(x.i + 1));
|
||||
std::cout << "fn1: i == " << x->i << std::endl;
|
||||
x->i += 1;
|
||||
self( * c2, x);
|
||||
std::cout << "fn1: finish" << std::endl;
|
||||
}
|
||||
|
||||
void fn2( coro2_t::self_type & self)
|
||||
{
|
||||
std::cout << "fn2: start" << std::endl;
|
||||
X x( 0);
|
||||
X * x = 0;
|
||||
if ( self) x = self.get();
|
||||
std::cout << "fn2: i == " << x.i << std::endl;
|
||||
self( * c1, X(7));
|
||||
std::cout << "fn2: i == " << x->i << std::endl;
|
||||
x->i = 7;
|
||||
self( * c1, x);
|
||||
if ( self) x = self.get();
|
||||
std::cout << "fn2: i == " << x.i << std::endl;
|
||||
std::cout << "fn2: i == " << x->i << std::endl;
|
||||
std::cout << "fn2: finish" << std::endl;
|
||||
}
|
||||
|
||||
@@ -69,7 +72,7 @@ int main( int argc, char * argv[])
|
||||
c1 = & c1_;
|
||||
c2 = & c2_;
|
||||
X x(3);
|
||||
c1_( x);
|
||||
c1_( & x);
|
||||
std::cout << "Done" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user