Commit Graph

32 Commits

Author SHA1 Message Date
Ulf Hermann
96a3c80609 QmlProfiler: deleteLater() the debug message and engine control clients
Nesting the dtors of the different clients is dangerous as the
connection might call back into a virtual function of a half-destructed
object this way.

Fixes: QTCREATORBUG-22640
Change-Id: I91fccc41fbea40a7f78ef344759abe26d140434d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-03 11:52:42 +00:00
Ulf Hermann
916883e70f Tracing: Move event storage out of trace manager
This is a step toward making the trace manager non-virtual. It should
just juggle the storages for types and events, and manage the threads to
access them. It doesn't need to know what exactly it stores.

Change-Id: I45093c60d8ae921e68aeb09bd48d24d5877ce306
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-05-08 16:26:55 +00:00
Ulf Hermann
6e0373adb3 Tracing: Move the type storage out of the trace manager
When we replay events we want to keep this constant and pass it to the
event receivers as separate entity. This way we can move the replaying
to a separate thread.

When loading we will have a similar situation, but then the loading
thread will create a new type storage and later assign that to the trace
manager.

Change-Id: I11402ed1e0663da6da5b61b15bba40e1a62adc4b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-05-08 16:11:25 +00:00
Ulf Hermann
dcd8d37f35 QmlProfiler: Don't expose the vector of event types
We always want either the total number of event types or one specific
type. There is no need to expose the fact that we keep them as a vector.

Also, use int as the type of the "number" methods as that aligns better
with Qt containers, and rename the methods. We don't need to state the
fact that we've loaded the events and types at some point.

Change-Id: Iaf680ec9fa10e1070ddee6bcc079800e401775f0
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-17 12:20:57 +00:00
Ulf Hermann
507c2d6b5b Move parts of QmlEvent and QmlEventType to timeline
Timeline will become a generic trace handling library. It needs some
abstract concept of events and event types.

Move operator== and operator!= for QmlEvent into the test as we don't
use them anywhere else.

Move the operators for QmlEventType to QmlProfilerTraceClient. We want
to get rid of the hash there as soon as we can assume that no
application we want to profile doesn't support server type IDs.

Change-Id: Icde4e3e7634e387171dc1d8bef7bbe8e71684a1a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-17 12:15:38 +00:00
Ulf Hermann
a2581a2a89 QmlProfiler: Use EngineControl to hold engines until we're done
Holding the engines with EngineControl makes sure we always receive the
full trace before the connection drops.

Change-Id: I32e7d17886cdbc4749e3e54719e198d45169cbfe
Task-number: QTBUG-66269
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-02-13 12:16:42 +00:00
Eike Ziller
cff2cc90e2 Merge remote-tracking branch 'origin/4.5'
Conflicts:
	src/plugins/cpptools/clangcompileroptionsbuilder.cpp
	src/plugins/cpptools/clangcompileroptionsbuilder.h
	src/plugins/cpptools/compileroptionsbuilder.cpp
	src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp
	src/plugins/qmlprofiler/qmlprofilerclientmanager.h
	src/plugins/qmlprofiler/qmlprofilertraceclient.cpp
	src/plugins/qmlprofiler/qmlprofilertraceclient.h
	src/shared/qbs

Change-Id: I364ababc5d41046d17e999096c4a7187c4e4e010
2018-01-09 13:13:00 +01:00
Ulf Hermann
5bd0ee0b4c QmlProfiler: Process remaining events if connection drops
When the connection drops while receiving a trace we can easily process
the buffered events. The trace client test case has some traces with
trailing open ranges that can be recovered this way.

Change-Id: I8b2ecc135b0cabff18923fbc8f3f14b5cb3a96ee
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-01-04 12:41:04 +00:00
Ulf Hermann
4a5bd323a9 QmlProfiler: Retain event types between sessions on same connection
The server won't re-send the event types. We need to keep them until the
connection goes away. Otherwise we get invalid event types and soft
asserts when trying to look up event types for new events. Also, when
clearing the event types, also clear the server type IDs. Not clearing
those constitutes a memory leak.

Change-Id: I564b0c4cf0ed754549d2b8ede63c97fa01affcec
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-01-03 13:51:47 +00:00
Oswald Buddenhagen
777ca8e655 Merge remote-tracking branch 'origin/4.5'
Conflicts:
	src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
	src/plugins/qmlprofiler/qmlprofilertraceclient.cpp

Change-Id: I94647f59d7a9df48168ac066555afe80f5f9b91f
2017-12-21 13:20:24 +01:00
Ulf Hermann
a21a518d38 QmlProfiler: Record debug messages separately
They are not time-ordered like normal messages, so we need to buffer
them and only insert them when the normal event stream arrives at their
timestamp.

The time ordering is important as the "restrict to range" feature uses
it to determine the start of the range.

Change-Id: If27a3f667c4c39e69efa95fcb9cdfd3dbf01e657
Task-number: QTCREATORBUG-19456
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-12-19 09:36:41 +00:00
Ulf Hermann
1e49ac3041 QmlProfiler: Properly clear the trace client
Rename the method to clear() and make sure all the event types and
pending events are actually cleared.

Change-Id: Ie6c916d374a00025f7d77d21345d039fe8cead80
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-11-22 11:13:10 +00:00
Ulf Hermann
9cdb0ec22e QmlProfiler: Don't trust in externally provided timestamps
We might get timestamps that are outside the trace time, negative
timestamps, ranges that go backwards, and other insane things.

In order to deal with this, we clamp all negative timestamps to 0, and
treat the specified trace time as minimum range, that can be overridden
by events.

Change-Id: Iba661f2a4346077871fc62a46759e169b2aad49d
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2017-09-12 14:25:01 +00:00
Ulf Hermann
e3ae628584 QmlProfiler: Don't crash on inconsistent profiling data
The trace may contain RangeData and RangeLocation entries that aren't
aligned with any RangeStart. As the trace is generated by an external
process we need to handle that.

Change-Id: I39a524127c9c9059e5c5521797e5effd385ce12b
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2017-09-08 09:05:55 +00:00
Ulf Hermann
1634987cae QmlDebug: Don't use QmlDebugConnection unconditionally
It might be null. We wrap the retrieval of the data stream version in
QmlDebugClient and return the minimum if connection is null. The extra
copy of the connection QmlEngine is dropped as QmlDebugClient already
has one and we don't want to hit a dangling pointer.

Change-Id: Ida8c45d357d46b4942eea99b77065d3c51c7edb9
Reviewed-by: hjk <hjk@qt.io>
2017-09-07 13:28:52 +00:00
Ulf Hermann
78daf47a25 QmlProfiler: Remove references to QmlProfilerDataModel
We keep it private to QmlProfilerModelManager and proxy the last few
methods that were directly called on the model. This enables us to
remove the QmlProfilerDataModel class by integrating what is left of it
into QmlProfilerModelManagerPrivate in a next step.

Change-Id: Ie9b4e03fb286e5a0040374d00b7b26f810426278
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-02-24 11:55:45 +00:00
Ulf Hermann
5dd25c42cb QmlProfiler: Move event handling into model manager
This is the logical place to do it. Adding the event first to the QML
model and then passing it back to the manager in order to have it
dispatched to the other models is somewhat backwards.

Change-Id: I64b1cb38f97331b62d83fa5ae49b9b2690810d40
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2017-02-15 12:38:21 +00:00
Ulf Hermann
5d6f5ff2c9 QmlProfiler: Move unrelated code out of QmlProfilerClientManager
The client manager should not be bothered with details of QML events,
but rather just connect the client, the model manager, and the state
manager.

Change-Id: Iec4499f8441a06d4ef5cbcf7bfe23da6f5e7f239
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2016-08-05 10:44:46 +00:00
Ulf Hermann
eae76df140 QmlProfiler: Don't reorder events in trace client
We stash the ranges until we receive RangeLocation and RangeData. In
order not to send other messages before the range they belong to, we
need to keep them around, too, until we send the range.

Change-Id: I0ce4ced68ee343c54638ce262216c4bf1e4ddc13
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2016-07-11 15:28:44 +00:00
Ulf Hermann
69832a22d3 QmlProfiler: Move qHash and operator== for QmlEventType
It makes more sense to have them in the same location as the actual
type.

Change-Id: Ia27970173d14cfe361d4fc007cb461f788350b21
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-06-10 12:43:10 +00:00
Ulf Hermann
e10bc709bc QmlProfiler: Provide a sane ctor for QmlEventType and use it
... in turn, make its members private, so that we don't accidentally
change them.

Change-Id: Ibc65b406ee341d33f69647ed1b19e1e34f5cd535
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-06-10 12:43:05 +00:00
Ulf Hermann
472745fb2e QmlProfiler: Make members of QmlEventLocation private
You should not change them independently as that is error-prone.

Change-Id: I07890a29b045492fe804b9537094dea763bc1b8d
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-06-10 09:02:37 +00:00
Ulf Hermann
94fc57c005 QmlProfiler: Support server generated event type IDs
This way we only have to transmit the location and data events once per
type, not once per event.

Change-Id: Ic6ab9619824764fc8b3abf09c7b58200eda2a198
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-05-25 13:52:45 +00:00
Ulf Hermann
0924ee5efb QmlProfiler: Move type resolution logic into trace client
This way we will be able to use server-provided type IDs for more
efficient lookup of event types.

Change-Id: I37cd592a7829e5f36c6cfc04e400013d1dc37155
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-05-25 13:52:38 +00:00
Ulf Hermann
ebd6d269c2 QmlProfiler: Directly pass events from client to model
Running them through the model manager via signals doesn't make much
sense anymore.

Change-Id: I6103d281dd640493f28acd7e787ea49712ebd8df
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-05-25 13:52:33 +00:00
Ulf Hermann
4a1e5a637a QmlProfiler: Drive event loading from the model manager
We want to get rid of the big master list of QmlEvent in
QmlProfilerDataModel, as that gets very large for longer traces. In
order to reduce the dependencies on that list we load the events on the
fly into the child models while they are being received, rather than
having the child models query QmlProfilerDataModel for the event list
later.

As the trace client so far only emitted rangedEvent() for complete
ranges we run into problems with models that need their events sorted.
The rangedEvent() signals were sorted by end time, rather than start
time which makes it inconvenient to analyze them in a stack based way,
for aggregation. This is solved by passing on all the details from the
trace client to the models, with the QmlProfilerDataModel aggregating
the type information before having the events dispatched to the child
models.

Change-Id: I5831a20551f21cf91e27d298a709f604ebd96c3e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2016-05-23 12:31:44 +00:00
Ulf Hermann
a53780924d QmlProfiler: Apply some code cosmetics
Change-Id: I772713aec3a6c25136174b39b853a9ef3ee42a0b
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-05-06 10:27:09 +00:00
Ulf Hermann
e5a38bacc4 Move QmlProfiler specific files from qmldebug to qmlprofiler
These file were not used anywhere else and had no business to be in
qmldebug to begin with. Moving them allows us to drop a number of
namespace qualifications and forces us to rename a few local symbols
in other classes in order to avoid name clashes.

Change-Id: I658ed455eec027cbaddacf2980d2ea6827ae6205
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-05-03 15:00:50 +00:00
Kai Koehne
687a60065a QmlJSDebugClient: Move QmlProfilerTraceClient into library
Change-Id: I1c0821778a3350ec55741b45680fca2cb1fed3aa
Reviewed-on: http://codereview.qt.nokia.com/2680
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
2011-08-05 12:17:30 +02:00
Thomas Murach
a4c4d67772 corrected license headers
Change-Id: I56fa50745a80abf52488bebe6a5a72cf26932a8b
Merge-request: 352
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Reviewed-on: http://codereview.qt.nokia.com/1251
2011-07-06 17:56:15 +02:00
Christiaan Janssen
c5d6bc49e5 QmlProfiler: refactored the event views into a single class
Change-Id: I4fd193490c42894da73951afcf50e40a44abaa07
Reviewed-on: http://codereview.qt.nokia.com/1019
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
2011-07-04 13:20:36 +02:00
Kai Koehne
5525e7d20d QmlProfiler: Rename TracePlugin to QmlProfileTraceClient
Also move it into it's own file.

Change-Id: If063b0a4c6642b1e209e6a0026fedffd01603eb9
Reviewed-on: http://codereview.qt.nokia.com/841
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
2011-06-28 17:04:48 +02:00