aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2018-10-01 02:28:39 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-10-23 13:22:54 -0400
commit7e4fc93e2ade2b0c453a97e307203ffe3f930c98 (patch)
tree003eb47ae3c00f7b4f88803cbde462d7675492f8 /tools/perf/scripts/python
parent99a097c987c26c8c82293fcb92908d07009c925e (diff)
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. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/r/20181001062853.28285-6-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/scripts/python')
-rw-r--r--tools/perf/scripts/python/call-graph-from-sql.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/scripts/python/call-graph-from-sql.py b/tools/perf/scripts/python/call-graph-from-sql.py
index 2e33540f3de0..2b74b94eeccc 100644
--- a/tools/perf/scripts/python/call-graph-from-sql.py
+++ b/tools/perf/scripts/python/call-graph-from-sql.py
@@ -284,7 +284,9 @@ class MainWindow(QMainWindow):
284 284
285 self.setCentralWidget(self.view) 285 self.setCentralWidget(self.view)
286 286
287if __name__ == '__main__': 287# Main
288
289def Main():
288 if (len(sys.argv) < 2): 290 if (len(sys.argv) < 2):
289 print >> sys.stderr, "Usage is: call-graph-from-sql.py <database name>" 291 print >> sys.stderr, "Usage is: call-graph-from-sql.py <database name>"
290 raise Exception("Too few arguments") 292 raise Exception("Too few arguments")
@@ -331,3 +333,6 @@ if __name__ == '__main__':
331 err = app.exec_() 333 err = app.exec_()
332 db.close() 334 db.close()
333 sys.exit(err) 335 sys.exit(err)
336
337if __name__ == "__main__":
338 Main()