def SplitByKind(freqdict):
 kinds = {}
 for (kind_fullname, freq) in freqdict.items():
  (kind, fullname) = kind_fullname.split(',')
  if (not (kind in kinds)):
   kinds[kind] = []
  kinds[kind].append((fullname, freq['read'], freq['write'], freq['miss']))
 for kind in kinds:
  kinds[kind].sort(key=(lambda ent: (ent[1] + ent[2])), reverse=True)
 kinds_bycount = sorted(kinds.iteritems(), key=(lambda pair: len(pair[1])), reverse=True)
 maxcount = 0
 for kind in kinds:
  maxcount = max(maxcount, (kinds[kind][0][1] + kinds[kind][0][2]))
 return (kinds_bycount, maxcount)

def SplitByKind ( freqdict ) : kinds = { } for ( kind_fullname , freq ) in freqdict . items ( ) : ( kind , fullname ) = kind_fullname . split ( ',' ) if ( not ( kind in kinds ) ) : kinds [ kind ] = [ ] kinds [ kind ] . append ( ( fullname , freq [ 'read' ] , freq [ 'write' ] , freq [ 'miss' ] ) ) for kind in kinds : kinds [ kind ] . sort ( key = ( lambda ent : ( ent [ 1 ] + ent [ 2 ] ) ) , reverse = True ) kinds_bycount = sorted ( kinds . iteritems ( ) , key = ( lambda pair : len ( pair [ 1 ] ) ) , reverse = True ) maxcount = 0 for kind in kinds : maxcount = max ( maxcount , ( kinds [ kind ] [ 0 ] [ 1 ] + kinds [ kind ] [ 0 ] [ 2 ] ) ) return ( kinds_bycount , maxcount )
arranges entity/entity group access counts by their kind .