perf scripts python: call-graph-from-sql.py: Make a "Main" function
authorAdrian Hunter <adrian.hunter@intel.com>
Mon, 1 Oct 2018 06:28:39 +0000 (09:28 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 23 Oct 2018 17:22:54 +0000 (14:22 -0300)
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>
tools/perf/scripts/python/call-graph-from-sql.py

index 2e33540f3de01e06e47debe8ffdb8d30a83e1b61..2b74b94eecccd3130d0d43f5c0707229e017f323 100644 (file)
@@ -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 <database name>"
                raise Exception("Too few arguments")
@@ -331,3 +333,6 @@ if __name__ == '__main__':
        err = app.exec_()
        db.close()
        sys.exit(err)
+
+if __name__ == "__main__":
+       Main()