本页内容

qmlprofiler

qmlprofiler 可从应用程序中获取 QML 跟踪数据。收集到的数据随后可在Qt Creator 中进行可视化展示。

要使qmlprofiler 能够对应用程序进行性能分析,请确保在构建应用程序时启用了QML 调试基础设施。

请参阅 QML Profiler 以了解更多信息。

用法
qmlprofiler [选项] 可执行文件 [参数...]

选项

选项描述
-a, --attach <hostname>连接到已在 <主机名> 上运行的应用程序,而不是在本地启动它。
-p, --port <port>连接到 TCP 端口 <port>。默认值为 3768。
-o, --output <file>将跟踪数据保存到 <file>。默认情况下,数据将发送到标准输出。
--record <on|off>如果设置为“off”,则 QML 引擎启动时不会立即开始记录数据,而是通过交互方式或使用 JavaScript 函数 `console.profile() ` 来启动记录。默认情况下,记录会立即开始。
--include <feature,...>以逗号分隔的待记录特性列表。默认情况下,QML 引擎支持的所有特性都会被记录。如果指定了--include ,则仅记录给定的特性。qmlprofiler 支持以下特性:javascript 、memory 、pixmapcache 、scenegraph 、animations 、painting 、compiling 、creating 、binding 、handlingsignal 、inputevents 、debugmessages 、quick3d 。
--exclude <feature,...>录制时需排除的功能列表,以逗号分隔。默认情况下,QML 引擎支持的所有功能都会被录制。有关 qmlprofiler 支持的功能,请参阅--include 。
--interactive通过命令行手动控制录制。在此情况下,即使应用程序退出,分析器也不会自动终止。可用的命令包括:
  • 'r', 'record'

    开启或关闭记录。

  • 'o [file]', 'output [file]'

    将分析数据输出至<file> 。如果未指定<file> 参数,则输出至通过--output 指定的位置,或标准输出。

  • 'c', 'clear'

    从内存中清除迄今为止记录的性能分析数据。

  • 'f [file]', 'flush [file]'

    如果正在运行,则停止记录,随后输出数据,最后从内存中清除数据。

  • 'q', 'quit'

    如果程序是从 qmlprofiler 启动的,则终止目标进程以及 qmlprofiler 本身。

--verbose打印调试输出。
-h, --help显示有关命令行选项的帮助信息。
--help-all显示帮助信息,包括通用的 Qt 选项。
-v, --version显示版本信息。

参数

参数描述
可执行文件加载 QML 文档的可执行文件的路径。
参数可执行文件的参数

© 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.