Skip to content
Snippets Groups Projects
Commit 960e8838 authored by toole1's avatar toole1
Browse files

monad update; trivial max number of generator function iterations

git-svn-id: https://subversion.cs.illinois.edu/svn/cs225@5131 6fbd10e7-183d-0410-a318-cb416676e4f2
parent fdd7251b
No related branches found
No related tags found
No related merge requests found
monad identification file
This file is used for monad directory identification
Built by toole1 on linux4.ews.illinois.edu
Build Date: Mon Oct 24 23:45:56 CDT 2011
Build Date: Wed Oct 26 16:33:52 CDT 2011
......@@ -318,6 +318,7 @@ template <typename Generator, typename Timer>
TimeIterationsData timeIterationsImpl(Generator gen, Timer timeFunctor, size_t input_size)
{
const uint64_t min_time = 1000000; // in microseconds
const size_t max_gen_iterations = 1000000;
std::vector<typename Generator::result_type *> inputs;
inputs.reserve(2000); // arbitrary, guess at how big it will be
......@@ -326,7 +327,7 @@ TimeIterationsData timeIterationsImpl(Generator gen, Timer timeFunctor, size_t i
// We're also going to do something else weird here. Instead of generating a fixed number of inputs, we're
// going to generate inputs for a fixed time.
size_t max_iterations = 0;
for (uint64_t genstart = util::process_clock(); util::process_clock() - genstart < min_time; max_iterations++)
for (uint64_t genstart = util::process_clock(); max_iterations < max_gen_iterations && util::process_clock() - genstart < min_time; max_iterations++)
inputs.push_back(new typename Generator::result_type(gen(input_size)));
typename Generator::result_type warmup_temp = gen(1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment