[Qt-creator] Access QML Profiler via qml / js / c++ code
Ulf Hermann
ulf.hermann at theqtcompany.com
Thu Feb 19 10:37:47 CET 2015
Hi,
> I would like to access the caller/callee list from QML Profiler programmatically, does anyone know whether there is a way to do this?
> I'm looking for something like this:
>
> console.profile()
> ...
> // call some functions (which call other functions etc.)
> ...
> console.profileEnd()
> // >> be able to navigate the callers/callees <<|
>
> I am aware it probably will not be this simple, however I would appreciate any help which could point me in the right direction.
> In case you know of another way to do this with another tool/method/... feel free to give your suggestions!
First of all, why do you want to do this? If there is some functionality missing from the QML profiler, let me know. Do you want to do this in your application or in QtCreator?
In your application, you could connect to your own debug server - a TCP server on the port you've specified either with the -qmljsdebugger arguments or by calling QQmlDebuggingEnabler::startTcpServer(). You can then implement the protocol that's used to send the data over the wire and interpret it yourself. Yes, this is complicated, but I'm trying to stay backwards compatible with the protocol. Have a look at QtCreator's QmlProfilerTraceClient or the QmlProfilerClient in the command line qml profiler tool from qtdeclarative to see how it's done. The other option would be using private headers (e.g. qv4profiling_p.h), but obviously this isn't recommended.
If you're going to extend QtCreator it's easier to interface with the data. You can just use QmlProfilerTraceClient in your own plugin. I don't promise any source or binary API compatibility, though.
br,
Ulf
--
Ulf Hermann, Software Engineer | The Qt Company
The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B
More information about the Qt-creator
mailing list