The last test function in test_brute_force_knapsack.R has possible bug. The following two lines are my problem.
st <- system.time(bfk <- brute_force_knapsack(x = knapsack_objects[1:16,], W = 2000))
I have this output for the first line.
user system elapsed
0.348 0.000 0.348
And second line checks system column. However, it is zero everytime.
expect_true(as.numeric(st)[2] > 0.00)
So, I looked at the manual and the manual redirected me to proc.time function documentation.
It says The definition of ‘user’ and ‘system’ times is from your OS.
I use Ubuntu, searched in ubuntu forum and found very useful answer for it.
In the answer, he said:
So that's what your output means - there was no switch to kernel mode and CPU did not receive any interrupts from the program to do so. This also means that your code doesn't have anything that would require elevated privileges from CPU
In conclusion, I think we should change the column with user or elapsed. This is because we do not have any interruption during execution obviously. Probably processor is fast enough to not take interruption.
Here is information of my CPU:
model name : Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
The last test function in test_brute_force_knapsack.R has possible bug. The following two lines are my problem.
I have this output for the first line.
And second line checks system column. However, it is zero everytime.
So, I looked at the manual and the manual redirected me to proc.time function documentation.
It says The definition of ‘user’ and ‘system’ times is from your OS.
I use Ubuntu, searched in ubuntu forum and found very useful answer for it.
In the answer, he said:
In conclusion, I think we should change the column with user or elapsed. This is because we do not have any interruption during execution obviously. Probably processor is fast enough to not take interruption.
Here is information of my CPU:
model name : Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz