parameters: (self, tab)
return_statement: return int(speed_index)
docstring: Calculate the speed index.
  
      The speed index number conceptually represents the number of milliseconds
      that the page was "visually incomplete". If the page were 0% complete for
      1000 ms, then the score would be 1000; if it were 0% complete for 100 ms
      then 90% complete (ie 10% incomplete) for 900 ms, then the score would be
      1.0*100 + 0.1*900 = 190.
  
      Returns:
        A single number, milliseconds of visual incompleteness.
docstring_summary: Calculate the speed index.
docstring_tokens: Calculate the speed index .
function: def CalculateSpeedIndex(self, tab):
      """Calculate the speed index.
  
      The speed index number conceptually represents the number of milliseconds
      that the page was "visually incomplete". If the page were 0% complete for
      1000 ms, then the score would be 1000; if it were 0% complete for 100 ms
      then 90% complete (ie 10% incomplete) for 900 ms, then the score would be
      1.0*100 + 0.1*900 = 190.
  
      Returns:
        A single number, milliseconds of visual incompleteness.
      """
      time_completeness_list = self.GetTimeCompletenessList(tab)
      prev_completeness = 0.0
      speed_index = 0.0
      prev_time = time_completeness_list[0][0]
      for time, completeness in time_completeness_list:
        # Add the incemental value for the interval just before this event.
        elapsed_time = time - prev_time
        incompleteness = (1.0 - prev_completeness)
        speed_index += elapsed_time * incompleteness
  
        # Update variables for next iteration.
        prev_completeness = completeness
        prev_time = time
      return int(speed_index)
function_tokens: def CalculateSpeedIndex ( self , tab ) : time_completeness_list = self . GetTimeCompletenessList ( tab ) prev_completeness = 0.0 speed_index = 0.0 prev_time = time_completeness_list [ 0 ] [ 0 ] for time , completeness in time_completeness_list : # Add the incemental value for the interval just before this event. elapsed_time = time - prev_time incompleteness = ( 1.0 - prev_completeness ) speed_index += elapsed_time * incompleteness # Update variables for next iteration. prev_completeness = completeness prev_time = time return int ( speed_index )