本文整理汇总了Python中Debug.debugMessage方法的典型用法代码示例。如果您正苦于以下问题:Python Debug.debugMessage方法的具体用法?Python Debug.debugMessage怎么用?Python Debug.debugMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debug
的用法示例。
在下文中一共展示了Debug.debugMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createProgram
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debugMessage [as 别名]
def createProgram (cfgLines):
program = CFGs.Program()
cfg = None
analyse = False
instructions = []
labels = []
for line in cfgLines:
if "Summary of basic blocks for" in line:
analyse = False
assert cfg
assert instructions
createBasicBlocks(cfg, instructions)
addEdges(cfg)
setEntryAndExit(cfg)
instructions = []
if analyse:
analyseLine(line, instructions, labels)
if "Printing basic blocks for function" in line:
analyse = True
lexemes = shlex.split(line)
functionName = lexemes[-1][:-1]
cfg = CFGs.CFG()
cfg.setName(functionName)
program.addCFG(cfg)
Debug.debugMessage("Found new CFG '%s'" % functionName, 1)
return program
示例2: createGraphs
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debugMessage [as 别名]
def createGraphs (program, basepath):
import UDrawGraph, ICFGs, Trees, IPGs
Debug.debugMessage("Creating data structures", 1)
for cfg in program.getCFGs():
functionName = cfg.getName()
UDrawGraph.makeUdrawFile (cfg, basepath, "%s.%s" % (functionName, "cfg"))
predomTree = Trees.Dominators(cfg, cfg.getEntryID())
reverseg = cfg.getReverseCFG()
postdomTree = Trees.Dominators(reverseg, reverseg.getEntryID())
UDrawGraph.makeUdrawFile (predomTree, basepath, "%s.%s" % (functionName, "pre"))
UDrawGraph.makeUdrawFile (postdomTree, basepath, "%s.%s" % (functionName, "post"))
icfg = ICFGs.ICFG(cfg)
icfg.setEntryID()
icfg.setExitID()
icfg.addExitEntryEdge()
program.addICFG(icfg)
UDrawGraph.makeUdrawFile (icfg, basepath, "%s.%s" % (functionName, "icfg"))
lnt = Trees.LoopNests(icfg, icfg.getEntryID())
program.addLNT(lnt)
UDrawGraph.makeUdrawFile (lnt, basepath, "%s.%s" % (functionName, "lnt"))
ipg = IPGs.IPG(icfg, lnt)
program.addIPG(ipg)
icfg.addBranchDivergenceEdges(lnt)
ipg.updateWithBranchDivergentPaths()
UDrawGraph.makeUdrawFile (icfg, basepath, "%s.%s" % (functionName, "icfg"))
UDrawGraph.makeUdrawFile (ipg, basepath, "%s.%s" % (functionName, "ipg"))
示例3: splitTraces
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debugMessage [as 别名]
def splitTraces (program, generatedFiles):
Debug.debugMessage("Splitting traces", 1)
allWarpTraces = {}
for outfile in generatedFiles:
traceFound = False
newKernel = False
firstTuple = None
lastTuple = None
Debug.debugMessage("Analysing file '%s'" % outfile, 1)
with open(outfile, 'r') as f:
for line in f:
if line.startswith("NEW KERNEL"):
traceFound = True
if firstTuple:
analyseHWMT(program, firstTuple, lastTuple)
firstTuple = None
continue
if traceFound:
SMAndWarp, timingTuple = getLineOfTimingTrace(line)
print
w = getWarp (allWarpTraces, SMAndWarp)
w.appendToTrace(timingTuple)
lastTuple = timingTuple
if not firstTuple:
firstTuple = timingTuple
analyseHWMT(program, firstTuple, lastTuple)
return allWarpTraces
示例4: __addIpoints
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debugMessage [as 别名]
def __addIpoints (self):
for bb in self:
address, instr = bb.getFirstInstruction()
vertexID = self.getNextVertexID ()
ipoint = Vertices.Ipoint(vertexID, address)
self.vertices[vertexID] = ipoint
Debug.debugMessage("Adding Ipoint %d with ID %s" % (vertexID, hex(address)), 4)
self.__linkIpoint(bb, ipoint)
示例5: __init__
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debugMessage [as 别名]
def __init__ (self, cfg):
Debug.debugMessage(cfg, 10)
CFGs.CFG.__init__(self)
self.__branchDivergentEdges = []
self.setName(cfg.getName())
for bb in cfg:
bbID = bb.getVertexID()
self.vertices[bbID] = copy.deepcopy(bb)
self.__addIpoints()
示例6: analyseHWMT
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debugMessage [as 别名]
def analyseHWMT (program, firstTuple, lastTuple):
Debug.debugMessage("Analysing start tuple %s and last tuple %s" % (firstTuple, lastTuple), 1)
ipointID = int(firstTuple[0], 0)
startTime = int(firstTuple[1])
endTime = int(lastTuple[1])
ipg = program.getIPGWithEntryIpointID(ipointID)
functionName = ipg.getName()
end2end = endTime - startTime
Debug.debugMessage("End-to-end(%s) = %d" % (functionName, end2end), 1)
program.updateHWMT(functionName, end2end)
示例7: __addEdge
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debugMessage [as 别名]
def __addEdge(self, predID, succID):
global edgeID
Debug.debugMessage("Adding IPG Edge %s => %s" % (predID, succID), 10)
predv = self.getVertex(predID)
succv = self.getVertex(succID)
predv.addIpointSuccessor(succv.getIpointID(), succID)
succe = IPGEdge(succID, edgeID)
prede = IPGEdge(predID, edgeID)
predv.addSuccessorEdge(succe)
succv.addPredecessorEdge(prede)
edgeID += 1
if self.__branchDivergence:
self.__branchDivergentEdges.append((predID, succID))
示例8: _findExits
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debugMessage [as 别名]
def _findExits (self):
for headerID in self.__headerVertices.keys():
self.__loopExits[headerID] = []
for vertexID in self.__loopBodies[headerID]:
v = self.__directedg.getVertex(vertexID)
for succID in v.getSuccessorIDs():
if succID not in self.__loopBodies[headerID]:
if headerID != vertexID and self.isLoopHeader(vertexID):
if succID not in self.__loopBodies[vertexID]:
self.__loopExits[headerID].append(vertexID)
else:
self.__loopExits[headerID].append(vertexID)
Debug.debugMessage("Exits of %s = %s" % (headerID, self.__loopExits[headerID]), 4)
示例9: __solve
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debugMessage [as 别名]
def __solve(self, ipg, ilpFile):
from subprocess import Popen, PIPE
import shlex
Debug.debugMessage("Solving ILP", 10)
command = "lp_solve %s" % ilpFile
proc = Popen(command, shell=True, executable="/bin/bash", stdout=PIPE, stderr=PIPE)
returnCode = proc.wait()
if returnCode != 0:
Debug.exitMessage("Running '%s' failed" % command)
for line in proc.stdout.readlines():
if line.startswith("Value of objective function"):
lexemes = shlex.split(line)
wcet = long(decimal.Decimal(lexemes[-1]))
self.__wcet = wcet
示例10: _findLoops
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debugMessage [as 别名]
def _findLoops (self, rootID):
dfs = DepthFirstSearch (self.__directedg, rootID)
for vertexID in reversed(dfs.getPreorder()):
v = self.__directedg.getVertex(vertexID)
worklist = []
for predID in v.getPredecessorIDs():
if dfs.isDFSBackedge(predID, vertexID):
if predID == vertexID:
Debug.debugMessage("%s => %s is a loop-back edge of trivial loop" % (predID, vertexID), 3)
self._addSelfLoop (vertexID)
else:
Debug.debugMessage("%s => %s is a loop-back edge of non-trivial loop" % (predID, vertexID), 3)
worklist.append(self.__parent[predID])
if worklist:
self._findLoop (dfs, worklist, vertexID)
示例11: runCUDAKernel
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debugMessage [as 别名]
def runCUDAKernel (basepath):
from subprocess import Popen, PIPE
import signal
import re
cmd = args[0]
Debug.debugMessage("CUDA application command '%s'" % cmd, 1)
run = 0
for filename in os.listdir(basepath):
match = re.search(r'%s[0-9]+%s' % (runPrefix, gpgpuFileExt), filename)
if match:
index = filename.find(gpgpuFileExt)
num = int(filename[len(runPrefix):index])
if num > run:
run = num
run += 1
# Run the program on GPGPU-sim and get generated output
outfiles = []
generatedFiles = []
for i in xrange(run, opts.tests + run):
outfilename = basepath + os.sep + runPrefix + str(i) + gpgpuFileExt
generatedFiles.append(outfilename)
outfiles.append(outfilename)
assert generatedFiles, "No output files were generated"
processes = []
pidToOutFilename = {}
pidToOutFile = {}
while True:
while outfiles and len(processes) < multiprocessing.cpu_count()/2:
outfilename = outfiles.pop()
outfile = open(outfilename, 'w')
Debug.debugMessage("Spawning new process for '%s'" % outfilename, 1)
proc = Popen(cmd, shell=True, stdout=outfile)
processes.append(proc)
pidToOutFile[proc.pid] = outfile
pidToOutFilename[proc.pid] = outfilename
for p in processes:
if p.poll() is not None:
processes.remove(p)
pidToOutFile[p.pid].close()
if p.returncode != 0:
Debug.debugMessage("Process failed for output file '%s' with return code %d" % (pidToOutFilename[p.pid], p.returncode), 1)
outfiles.append(pidToOutFilename[p.pid])
if not processes and not outfiles:
break
else:
time.sleep(1)
p = Popen(['ps', '-A'], stdout=PIPE)
out, err = p.communicate()
for line in out.splitlines():
if 'cuobjdump_to_pt' in line:
pid = int(line.split(None, 1)[0])
os.kill(pid, signal.SIGKILL)
Debug.debugMessage("Killing stray CUDA-to-PTXPlus process", 1)
return generatedFiles
示例12: __init__
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debugMessage [as 别名]
def __init__(self, warpTrace, program):
Debug.debugMessage("Parsing traces in SM %s, WARP %s" % (warpTrace.getMultiprocessorID(), warpTrace.getWarpID()), 5)
self.numberOfTraces = {}
# High water mark time
self.highWaterMark = {}
self.totalEnd2End = {}
# Best-case execution time
self.edgeIDToBCET = {}
# Worst-case execution time
self.edgeIDToWCET = {}
# Worst-case execution count (overall and in run currently under analysis)
self.edgeIDToWCEC = {}
self.edgeIDToWCECInRun = {}
# Total execution count
self.edgeIDToExecutionCounts = {}
# Total execution time consumed
self.edgeIDToTotalTime = {}
self.warpTrace = warpTrace
self.__doParsing(program)
示例13: __solveDFF
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debugMessage [as 别名]
def __solveDFF (self, forwardBranches):
# Initialise data structures needed
vertexToReachable = {}
for v in self:
vertexToReachable[v] = set([])
# Do a reverse post-order. Avoid the entry vertex
dfs = Trees.DepthFirstSearch(self, self._entryID)
postID = self.numOfVertices() - 1
while postID >= 1:
vertexID = dfs.getPostorderVertexID(postID)
v = self.getVertex(vertexID)
vertexToReachable[v].add(vertexID)
for predID in v.getPredecessorIDs():
predv = self.getVertex(predID)
vertexToReachable[v].add(predID)
vertexToReachable[v].update(vertexToReachable[predv])
postID -= 1
# Now analyse the immediate post-dominator
reverseg = self.getReverseCFG()
postdomTree = Trees.Dominators(reverseg, reverseg.getEntryID())
for vertexID in forwardBranches:
Debug.debugMessage("Vertex %d is a forward branch" % vertexID, 5)
branchv = self.getVertex(vertexID)
succSet = set(branchv.getSuccessorIDs())
treev = postdomTree.getVertex(vertexID)
parentID = treev.getParentID()
mergev = self.getVertex(parentID)
Debug.debugMessage("Analysing region (%d, %d)" % (vertexID, parentID), 5)
# for succID in branchv.getSuccessorIDs():
# if succID != parentID:
# self.addEdge(parentID, succID)
# self.__branchDivergentEdges.append((parentID, succID))
for predID in mergev.getPredecessorIDs():
predv = self.getVertex(predID)
newsuccs = set.difference(succSet, vertexToReachable[predv])
for newsuccID in newsuccs:
if newsuccID not in predv.getSuccessorIDs() and newsuccID != predID:
self.addEdge(predID, newsuccID)
self.__branchDivergentEdges.append((predID, newsuccID))
示例14: __doParsing
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debugMessage [as 别名]
def __doParsing (self, program):
newTrace = True
currentv = None
lastTime = 0
startTime = 0
ipg = None
for t in self.warpTrace.getTrace():
ipointID = int(t[0], 0)
time = long(t[1])
Debug.debugMessage("Trace tuple (0x%04X, %d)" % (ipointID, time), 10)
if newTrace:
ipg = self.__getIPG(program, ipointID)
functionName = ipg.getName()
self.numberOfTraces[functionName] += 1
newTrace = False
currentv = ipg.getVertex(ipg.getEntryID())
assert currentv.getIpointID () == ipointID
lastTime = time
startTime = time
else:
succID = currentv.getIpointSuccessor(ipointID)
if succID:
succe = currentv.getSuccessorEdge(succID)
self.__analyseEdgeTime(succe, time - lastTime)
# Advance transition
lastTime = time
currentv = ipg.getVertex(succID)
if succID == ipg.getExitID():
newTrace = True
runTime = lastTime - startTime
functionName = ipg.getName()
self.totalEnd2End[functionName] += runTime
if runTime > self.highWaterMark[functionName]:
self.highWaterMark[functionName] = runTime
self.__analyseWorstCaseExecutionCounts()
ipg = None
else:
Debug.exitMessage("Giving up")
示例15: __solveDFF
# 需要导入模块: import Debug [as 别名]
# 或者: from Debug import debugMessage [as 别名]
def __solveDFF(self, headerID):
Debug.debugMessage("Building IPG in CFG* loop %s" % headerID, 5)
self.__auxiliaryData.changed = True
self.__auxiliaryData.iteration = 0
while self.__auxiliaryData.changed:
self.__auxiliaryData.changed = False
self.__auxiliaryData.iteration += 1
for vertexID in self.__auxiliaryData.headerToTopSorts[headerID]:
v = self.__icfg.getVertex(vertexID)
for predID in v.getPredecessorIDs():
analyseEdge = False
if vertexID == headerID:
if self.__lnt.isLoopBackEdge(predID, headerID) and self.__auxiliaryData.iteration > 1:
analyseEdge = True
elif not self.__lnt.isLoopHeader(vertexID):
analyseEdge = True
elif not self.__lnt.isLoopBackEdge(predID, vertexID):
analyseEdge = True
if analyseEdge:
Debug.debugMessage(
"Iteration %s, edge %s => %s" % (self.__auxiliaryData.iteration, predID, vertexID), 15
)
if self.__icfg.isIpoint(predID):
self.__update(predID, vertexID, headerID, predID)
else:
for keyID in self.__auxiliaryData.vertexToReachable[predID].keys():
if self.__icfg.isIpoint(keyID):
self.__update(keyID, vertexID, headerID, predID)
if (
self.__auxiliaryData.iteration == 1
and headerID in self.__auxiliaryData.vertexToReachable[predID]
):
self.__updateLoopReachability(headerID, vertexID, predID)