Created
April 14, 2023 22:22
Revisions
-
ThomasG77 created this gist
Apr 14, 2023 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ import json profiler = QgsApplication.profiler() tree = [] for row in range(0, profiler.rowCount()): line = [] for col in range(0, profiler.columnCount()): index = profiler.index(row, col) line.append(profiler.data(index)) if len(line) == 2: dict_level1 = {"name": line[0], "timing": line[1], "child": []} print('line', line, row, col) for row1 in range(0, profiler.rowCount(index)): subline = [] for col1 in range(0, profiler.columnCount(index)): index1 = profiler.index(row1, col1, index) subline.append(profiler.data(index1)) if len(subline) == 2: print('subline', subline) dict_level2 = {"name": subline[0], "timing": subline[1], "child": []} if profiler.rowCount(index1) > 0 and profiler.columnCount(index1) > 0: print(f'will get child {profiler.rowCount(index1)} and {profiler.columnCount(index1)}') dict_level1['child'].append(dict_level2) tree.append(dict_level1) with open('/tmp/tree.json', "w") as inputfile: json.dump(tree, inputfile)