Blame SOURCES/00231-cprofile-sort-option.patch
|
|
057d67 |
From 0fba878e37390b581b95b31ff7d42041c9a3a370 Mon Sep 17 00:00:00 2001
|
|
|
057d67 |
From: Charalampos Stratakis <cstratak@redhat.com>
|
|
|
057d67 |
Date: Tue, 12 Apr 2016 14:17:32 +0200
|
|
|
057d67 |
Subject: [PATCH] add choices for sort option of cProfile for better output
|
|
|
057d67 |
message
|
|
|
057d67 |
|
|
|
057d67 |
---
|
|
|
057d67 |
Lib/cProfile.py | 5 +++--
|
|
|
057d67 |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
057d67 |
|
|
|
057d67 |
diff --git a/Lib/cProfile.py b/Lib/cProfile.py
|
|
|
057d67 |
index b2efd04..02acd4e 100755
|
|
|
057d67 |
--- a/Lib/cProfile.py
|
|
|
057d67 |
+++ b/Lib/cProfile.py
|
|
|
057d67 |
@@ -161,7 +161,7 @@ def label(code):
|
|
|
057d67 |
# ____________________________________________________________
|
|
|
057d67 |
|
|
|
057d67 |
def main():
|
|
|
057d67 |
- import os, sys
|
|
|
057d67 |
+ import os, pstats, sys
|
|
|
057d67 |
from optparse import OptionParser
|
|
|
057d67 |
usage = "cProfile.py [-o output_file_path] [-s sort] scriptfile [arg] ..."
|
|
|
057d67 |
parser = OptionParser(usage=usage)
|
|
|
057d67 |
@@ -170,7 +170,8 @@ def main():
|
|
|
057d67 |
help="Save stats to <outfile>", default=None)
|
|
|
057d67 |
parser.add_option('-s', '--sort', dest="sort",
|
|
|
057d67 |
help="Sort order when printing to stdout, based on pstats.Stats class",
|
|
|
057d67 |
- default=-1)
|
|
|
057d67 |
+ default=-1,
|
|
|
057d67 |
+ choices=list(pstats.Stats.sort_arg_dict_default.keys()))
|
|
|
057d67 |
|
|
|
057d67 |
if not sys.argv[1:]:
|
|
|
057d67 |
parser.print_usage()
|
|
|
057d67 |
--
|
|
|
057d67 |
2.5.5
|
|
|
057d67 |
|