History

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.

Adrian Hunter committed 7 years ago

Commit 655cb951 parent df8794f1 file · +12 −1Browse files

Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all

Unified · Split

tools/perf/scripts/python/exported-sql-viewer.py+12−1
@@ -1786,6 +1786,16 @@ def GetEventList(db): · 1785 unmodified lines
17861786 events.append(query.value(0))
17871787 return events
17881788
1789+# Is a table selectable
1790+
1791+def 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+
17891799 # SQL data preparation
17901800
17911801 def SQLTableDataPrep(query, count):
@@ -2298,7 +2308,8 @@ class MainWindow(QMainWindow): · 506 unmodified lines
22982308 edit_menu.addAction(CreateAction("&Enlarge Font", "Make text bigger", self.EnlargeFont, self, [QKeySequence("Ctrl++")]))
22992309
23002310 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))
23022313
23032314 self.EventMenu(GetEventList(glb.db), reports_menu)
23042315