#NEWLINE# def _process_stats( self ) : #NEWLINE# #INDENT# ' Process query statistics\n\n        Generate sorted :class:`QueryGroup` in :param:self._query_groups and\n        all-in-one :class:`QueryGroup` in :param:self._all_group\n        ' #NEWLINE# query_groups = collections . defaultdict ( QueryGroup ) #NEWLINE# all_group = QueryGroup ( ) #NEWLINE# for qstats in self . stats : #NEWLINE# #INDENT# qstats . stack_text = '' . join ( traceback . format_list ( qstats . stack ) ) . strip ( ) #NEWLINE# group = query_groups [ str ( qstats . text ) ] #NEWLINE# group . add ( query_groups ) #NEWLINE# all_group . add ( qstats ) #NEWLINE# #UNINDENT# query_groups = sorted ( query_groups . values ( ) , key = ( lambda g : g . sum ) , reverse = True ) #NEWLINE# for g in query_groups : #NEWLINE# #INDENT# g . calc_median ( ) #NEWLINE# #UNINDENT# self . _query_groups = query_groups #NEWLINE# self . _all_group = all_group