Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf scripts python: exported-sql-viewer.py: Improve TreeModel abstraction

Instead of passing the tree root, get it from a method that can be
implemented in any derived class.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lkml.kernel.org/n/tip-ovcv28bg4mt9swk36ypdyz14@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Adrian Hunter and committed by
Arnaldo Carvalho de Melo
a448ba23 a731cc4c

+11 -6
+11 -6
tools/perf/scripts/python/exported-sql-viewer.py
··· 167 167 168 168 class TreeModel(QAbstractItemModel): 169 169 170 - def __init__(self, root, parent=None): 170 + def __init__(self, glb, parent=None): 171 171 super(TreeModel, self).__init__(parent) 172 - self.root = root 172 + self.glb = glb 173 + self.root = self.GetRoot() 173 174 self.last_row_read = 0 174 175 175 176 def Item(self, parent): ··· 563 562 class CallGraphModel(TreeModel): 564 563 565 564 def __init__(self, glb, parent=None): 566 - super(CallGraphModel, self).__init__(CallGraphRootItem(glb), parent) 567 - self.glb = glb 565 + super(CallGraphModel, self).__init__(glb, parent) 566 + 567 + def GetRoot(self): 568 + return CallGraphRootItem(self.glb) 568 569 569 570 def columnCount(self, parent=None): 570 571 return 7 ··· 1342 1339 progress = Signal(object) 1343 1340 1344 1341 def __init__(self, glb, event_id, where_clause, parent=None): 1345 - super(BranchModel, self).__init__(BranchRootItem(), parent) 1346 - self.glb = glb 1342 + super(BranchModel, self).__init__(glb, parent) 1347 1343 self.event_id = event_id 1348 1344 self.more = True 1349 1345 self.populated = 0 ··· 1365 1363 self.fetcher = SQLFetcher(glb, sql, BranchDataPrep, self.AddSample) 1366 1364 self.fetcher.done.connect(self.Update) 1367 1365 self.fetcher.Fetch(glb_chunk_sz) 1366 + 1367 + def GetRoot(self): 1368 + return BranchRootItem() 1368 1369 1369 1370 def columnCount(self, parent=None): 1370 1371 return 8