Profiling QML 应用程序
QML Profiler
使用 QML Profiler您可以分析 QML 代码的性能问题。剖析器是Qt Creator 和Qt Design Studio 的一部分。使用它的最佳方法是利用 {QC} 或 {QDS} 的默认构建和运行设置。
如果是手动构建或运行,为了使用QML Profiler ,需要启用QML 调试基础架构。
使用命令行 qmlprofiler 工具
Qt 提供了qmlprofiler命令行工具,用于在文件中捕获剖析数据。该文件随后可加载到Qt Creator 或Qt Design Studio 进行分析。它使用调试协议连接到应用程序。
要运行该工具,在启用QML 调试基础架构启动应用程序后,输入以下命令:
qmlprofiler -p <port> -attach <ip address>
建议使用services 作为-qmljsdebugger 的参数,以便将调试基础架构限制在所需的服务范围内。这些服务通常是CanvasFrameRate 、EngineControl 和DebugMessages 。启用其他服务可能会影响剖析结果。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.