On 2014-01-17, ZStefan <ZStefan@no-mx.forums.opensuse.org> wrote:

>

> This is the simplified program. When I compile and run it on a computer,

> the speed of one iteration appears to be bistable, with durations

> varying about 2.5 times. Sometimes the speed changes in the middle of

> run (looping), say, after 10th iteration.

>

<SNIP>

>

> This looks like a bug, but I cannot figure out where. I have written

> many programs in C and C++ and have never observed such a behavior of

> the compiled program. The computer is not loaded with any other

> processes.

>

> This is 64 bit computer running 64 bit opensuse 13.1, updated.

Thank you for posting the code. This is the result of my first run (openSUSE 13.1 x86_64 KDE, fully updated):

```
sh-4.2$ g++ a.cpp
sh-4.2$ ./a.out
Time of one iteration = 2.6495 s, computation result = 9.366910e+08
Time of one iteration = 2.6481 s, computation result = 5.707878e+08
Time of one iteration = 2.6480 s, computation result = 4.978989e+08
Time of one iteration = 2.6479 s, computation result = 1.190977e+09
Time of one iteration = 2.6481 s, computation result = 9.298645e+08
Time of one iteration = 2.6478 s, computation result = 1.552897e+08
Time of one iteration = 2.6478 s, computation result = 1.710884e+09
Time of one iteration = 2.6477 s, computation result = 2.023878e+09
Time of one iteration = 2.6482 s, computation result = 1.185668e+09
Time of one iteration = 2.6480 s, computation result = 1.627396e+09
Time of one iteration = 2.6479 s, computation result = 1.285587e+09
Time of one iteration = 2.6479 s, computation result = 1.284789e+09
Time of one iteration = 2.6480 s, computation result = 5.410588e+07
Time of one iteration = 2.6480 s, computation result = 8.577717e+08
Time of one iteration = 2.6479 s, computation result = 1.333628e+09
Time of one iteration = 2.6480 s, computation result = 6.056444e+08
Time of one iteration = 2.6482 s, computation result = 1.130641e+09
Time of one iteration = 2.6480 s, computation result = 8.075440e+08
Time of one iteration = 2.6480 s, computation result = 1.071738e+09
Time of one iteration = 2.6481 s, computation result = 1.497799e+09
Time of one iteration = 2.6482 s, computation result = 6.832906e+08
Time of one iteration = 2.6480 s, computation result = 1.850542e+09
Time of one iteration = 2.6479 s, computation result = 2.099904e+09
Time of one iteration = 2.6479 s, computation result = 6.601369e+08
Time of one iteration = 2.6480 s, computation result = 1.654135e+09
Time of one iteration = 2.6482 s, computation result = 1.265377e+09
Time of one iteration = 2.6480 s, computation result = 7.491475e+08
Time of one iteration = 2.6481 s, computation result = 1.618072e+09
Time of one iteration = 2.6479 s, computation result = 9.804571e+08
Time of one iteration = 2.6482 s, computation result = 9.666316e+08
Time of one iteration = 2.6481 s, computation result = 1.076384e+09
Time of one iteration = 2.6480 s, computation result = 1.915146e+09
Time of one iteration = 2.6481 s, computation result = 1.325639e+09
Time of one iteration = 2.6479 s, computation result = 1.309158e+09
Time of one iteration = 2.6481 s, computation result = 1.040363e+09
Time of one iteration = 2.6480 s, computation result = 8.497754e+08
Time of one iteration = 2.6481 s, computation result = 2.008792e+09
Time of one iteration = 2.6480 s, computation result = 3.436796e+08
Time of one iteration = 2.6480 s, computation result = 4.997928e+08
Time of one iteration = 2.6477 s, computation result = 1.252841e+09
Time of one iteration = 2.6481 s, computation result = 1.206959e+09
Time of one iteration = 2.6478 s, computation result = 1.049436e+09
Time of one iteration = 2.6480 s, computation result = 9.855468e+07
Time of one iteration = 2.6482 s, computation result = 1.643193e+09
Time of one iteration = 2.6480 s, computation result = 1.217729e+09
Time of one iteration = 2.6482 s, computation result = 4.503854e+08
Time of one iteration = 2.6479 s, computation result = 1.326227e+09
Time of one iteration = 2.6479 s, computation result = 1.415164e+09
Time of one iteration = 2.6479 s, computation result = 9.095195e+08
Time of one iteration = 2.6477 s, computation result = 1.485605e+09
Time of one iteration = 2.6481 s, computation result = 4.506785e+08
Time of one iteration = 2.6480 s, computation result = 1.261918e+09
Time of one iteration = 2.6480 s, computation result = 2.026706e+09
Time of one iteration = 2.6481 s, computation result = 7.786600e+08
Time of one iteration = 2.6481 s, computation result = 1.524530e+09
Time of one iteration = 2.6476 s, computation result = 1.570667e+09
Time of one iteration = 2.6481 s, computation result = 1.206787e+09
Time of one iteration = 2.6478 s, computation result = 1.250838e+09
Time of one iteration = 2.6480 s, computation result = 2.095063e+09
Time of one iteration = 2.6481 s, computation result = 1.865386e+09
Time of one iteration = 2.6480 s, computation result = 3.281944e+08
Time of one iteration = 2.6480 s, computation result = 1.132857e+09
Time of one iteration = 2.6478 s, computation result = 6.180122e+08
Time of one iteration = 2.6479 s, computation result = 6.900676e+08
Time of one iteration = 2.6479 s, computation result = 1.615849e+09
Time of one iteration = 2.6481 s, computation result = 1.126033e+09
Time of one iteration = 2.6479 s, computation result = 2.139742e+09
Time of one iteration = 2.6478 s, computation result = 1.894477e+08
Time of one iteration = 2.6477 s, computation result = 1.631572e+09
Time of one iteration = 2.6479 s, computation result = 8.535685e+08
Time of one iteration = 2.6481 s, computation result = 1.273882e+09
Time of one iteration = 2.6482 s, computation result = 1.660796e+08
Time of one iteration = 2.6482 s, computation result = 1.038502e+09
Time of one iteration = 2.6482 s, computation result = 5.600697e+07
Time of one iteration = 2.6482 s, computation result = 1.619022e+09
Time of one iteration = 2.6481 s, computation result = 6.123897e+08
Time of one iteration = 2.6481 s, computation result = 8.961824e+08
Time of one iteration = 2.6483 s, computation result = 1.648120e+09
Time of one iteration = 2.6481 s, computation result = 1.074455e+09
Time of one iteration = 2.6481 s, computation result = 1.626155e+09
Time of one iteration = 2.6482 s, computation result = 1.550417e+09
Time of one iteration = 2.6483 s, computation result = 1.369261e+08
Time of one iteration = 2.6479 s, computation result = 2.025879e+09
Time of one iteration = 2.6481 s, computation result = 4.188721e+08
Time of one iteration = 2.6482 s, computation result = 1.167625e+09
Time of one iteration = 2.6483 s, computation result = 1.395522e+09
Time of one iteration = 2.6480 s, computation result = 1.273302e+09
Time of one iteration = 2.6481 s, computation result = 1.901946e+09
Time of one iteration = 2.6478 s, computation result = 9.852336e+08
Time of one iteration = 2.6482 s, computation result = 1.411876e+09
Time of one iteration = 2.6481 s, computation result = 1.194318e+09
Time of one iteration = 2.6479 s, computation result = 9.078349e+07
Time of one iteration = 2.6480 s, computation result = 3.560195e+08
Time of one iteration = 2.6480 s, computation result = 1.043311e+08
Time of one iteration = 2.6480 s, computation result = 8.975936e+08
Time of one iteration = 2.6482 s, computation result = 1.611007e+09
Time of one iteration = 2.6481 s, computation result = 1.073908e+09
Time of one iteration = 2.6480 s, computation result = 1.342637e+09
Time of one iteration = 2.6482 s, computation result = 8.293112e+08
Time of one iteration = 2.6482 s, computation result = 2.042515e+09
Time of one iteration = 2.6481 s, computation result = 1.620367e+09
Time of one iteration = 2.6481 s, computation result = 9.631723e+08
Time of one iteration = 2.6481 s, computation result = 1.870537e+09
Time of one iteration = 2.6480 s, computation result = 2.074187e+09
Time of one iteration = 2.6481 s, computation result = 9.977173e+08
Time of one iteration = 2.6482 s, computation result = 1.094236e+09
Time of one iteration = 2.6484 s, computation result = 2.101217e+09
Time of one iteration = 2.6481 s, computation result = 4.879628e+08
Time of one iteration = 2.6483 s, computation result = 1.372519e+08
Time of one iteration = 2.6480 s, computation result = 1.352022e+09
Time of one iteration = 2.6480 s, computation result = 1.427920e+09
Time of one iteration = 2.6480 s, computation result = 8.491647e+08
Time of one iteration = 2.6480 s, computation result = 1.062124e+09
Time of one iteration = 2.6480 s, computation result = 4.722387e+08
Time of one iteration = 2.6480 s, computation result = 9.563156e+08
Time of one iteration = 2.6481 s, computation result = 1.815737e+09
^C
sh-4.2$
```

As you can see there’s very little variation in time of each iteration (out of >100). Unfortunately I cannot reproduce

your problem despite trying the following:

- Running it as a different user.
- Rebooting repeatedly.
- Disabling/re-enabling swap.

At the very least, the results suggest this is unlikely to be a bug. Unfortunately this isn’t very helpful in

identifying the cause of your results. I suspect this is a tough one to solve. While we are running the same openSUSE

version, our configurations are likely to differ. It would be helpful if anyone else can try out your code to see if my

configuration or your configuration is the odd one out. I would also be interested to see if can reproduce the problem

you see running the code at runlevel 2.