Start profiling. Raises: ProfilerAlreadyRunningError: If another profiling session is running.
()
| 62 | |
| 63 | |
| 64 | def start(): |
| 65 | """Start profiling. |
| 66 | |
| 67 | Raises: |
| 68 | ProfilerAlreadyRunningError: If another profiling session is running. |
| 69 | """ |
| 70 | global _profiler |
| 71 | with _profiler_lock: |
| 72 | if _profiler is not None: |
| 73 | raise ProfilerAlreadyRunningError('Another profiler is running.') |
| 74 | if context.default_execution_mode == context.EAGER_MODE: |
| 75 | context.ensure_initialized() |
| 76 | _profiler = pywrap_tensorflow.TFE_NewProfiler() |
| 77 | if not pywrap_tensorflow.TFE_ProfilerIsOk(_profiler): |
| 78 | logging.warning('Another profiler session is running which is probably ' |
| 79 | 'created by profiler server. Please avoid using profiler ' |
| 80 | 'server and profiler APIs at the same time.') |
| 81 | |
| 82 | |
| 83 | def stop(): |
no test coverage detected