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
1786 events.append(query.value(0))1786 events.append(query.value(0))
1787 return events1787 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 preparation1799# SQL data preparation
1790 1800
1791def SQLTableDataPrep(query, count):1801def SQLTableDataPrep(query, count):
@@ -2298,7 +2308,8 @@ class MainWindow(QMainWindow): · 506 unmodified lines
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