Skip to content

Commit

Permalink
perf scripts python: exported-sql-viewer.py: Improve TreeModel abstra…
Browse files Browse the repository at this point in the history
…ction

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>
  • Loading branch information
Adrian Hunter authored and Arnaldo Carvalho de Melo committed Mar 1, 2019
1 parent a731cc4 commit a448ba2
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tools/perf/scripts/python/exported-sql-viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,10 @@ def run(self):

class TreeModel(QAbstractItemModel):

def __init__(self, root, parent=None):
def __init__(self, glb, parent=None):
super(TreeModel, self).__init__(parent)
self.root = root
self.glb = glb
self.root = self.GetRoot()
self.last_row_read = 0

def Item(self, parent):
Expand Down Expand Up @@ -562,8 +563,10 @@ def __init__(self, glb):
class CallGraphModel(TreeModel):

def __init__(self, glb, parent=None):
super(CallGraphModel, self).__init__(CallGraphRootItem(glb), parent)
self.glb = glb
super(CallGraphModel, self).__init__(glb, parent)

def GetRoot(self):
return CallGraphRootItem(self.glb)

def columnCount(self, parent=None):
return 7
Expand Down Expand Up @@ -1339,8 +1342,7 @@ class BranchModel(TreeModel):
progress = Signal(object)

def __init__(self, glb, event_id, where_clause, parent=None):
super(BranchModel, self).__init__(BranchRootItem(), parent)
self.glb = glb
super(BranchModel, self).__init__(glb, parent)
self.event_id = event_id
self.more = True
self.populated = 0
Expand All @@ -1364,6 +1366,9 @@ def __init__(self, glb, event_id, where_clause, parent=None):
self.fetcher.done.connect(self.Update)
self.fetcher.Fetch(glb_chunk_sz)

def GetRoot(self):
return BranchRootItem()

def columnCount(self, parent=None):
return 8

Expand Down

0 comments on commit a448ba2

Please sign in to comment.