Merge pull request #27 from gutenbergtools/diagnostics

add thread report
better-twitter
eshellman 2019-08-05 12:28:41 -04:00 committed by GitHub
commit 82e7230eca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -13,10 +13,15 @@ import resource
import sys import sys
from collections import Mapping, Container from collections import Mapping, Container
from sys import getsizeof from sys import getsizeof
import threading
import cherrypy import cherrypy
from cherrypy.lib.sessions import RamSession from cherrypy.lib.sessions import RamSession
from Page import Page from Page import Page
def thread_info():
return [t.name for t in threading.enumerate()]
def deep_getsizeof(o, ids): def deep_getsizeof(o, ids):
"""Find the memory footprint of a Python object """Find the memory footprint of a Python object
@ -66,5 +71,6 @@ class DiagnosticsPage (Page):
stats['allocated_blocks'] = sys.getallocatedblocks() stats['allocated_blocks'] = sys.getallocatedblocks()
stats['rusage_self'] = resource.getrusage(resource.RUSAGE_SELF) stats['rusage_self'] = resource.getrusage(resource.RUSAGE_SELF)
stats['rusage_children'] = resource.getrusage(resource.RUSAGE_CHILDREN) stats['rusage_children'] = resource.getrusage(resource.RUSAGE_CHILDREN)
stats['thread_info'] = thread_info()
return stats return stats