Commit 7e4fc93e authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

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: default avatarAdrian 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 99a097c9
...@@ -284,7 +284,9 @@ class MainWindow(QMainWindow): ...@@ -284,7 +284,9 @@ class MainWindow(QMainWindow):
self.setCentralWidget(self.view) self.setCentralWidget(self.view)
if __name__ == '__main__': # Main
def Main():
if (len(sys.argv) < 2): if (len(sys.argv) < 2):
print >> sys.stderr, "Usage is: call-graph-from-sql.py <database name>" print >> sys.stderr, "Usage is: call-graph-from-sql.py <database name>"
raise Exception("Too few arguments") raise Exception("Too few arguments")
...@@ -331,3 +333,6 @@ if __name__ == '__main__': ...@@ -331,3 +333,6 @@ if __name__ == '__main__':
err = app.exec_() err = app.exec_()
db.close() db.close()
sys.exit(err) sys.exit(err)
if __name__ == "__main__":
Main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment