Friday, 15 April 2011

c++ - Code stolen by the compiler, how do I circumvent its criminal ways -



c++ - Code stolen by the compiler, how do I circumvent its criminal ways -

i wanted stress out processor on new computer @ work. figured way open thread each processor function:

void sostressful() { int j = 0; (int = 0; < 10000; ++i) { j += i; } }

but reason compiler takes code away. (because programme runs instantly regardless of complexity of calculation or size of i) , log little cpu usage.

how can stop compiler compiling out code? there improve way write programme stress pc?

if really want stress processor:

tan(atan(tan(atan(tan(atan(tan(atan(tan(atan(tan(atan(tan(atan(tan(atan(tan(atan(tan(atan(tan(atan(0.5d))))))))))))))))))))));

add whole lot more levels, , set loop.

this soak-test pdp-11 many years ago.

c++ multithreading compiler-construction for-loop compiler-optimization

No comments:

Post a Comment