From: Adrian Hunter Date: Mon, 1 Oct 2018 06:28:39 +0000 (+0300) Subject: perf scripts python: call-graph-from-sql.py: Make a "Main" function X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=7e4fc93e2ade2b0c453a97e307203ffe3f930c98;p=openwrt%2Fstaging%2Fblogic.git 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 Cc: Andi Kleen Cc: Jiri Olsa Link: http://lkml.kernel.org/r/20181001062853.28285-6-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- 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): self.setCentralWidget(self.view) -if __name__ == '__main__': +# Main + +def Main(): if (len(sys.argv) < 2): print >> sys.stderr, "Usage is: call-graph-from-sql.py " raise Exception("Too few arguments") @@ -331,3 +333,6 @@ if __name__ == '__main__': err = app.exec_() db.close() sys.exit(err) + +if __name__ == "__main__": + Main()