I have some code written in c++ that simulates a prefetcher for a CPU. In the code I have some definitions that look like this
#define x 5
...
for(int i = 0; i < x; i++)
...
At the end of the simulation the simulator outputs the average access time which is a measure of how good the prefetcher did. The performance of the prefetcher depends on x and some other similar definitions.
I would like to have a program that changes x, recompiles the new code, runs it, looks at the value, and based on the change in simulated access time repeats the process.
Does anyone know of an easy way to do this that isn't manually changing values?
EDIT: I think I need to clarify that I do not want to have to program a learning algorithm since I have never done it and probably couldn't do it nearly as well as others.