(self, *field)
| 235 | return self.sort_arg_dict |
| 236 | |
| 237 | def sort_stats(self, *field): |
| 238 | if not field: |
| 239 | self.fcn_list = 0 |
| 240 | return self |
| 241 | if len(field) == 1 and isinstance(field[0], int): |
| 242 | # Be compatible with old profiler |
| 243 | field = [ {-1: "stdname", |
| 244 | 0: "calls", |
| 245 | 1: "time", |
| 246 | 2: "cumulative"}[field[0]] ] |
| 247 | elif len(field) >= 2: |
| 248 | for arg in field[1:]: |
| 249 | if type(arg) != type(field[0]): |
| 250 | raise TypeError("Can't have mixed argument type") |
| 251 | |
| 252 | sort_arg_defs = self.get_sort_arg_defs() |
| 253 | |
| 254 | sort_tuple = () |
| 255 | self.sort_type = "" |
| 256 | connector = "" |
| 257 | for word in field: |
| 258 | if isinstance(word, SortKey): |
| 259 | word = word.value |
| 260 | sort_tuple = sort_tuple + sort_arg_defs[word][0] |
| 261 | self.sort_type += connector + sort_arg_defs[word][1] |
| 262 | connector = ", " |
| 263 | |
| 264 | stats_list = [] |
| 265 | for func, (cc, nc, tt, ct, callers) in self.stats.items(): |
| 266 | stats_list.append((cc, nc, tt, ct) + func + |
| 267 | (func_std_string(func), func)) |
| 268 | |
| 269 | stats_list.sort(key=cmp_to_key(TupleComp(sort_tuple).compare)) |
| 270 | |
| 271 | self.fcn_list = fcn_list = [] |
| 272 | for tuple in stats_list: |
| 273 | fcn_list.append(tuple[-1]) |
| 274 | return self |
| 275 | |
| 276 | def reverse_order(self): |
| 277 | if self.fcn_list: |
no test coverage detected