def dumpTrace(start=0, end=-1): ## Use start=-3, end=-2 if you only want to see the calling ## function of the function that calls dumpTrace. lock.acquire() try: stack = traceback.extract_stack() depth = len(stack) thread = threadstate.findThreadNumber() if parallel_enable.enabled(): from ooflib.SWIG.common import mpitools rank = "%02d" % mpitools.Rank() else: rank = '--' lines = [ '+++-%04d-%02d-%s--------- debug.dumpTrace --------------' % (depth, thread, rank) ] for line in stack[start:end]: lines.append('+++%30s:%3d\t%s\t\t%s' % (line[0], line[1], line[2], line[3])) lines.append('+++-------------- end trace -----------------') print >> sys.stderr, string.join(lines, '\n') finally: lock.release()
def fmsg(*args): from ooflib.SWIG.common import ooferror if _debug_mode: lock.acquire() try: stack = traceback.extract_stack() depth = len(stack) filename = string.split(stack[-2][0], '/')[-1] func = stack[-2][2] line = stack[-2][1] try: thread = "%02d"% threadstate.findThreadNumber() except: thread = '??' if parallel_enable.enabled(): from ooflib.SWIG.common import mpitools rank="%02d" % mpitools.Rank() else: rank='--' print >> sys.stderr, \ ('-%04d-%s-%s'%(depth,thread,rank))+'-'*(depth-1), \ '%s(%d):%s'%(filename, line, func),\ string.join(map(str, args), ' ') finally: # pass lock.release()
def fmsg(*args): ## Importing ooferror here hangs the program when a binary data ## file is loaded if fmsg is used in OOFIdleCallback. WTF? There ## may be no real need to import ooferror here, but it was ## imported here once, and mysteriously caused a problem. ## (There's a comment in mainthreadGUI that refers to this ## comment.) # from ooflib.SWIG.common import ooferror if _debug_mode: lock.acquire() try: stack = traceback.extract_stack() depth = len(stack) filename = string.split(stack[-2][0], '/')[-1] func = stack[-2][2] line = stack[-2][1] try: thread = "%02d" % threadstate.findThreadNumber() except: thread = '??' if parallel_enable.enabled(): from ooflib.SWIG.common import mpitools rank = "%02d" % mpitools.Rank() else: rank = '--' print >> sys.stderr, \ ('-%04d-%s-%s'%(depth,thread,rank))+'-'*(depth-1), \ '%s(%d):%s'%(filename, line, func),\ string.join(map(str, args), ' ') finally: lock.release()
def fmsg(*args): ## Importing ooferror here hangs the program when a binary data ## file is loaded if fmsg is used in OOFIdleCallback. WTF? There ## may be no real need to import ooferror here, but it was ## imported here once, and mysteriously caused a problem. ## (There's a comment in mainthreadGUI that refers to this ## comment.) # from ooflib.SWIG.common import ooferror if _debug_mode: lock.acquire() try: stack = traceback.extract_stack() depth = len(stack) filename = string.split(stack[-2][0], '/')[-1] func = stack[-2][2] line = stack[-2][1] try: thread = "%02d"% threadstate.findThreadNumber() except: thread = '??' if parallel_enable.enabled(): from ooflib.SWIG.common import mpitools rank="%02d" % mpitools.Rank() else: rank='--' print >> sys.stderr, \ ('-%04d-%s-%s'%(depth,thread,rank))+'-'*(depth-1), \ '%s(%d):%s'%(filename, line, func),\ string.join(map(str, args), ' ') finally: lock.release()
def callerID(depth=-3): if _debug_mode: lock.acquire() try: stack = traceback.extract_stack() thread = threadstate.findThreadNumber() if parallel_enable.enabled(): from ooflib.SWIG.common import mpitools rank = "%02d" % mpitools.Rank() else: rank = "" line = stack[depth] return '+++%02d++%s+++%30s:%3d\t%s\t\t%s' % \ (thread, rank, line[0], line[1], line[2], line[3]) finally: lock.release()
def msg(*args): if _debug_mode: lock.acquire() try: stack = traceback.extract_stack() depth = len(stack) thread = threadstate.findThreadNumber() if parallel_enable.enabled(): from ooflib.SWIG.common import mpitools rank = "%02d" % mpitools.Rank() else: rank = '--' print >> sys.stderr, \ ('-%04d-%02d-%s'%(depth,thread,rank))+'-'*(depth-1), \ string.join(map(str, args), ' ') finally: lock.release()
def msg(*args): if _debug_mode: lock.acquire() try: stack = traceback.extract_stack() depth = len(stack) thread = threadstate.findThreadNumber() if parallel_enable.enabled(): from ooflib.SWIG.common import mpitools rank="%02d" % mpitools.Rank() else: rank='--' print >> sys.stderr, \ ('-%04d-%02d-%s'%(depth,thread,rank))+'-'*(depth-1), \ string.join(map(str, args), ' ') finally: lock.release()
def dumpTrace(start=0, end=-1): ## Use start=-3, end=-2 if you only want to see the calling ## function of the function that calls dumpTrace. lock.acquire() try: stack = traceback.extract_stack() depth = len(stack) thread = threadstate.findThreadNumber() if parallel_enable.enabled(): from ooflib.SWIG.common import mpitools rank="%02d" % mpitools.Rank() else: rank='--' lines = ['+++-%04d-%02d-%s--------- debug.dumpTrace --------------' % (depth, thread, rank) ] for line in stack[start:end]: lines.append('+++%30s:%3d\t%s\t\t%s' % (line[0],line[1], line[2],line[3])) lines.append('+++-------------- end trace -----------------') print >> sys.stderr, string.join(lines, '\n') finally: lock.release()