1 - you have named the variable ratio but from the small detail that you posted it looks like you should be calculating the frequency of the received signal. Whilst variables can have any name it would probably be better to give this one a name indicating what it is.
As to the calculation, the frequency of the Arduino has nothing to do with it as long as you count each change of state of the input (see 3 below). Suppose that you counted transitions between LOW and HIGH for 1 second and the total was 12,345 then the frequency would be 12,345 Hz
2 - If you mean in the portion of the program that is executed only when the period ends, then that is the right place
3 - Look at the StateChangeDetection example in the IDE. If you just poll the input each time through loop() then if it remains HIGH for more than one iteration of loop() you will get the wrong answer.
4 - do as little as possible in loop() when counting the changes of input state
You could do all of the above using an interrupt to detect and count the input changes of state but start by trying the polling method as you are now.