(args)
| 69 | |
| 70 | |
| 71 | def main(args): |
| 72 | if '--help' in args: |
| 73 | print('''\ |
| 74 | Usage: |
| 75 | emprofile.py --clear (or -c) |
| 76 | Deletes all previously recorded profiling log files. |
| 77 | Use this to abort/drop any previously collected |
| 78 | profiling data for a new profiling run. |
| 79 | |
| 80 | emprofile.py [--no-clear] |
| 81 | Draws a graph from all recorded profiling log files, |
| 82 | and deletes the recorded profiling files, unless |
| 83 | --no-clear is also passed. |
| 84 | |
| 85 | Optional parameters: |
| 86 | |
| 87 | --outfile=x.html (or -o=x.html) |
| 88 | Specifies the name of the results file to generate. |
| 89 | ''') |
| 90 | return 0 |
| 91 | |
| 92 | if '--reset' in args or '--clear' in args or '-c' in args: |
| 93 | delete_profiler_logs() |
| 94 | return 0 |
| 95 | else: |
| 96 | outfile = 'toolchain_profiler.results_' + time.strftime('%Y%m%d_%H%M') |
| 97 | for i, arg in enumerate(args): |
| 98 | if arg.startswith(('--outfile=', '-o=')): |
| 99 | outfile = arg.split('=', 1)[1].strip().replace('.html', '') |
| 100 | elif arg == '-o': |
| 101 | outfile = args[i + 1].strip().replace('.html', '') |
| 102 | if create_profiling_graph(outfile): |
| 103 | return 1 |
| 104 | if '--no-clear' not in args: |
| 105 | delete_profiler_logs() |
| 106 | |
| 107 | return 0 |
| 108 | |
| 109 | |
| 110 | if __name__ == '__main__': |
no test coverage detected