allocate on stack

This commit is contained in:
Oliver Kowalke
2014-01-25 23:41:06 +01:00
parent 8857a31281
commit 7b6bba07c0
17 changed files with 2166 additions and 2580 deletions

View File

@@ -18,12 +18,13 @@
#include "cycle.hpp"
#include "preallocated_stack_allocator.hpp"
typedef preallocated_stack_allocator< 64 * 1024 > stack_allocator;
typedef preallocated_stack_allocator< 64 * 1024 > stack_allocator;
typedef boost::coroutines::coroutine< void, stack_allocator > coroutine;
boost::coroutines::flag_fpu_t preserve_fpu = boost::coroutines::fpu_not_preserved;
boost::uint64_t jobs = 1000;
void fn( boost::coroutines::coroutine< void >::push_type & c)
void fn( coroutine::push_type & c)
{ while ( true) c(); }
duration_type measure_time()
@@ -31,13 +32,13 @@ duration_type measure_time()
stack_allocator stack_alloc( jobs + 1);
// cache warum-up
boost::coroutines::coroutine< void >::pull_type c( fn,
coroutine::pull_type c( fn,
boost::coroutines::attributes( stack_allocator::default_stacksize(), preserve_fpu),
stack_alloc);
time_point_type start( clock_type::now() );
for ( std::size_t i = 0; i < jobs; ++i) {
boost::coroutines::coroutine< void >::pull_type c( fn,
coroutine::pull_type c( fn,
boost::coroutines::attributes( stack_allocator::default_stacksize(), preserve_fpu),
stack_alloc);
}
@@ -54,13 +55,13 @@ cycle_type measure_cycles()
stack_allocator stack_alloc( jobs + 1);
// cache warum-up
boost::coroutines::coroutine< void >::pull_type c( fn,
coroutine::pull_type c( fn,
boost::coroutines::attributes( stack_allocator::default_stacksize(), preserve_fpu),
stack_alloc);
cycle_type start( cycles() );
for ( std::size_t i = 0; i < jobs; ++i) {
boost::coroutines::coroutine< void >::pull_type c( fn,
coroutine::pull_type c( fn,
boost::coroutines::attributes( stack_allocator::default_stacksize(), preserve_fpu),
stack_alloc);
}