aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/exported-sql-viewer.py
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2019-02-22 02:27:20 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-02-22 14:52:07 -0500
commit655cb952de5fc2b91ff7d6352131c2c0cde6e862 (patch)
treef4a9fac05ee89f3ce94ceea3e458ce09deab172b /tools/perf/scripts/python/exported-sql-viewer.py
parentdf8794fe6840aed6ce65baf7f1e542bd3e22fb78 (diff)
perf scripts python: exported-sql-viewer.py: Hide Call Graph option if no calls table
The Call Graph depends on the calls table which is optional when exporting data, so hide the Call Graph option if there is no calls table. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@redhat.com> 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.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
index c20b510ace8f..58a95241ff70 100755
--- a/tools/perf/scripts/python/exported-sql-viewer.py
+++ b/tools/perf/scripts/python/exported-sql-viewer.py
@@ -1786,6 +1786,16 @@ def GetEventList(db):
1786 events.append(query.value(0)) 1786 events.append(query.value(0))
1787 return events 1787 return events
1788 1788
1789# Is a table selectable
1790
1791def IsSelectable(db, table):
1792 query = QSqlQuery(db)
1793 try:
1794 QueryExec(query, "SELECT * FROM " + table + " LIMIT 1")
1795 except:
1796 return False
1797 return True
1798
1789# SQL data preparation 1799# SQL data preparation
1790 1800
1791def SQLTableDataPrep(query, count): 1801def SQLTableDataPrep(query, count):
@@ -2298,7 +2308,8 @@ class MainWindow(QMainWindow):
2298 edit_menu.addAction(CreateAction("&Enlarge Font", "Make text bigger", self.EnlargeFont, self, [QKeySequence("Ctrl++")])) 2308 edit_menu.addAction(CreateAction("&Enlarge Font", "Make text bigger", self.EnlargeFont, self, [QKeySequence("Ctrl++")]))
2299 2309
2300 reports_menu = menu.addMenu("&Reports") 2310 reports_menu = menu.addMenu("&Reports")
2301 reports_menu.addAction(CreateAction("Context-Sensitive Call &Graph", "Create a new window containing a context-sensitive call graph", self.NewCallGraph, self)) 2311 if IsSelectable(glb.db, "calls"):
2312 reports_menu.addAction(CreateAction("Context-Sensitive Call &Graph", "Create a new window containing a context-sensitive call graph", self.NewCallGraph, self))
2302 2313
2303 self.EventMenu(GetEventList(glb.db), reports_menu) 2314 self.EventMenu(GetEventList(glb.db), reports_menu)
2304 2315