aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/exported-sql-viewer.py
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2019-02-28 08:00:29 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-03-01 12:55:32 -0500
commita448ba232a5f0176c226df1bab8877ec06a7c771 (patch)
treeb8fa95201a53e134cc47d8cbb04586224995506c /tools/perf/scripts/python/exported-sql-viewer.py
parenta731cc4c990a90d9d42a2081ca93fb4310680ae2 (diff)
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>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
-rwxr-xr-xtools/perf/scripts/python/exported-sql-viewer.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
index df854f0a69f0..b2a22525549d 100755
--- a/tools/perf/scripts/python/exported-sql-viewer.py
+++ b/tools/perf/scripts/python/exported-sql-viewer.py
@@ -167,9 +167,10 @@ class Thread(QThread):
167 167
168class TreeModel(QAbstractItemModel): 168class TreeModel(QAbstractItemModel):
169 169
170 def __init__(self, root, parent=None): 170 def __init__(self, glb, parent=None):
171 super(TreeModel, self).__init__(parent) 171 super(TreeModel, self).__init__(parent)
172 self.root = root 172 self.glb = glb
173 self.root = self.GetRoot()
173 self.last_row_read = 0 174 self.last_row_read = 0
174 175
175 def Item(self, parent): 176 def Item(self, parent):
@@ -562,8 +563,10 @@ class CallGraphRootItem(CallGraphLevelItemBase):
562class CallGraphModel(TreeModel): 563class CallGraphModel(TreeModel):
563 564
564 def __init__(self, glb, parent=None): 565 def __init__(self, glb, parent=None):
565 super(CallGraphModel, self).__init__(CallGraphRootItem(glb), parent) 566 super(CallGraphModel, self).__init__(glb, parent)
566 self.glb = glb 567
568 def GetRoot(self):
569 return CallGraphRootItem(self.glb)
567 570
568 def columnCount(self, parent=None): 571 def columnCount(self, parent=None):
569 return 7 572 return 7
@@ -1339,8 +1342,7 @@ class BranchModel(TreeModel):
1339 progress = Signal(object) 1342 progress = Signal(object)
1340 1343
1341 def __init__(self, glb, event_id, where_clause, parent=None): 1344 def __init__(self, glb, event_id, where_clause, parent=None):
1342 super(BranchModel, self).__init__(BranchRootItem(), parent) 1345 super(BranchModel, self).__init__(glb, parent)
1343 self.glb = glb
1344 self.event_id = event_id 1346 self.event_id = event_id
1345 self.more = True 1347 self.more = True
1346 self.populated = 0 1348 self.populated = 0
@@ -1364,6 +1366,9 @@ class BranchModel(TreeModel):
1364 self.fetcher.done.connect(self.Update) 1366 self.fetcher.done.connect(self.Update)
1365 self.fetcher.Fetch(glb_chunk_sz) 1367 self.fetcher.Fetch(glb_chunk_sz)
1366 1368
1369 def GetRoot(self):
1370 return BranchRootItem()
1371
1367 def columnCount(self, parent=None): 1372 def columnCount(self, parent=None):
1368 return 8 1373 return 8
1369 1374