History

perf scripts python: call-graph-from-sql.py: Make a "Main" function

Make a "Main" function so that the variables used do not pollute the global namespace.

Adrian Hunter committed 8 years ago

Commit 7e4fc931 parent 99a097c1 file · +6 −1Browse files

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

Unified · Split

tools/perf/scripts/python/call-graph-from-sql.py+6−1
@@ -284,7 +284,9 @@ class MainWindow(QMainWindow): · 283 unmodified lines
284284
285285 self.setCentralWidget(self.view)
286286
287−if __name__ == '__main__':
287+# Main
288+
289+def Main():
288290 if (len(sys.argv) < 2):
289291 print >> sys.stderr, "Usage is: call-graph-from-sql.py <database name>"
290292 raise Exception("Too few arguments")
@@ -331,3 +333,6 @@ if __name__ == '__main__': · 40 unmodified lines
331333 err = app.exec_()
332334 db.close()
333335 sys.exit(err)
336+
337+if __name__ == "__main__":
338+ Main()