Having Trouble in Module 2 MileStone 2

So far i have found the Mhz(speed) of the 2 CPUs in my system from /proc/cpuinfo and assigned it to a variable.
I’m confused about what to do next.

  1. Am I supposed to pick the max value out of it by converting it to an array and and then finding a max value and then Calculate the idle RAM? or can I pick any one of them since they’re the same?

@Mann
As the only direction from todo is:

If there are multiple cores, make sure you filter to pick one to populate “cpuSpeedInMHz”

Selecting any of the values could be sufficient

selecting the max value gave build failure for me

try selecting the first one

1 Like

still build failure…

You can calculate the average and use that as the overall cpu speed.

@Mann @tsaideepak
My build got successful by selecting the first one

I’m still having trouble understanding what to subtract from the MHz speed which i got.
I looked into the idle colum (4) in /proc/stat and should I convert that to MHz and then subtract it from the MHz from the /proc/cpuinfo ?

Or should i Htop to see the % of usage and then subtract to get idle Mhz?

Just choose the max one(or anyone)

no need to to any additional calculations? like idle cpu and all?

Nope not required…

Okay i did that and got a value bigger than the min 1000 but after execution it says it’s not sufficient. Am I missing something?

how i convert float to int?

I am getting this message on on running the script : CPU Speed of 2499 MHz is sufficient for QBox
but on submitin it I am getting a build failure . with message :

2020-02-04 21:42:21,853 unitTesting INFO Running command_runner
2020-02-04 21:42:21,854 unitTesting INFO Module setup complete!
2020-02-04 21:42:21,854 unitTesting INFO Starting assessment…
2020-02-04 21:42:21,854 unitTesting INFO Assessing check_QBox_server_cpu.sh
2020-02-04 21:42:22,594 unitTesting ERROR /divyashahi139-ME_QBOX-

36354160-4797-11ea-b4b0-4f890681b991/execution_dir/check_QBox_server_cpu.sh /proc/cpuinfo returncode > 0! Check your code.

2020-02-04 21:42:22,596 unitTesting INFO File: check_QBox_server_cpu.sh | Status: TEST_STATUS_FAILURE can anyone help

just remove the decimal part once you are able to get the result in float. Use pattern matching, " .* " would select everything after decimal

yeah same here. My cpu MHZ value is more than the required value but it’s printing insufficient?

How do we convert the values from /proc/stat to MHz??

bro you got the error? if yes the please guide me.
i am having same error as of yours