def RemoveNewline(line): return line.replace("\n", "") cudaCalls = {} for x in data: cudaCalls[RemoveNewline(x)] = None f = open("combined_stacks.json", "rb") data = json.load(f) stacks = [] for x in data: stacks.append(JSStack(data=x)) def GetFirstUserCall(stack): global cudaCalls tmp = stack.GetStacks() for x in range(0, len(tmp)): if tmp[x].GetFunctionName() in cudaCalls: return [tmp[x].GetFunctionName(), tmp[x - 1]] return None indiPoints = {} for x in stacks: #print x
# if x[0] / TOTAL_TIME < 0.001: # continue # rows = [TextRow([x[1]],0)] # myID = FOLD_ID.GetID() # FOLD_ID.AddElement(myID, rows) # beforeSort.append([x[0], TextRow(["{0:6.3f}s({1:5.2f}%) Sequence".format(x[0],(x[0]/TOTAL_TIME) * 100)], 0, myID)]) beforeSort.sort(key=lambda x: x[0],reverse=True) for x in beforeSort: outRows.append(x[1]) # outRows.append(TextRow(["(Coming Soon)"],0)) FOLD_ID.AddElement(presentationID, outRows) FOLD_ID.SetStart(presentationID) for x in postProc: rows = [TextRow(["Unnecessary if the following operations are kept"],0)] for y in postProc[x]: rows.append(TextRow([findStackDepth[y]._data["outstring"]],1)) FOLD_ID.AddElement(x, rows) f.close() if __name__ == "__main__": f = open("combined_stacks.json", "rb") data = json.load(f) myStacks = [] for z in data: myStacks.append(JSStack(data=z)) test = TemplateFolder(myStacks) test.Build() FOLD_ID.BeginDisplay()