Can the duration of the whistle determine if food inside a pressure cooker is cooked
The short answer to that question is no. The whistling sound is just a signal to reduce the heat.

Here's an excerpt from the Hawkins Pressure Cooker Operating Guide:


  After the pressure regulator is placed on the steam vent, there is at first a very low hissing sound of steam from the pressure regulator. Then steam emission increases to full force and the pressure regulator lifts with a whistling sound. The cooker is now at full operating pressure. This is the point at which to reduce heat and start timing the recipe.
  


So, the timing or frequency of whistles is a function of how hot the pressure cooker is at any given time, and most importantly, a warning to turn down your stove, so that a catastrophe does not ensue.

As the Hawkins manual explains, start timing your recipe once the cooker has reached operating pressure. The actual timing of course, will vary, depending on the particular food you're cooking.