def SortedRPCSummaries(urlstats, summary_percentile):
 rpcsummary = {}
 for (index, request) in enumerate(reversed(urlstats.urlrequestlist)):
  for rpc in request.rpcstatslist:
   label = rpc.GetLabel()
   if (label not in rpcsummary):
    rpcsummary[label] = RPCSummary()
   summary = rpcsummary[label]
   summary.requests += 1
   summary.calls += rpc.numcalls
   summary.times.append(rpc.time)
   summary.indices.append(index)
   successful_reads = (len(rpc.keys_read) - len(rpc.keys_failed_get))
   summary.stats.append((rpc.numcalls, successful_reads, len(rpc.keys_written), len(rpc.keys_failed_get)))
 for label in rpcsummary:
  summary = _GetPercentile(sorted(rpcsummary[label].times), summary_percentile)
  rpcsummary[label].summary_time = summary
 rpcsummary_sort = sorted(rpcsummary.iteritems(), key=(lambda pair: pair[1].summary_time), reverse=True)
 return rpcsummary_sort

def SortedRPCSummaries ( urlstats , summary_percentile ) : rpcsummary = { } for ( index , request ) in enumerate ( reversed ( urlstats . urlrequestlist ) ) : for rpc in request . rpcstatslist : label = rpc . GetLabel ( ) if ( label not in rpcsummary ) : rpcsummary [ label ] = RPCSummary ( ) summary = rpcsummary [ label ] summary . requests += 1 summary . calls += rpc . numcalls summary . times . append ( rpc . time ) summary . indices . append ( index ) successful_reads = ( len ( rpc . keys_read ) - len ( rpc . keys_failed_get ) ) summary . stats . append ( ( rpc . numcalls , successful_reads , len ( rpc . keys_written ) , len ( rpc . keys_failed_get ) ) ) for label in rpcsummary : summary = _GetPercentile ( sorted ( rpcsummary [ label ] . times ) , summary_percentile ) rpcsummary [ label ] . summary_time = summary rpcsummary_sort = sorted ( rpcsummary . iteritems ( ) , key = ( lambda pair : pair [ 1 ] . summary_time ) , reverse = True ) return rpcsummary_sort
summarize rpc statistics of requests for ui .