profiler_system_example.py 901 B

12345678910111213141516171819202122232425262728293031
  1. #
  2. # Copyright (c) Contributors to the Open 3D Engine Project.
  3. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. #
  5. # SPDX-License-Identifier: Apache-2.0 OR MIT
  6. #
  7. #
  8. import azlmbr.debug as debug
  9. import pathlib
  10. def test_profiler_system():
  11. if not debug.g_ProfilerSystem.IsValid():
  12. print('g_ProfilerSystem is INVALID')
  13. return
  14. state = 'ACTIVE' if debug.g_ProfilerSystem.IsActive() else 'INACTIVE'
  15. print(f'Profiler system is currently {state}')
  16. capture_location = pathlib.Path(debug.g_ProfilerSystem.GetCaptureLocation())
  17. print(f'Capture location set to {capture_location}')
  18. print('Capturing single frame...' )
  19. capture_file = str(capture_location / 'script_capture_frame.json')
  20. debug.g_ProfilerSystem.CaptureFrame(capture_file)
  21. # Invoke main function
  22. if __name__ == '__main__':
  23. test_profiler_system()