This will run the program and present profiling data in a nice looking graph
(profileOutputFile=None)
| 12 | from lib.core.data import paths |
| 13 | |
| 14 | def profile(profileOutputFile=None): |
| 15 | """ |
| 16 | This will run the program and present profiling data in a nice looking graph |
| 17 | """ |
| 18 | |
| 19 | if profileOutputFile is None: |
| 20 | profileOutputFile = os.path.join(paths.SQLMAP_OUTPUT_PATH, "sqlmap_profile.raw") |
| 21 | |
| 22 | if os.path.exists(profileOutputFile): |
| 23 | os.remove(profileOutputFile) |
| 24 | |
| 25 | # Start sqlmap main function and generate a raw profile file |
| 26 | cProfile.run("start()", profileOutputFile) |
| 27 | |
| 28 | infoMsg = "execution profiled and stored into file '%s' (e.g. 'gprof2dot -f pstats %s | dot -Tpng -o /tmp/sqlmap_profile.png')" % (profileOutputFile, profileOutputFile) |
| 29 | logger.info(infoMsg) |