mirror of
https://github.com/NaN-tic/trytond-patches.git
synced 2023-12-14 06:03:03 +01:00
Improve top.diff to include faulthandler.
(grafted from 3e98153750b679887d39475365411ced3ad506e8)
This commit is contained in:
parent
31f424b006
commit
4359cd312d
8
top.diff
8
top.diff
|
@ -44,6 +44,7 @@ diff -r 649b0805fa93 trytond/protocols/top.py
|
||||||
+import signal
|
+import signal
|
||||||
+import locale
|
+import locale
|
||||||
+import sys
|
+import sys
|
||||||
|
+import faulthandler
|
||||||
+from operator import itemgetter
|
+from operator import itemgetter
|
||||||
+from datetime import datetime
|
+from datetime import datetime
|
||||||
+
|
+
|
||||||
|
@ -89,7 +90,7 @@ diff -r 649b0805fa93 trytond/protocols/top.py
|
||||||
+ print
|
+ print
|
||||||
+
|
+
|
||||||
+# End Printing Tables
|
+# End Printing Tables
|
||||||
+
|
+
|
||||||
+def signal_user_handler(signal, frame):
|
+def signal_user_handler(signal, frame):
|
||||||
+ print '-' * 30
|
+ print '-' * 30
|
||||||
+ if current_actions:
|
+ if current_actions:
|
||||||
|
@ -99,7 +100,7 @@ diff -r 649b0805fa93 trytond/protocols/top.py
|
||||||
+ 'timestamp', 'elapsed', 'object_name', 'method', 'args')
|
+ 'timestamp', 'elapsed', 'object_name', 'method', 'args')
|
||||||
+ table = []
|
+ table = []
|
||||||
+ table.append([x.upper() for x in header])
|
+ table.append([x.upper() for x in header])
|
||||||
+
|
+
|
||||||
+ for action in sorted(current_actions.values(), key=itemgetter('timestamp')):
|
+ for action in sorted(current_actions.values(), key=itemgetter('timestamp')):
|
||||||
+ row = []
|
+ row = []
|
||||||
+ for key in header:
|
+ for key in header:
|
||||||
|
@ -112,8 +113,9 @@ diff -r 649b0805fa93 trytond/protocols/top.py
|
||||||
+ table.append(row)
|
+ table.append(row)
|
||||||
+ pprint_table(table)
|
+ pprint_table(table)
|
||||||
+ print '=' * 30
|
+ print '=' * 30
|
||||||
+
|
+
|
||||||
+signal.signal(signal.SIGUSR1, signal_user_handler)
|
+signal.signal(signal.SIGUSR1, signal_user_handler)
|
||||||
|
+faulthandler.register(signal.SIGUSR2)
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+def add(value):
|
+def add(value):
|
||||||
|
|
Loading…
Reference in a new issue