view contrib/showstack.py @ 41036:b373477948df

revlog: limit base to rev size ratio to 500 instead of 50 While a value of 50 provided large speedup in some case (400s → 7s) it also creates a slow down for a whole class of revision we are seeing in a private repository (0.1s → 3s). A value of 500 makes them disappear improving the total runtime (the slower revision still improve significantly (400s → 21s)). We need to run a wider array of tests on various repositories to see the effect on speed and size of different values for this acceptable constant. However, in the meantime, it seems safer to move back to a less impactful value.
author Boris Feld <boris.feld@octobus.net>
date Wed, 19 Dec 2018 10:54:25 +0100
parents acf5dbe39478
children 6dae1f31c6c9
line wrap: on
line source

# showstack.py - extension to dump a Python stack trace on signal
#
# binds to both SIGQUIT (Ctrl-\) and SIGINFO (Ctrl-T on BSDs)
"""dump stack trace when receiving SIGQUIT (Ctrl-\) and SIGINFO (Ctrl-T on BSDs)
"""

from __future__ import absolute_import, print_function
import signal
import sys
import traceback

def sigshow(*args):
    sys.stderr.write("\n")
    traceback.print_stack(args[1], limit=10, file=sys.stderr)
    sys.stderr.write("----\n")

def sigexit(*args):
    sigshow(*args)
    print('alarm!')
    sys.exit(1)

def extsetup(ui):
    signal.signal(signal.SIGQUIT, sigshow)
    signal.signal(signal.SIGALRM, sigexit)
    try:
        signal.signal(signal.SIGINFO, sigshow)
    except AttributeError:
        pass