Commit Graph

43 Commits

Author SHA1 Message Date
Sona Kurazyan
82bcf4e9f5 Remove usages of deprecated APIs
Replaced:
  QPalette::ColorRole::Background -> QPalette::ColorRole::Window
  QPalette::ColorRole::Foreground -> QPalette::ColorRole::WindowText
  Qt::ItemDataRole::TextColorRole -> Qt::ItemDataRole::ForegroundRole
  QFontMetrics::width() -> QFontMetrics::horizontalAdvance()

Task-number: QTBUG-76491
Change-Id: I1302e6b569e725daa6f7be1428ffe055657fc644
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-09-03 09:15:30 +00:00
Orgad Shaneh
668e8262c7 QmlProfiler: Fix implicit fall-through
Detected by GCC8.

Change-Id: I59d55322eaef631163a56b619ffbf09671758caa
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-11 09:21:31 +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
95d7be1b28 Tracing: Generalize event filtering
This allows us to not only filter by ranges, but potentially also by
other criteria.

Change-Id: I7349ceeabbb2781473a3a4c803dab1006b7b8e50
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-05-08 14:13:43 +00:00
Ulf Hermann
734611131d Move Timeline and FlameGraph into a common "Tracing" library
This allows us to share code between the two, in particular the QML code
for the Details window, and the theme code. This way we can potentially
deduplicate some code.

Change-Id: I3a0d26b18488bd2a46b5b077b5b5d79ac2dfc5ce
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-05-04 14:08:47 +00:00
Ulf Hermann
1770c2ffe2 Remove TimelineTraceManager::State
This is redundant, now that we have registerFeatures().

Change-Id: Ia56c28b8892ab6da694570fe4b9ea5c96fe194f1
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-23 14:20:16 +00:00
Ulf Hermann
08ca10de81 QmlProfiler: Rename specific replayEvents to replayQmlEvents
Some compilers cannot discern the two replayEvents methods.

Change-Id: Ide4a893ff3976cb081fbbceefacafb6226f0a73f
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2018-04-19 11:21:59 +00:00
Ulf Hermann
1c2e0f387f QmlProfiler: Move parts of model manager and trace file to Timeline
This way we can use the trace file loading and saving mechanism for
other profilers.

Change-Id: I98ec1cdde6f7abcea152cabf72e64d4e696dfa59
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-19 08:09:07 +00:00
Ulf Hermann
780d4c6a43 Timeline: Move modelId generation into aggregator
The way the notes model works requires every timeline model to have a
different ID. Conversely no other kind of model actually needs an ID.
Therefore it makes sense to have the TimelineModelAggregator manage the
IDs as every timeline model will sooner or later be associated with an
aggregator.

Change-Id: Ib8b2c88ed883351d4e3e156dd13e1dd113c21808
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-17 14:11:51 +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
7ca958fa85 QmlProfiler: Integrate TraceTime into ModelManager
We never use it independently and only a subset of its interface needs
to be public.

Change-Id: I97bbc638270bcbb8fb1a4097fcfeacf37e96c048
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-17 12:17:23 +00:00
Ulf Hermann
1ccd058bdf QmlProfiler: Get rid of processing step
The child models are made aware of possible changes in the details
strings, and in turn, we can do the finalization immediately after
acquiring is done.

Change-Id: Ibe57f158e64e5d01d4c97aa617c9b2bcc8e4e96e
Task-number: QTCREATORBUG-20106
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-17 09:13:04 +00:00
Ulf Hermann
e0cab79965 QmlProfiler: Clean up type selection in statistics model
The statistics have one extra valid event type: "Main Program". This
should not be mapped to typeId -1, as -1 is the invalid typeId. Map it
instead to std::numeric_limits<int>::max() and remove all the hacks
around it.

Additionally, optimize the selection algorithm for the statistics main
view: We don't need to iterate all types to select one. We can rather
use the fact that the row numbers in the source model match the type
indices (except for the two special ones).

Change-Id: I7c4dc4f84fd167f9a21c418466ad2bfce56e441f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-17 09:09:32 +00:00
Ulf Hermann
b135306d9f QmlProfiler: Remove now-unused members from statistics
Change-Id: Ibf56f405dc51a82d0f56ab300905b1137375d5c0
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-16 14:16:03 +00:00
Ulf Hermann
4aa432bb9a QmlProfiler: Eliminate QStandardItemModel from statistics
This resolves the data duplication between model manager and statistics
models, that gets in the way of updating the details strings on the fly.

Task-number: QTCREATORBUG-20106
Change-Id: I1c4881f903402dff936267de03b84d05ab7c39ca
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-16 13:35:44 +00:00
Ulf Hermann
495b9aa9c2 QmlProfiler: Make statistics models QAbstractItemModels
This way we will be able to replace the QStandardItemModels in a next
step.

Change-Id: I863fde958d29c8bf8c36aa1f501cb1224720ad7a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-16 13:35:33 +00:00
Ulf Hermann
7f2912b036 QmlProfiler: Rename method in statistics model
dataChanged() was too generic and easily confused with other methods.

Change-Id: I68b8bcb609599e56a1a2d3c6cf53d878281f7818
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-16 09:19:28 +00:00
Ulf Hermann
87c12c4e1b QmlProfiler: Store statistics data in a saner way
We don't need to retain the durations after finalize(), and we can use
vectors instead of hashes, as we will cover almost all types anyway.

Vectors allow us to potentially use the position of an item in the data
as its row.

Change-Id: I2c09406f0e0a42f5f517f8444755b1664efb8f3b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-04-16 07:16:35 +00:00
Christian Stenger
c637c66ebb QmlProfiler: Avoid structs with default values
gcc 4.9 and msvc 2015 choke when creating those from initializer lists.

Change-Id: I85936fe33418d5d9ffeb3c910392ad43fbb9a9bb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-04-12 10:30:13 +00:00
Ulf Hermann
1155601da5 QmlProfiler: Move some methods from statistics view into model
This allows us to tighten up the public interface of the model.

Change-Id: Iaa0363993de7cd94c3468d2c939198e65746e829
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-12 10:15:44 +00:00
Ulf Hermann
5de5794c49 QmlProfiler: Disambiguate parent/child terminology in statistics
When talking about call stacks call them "caller" and "callee". Call
the invisible root item of the model "rootItem".

Change-Id: I551b23f1491d391145193901d3f3a29ab3942089
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-12 09:13:22 +00:00
Ulf Hermann
f94e048c2f QmlProfiler: Un-pimpl statistics classes
They aren't part of any public API and the pimpl pattern just gets in
the way here.

Also, initialize members inline where possible, remove redundant
deletes, prefer explicit ownership over parenting, and use
std::unique_ptr for owned objects and QPointer for non-owned QObjects.

Change-Id: Ibe1e1f88d0e38b6ca26544fccb1db6b809d1556b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-12 09:12:10 +00:00
Ulf Hermann
06aa4c573e QmlProfiler: Fix type for restrictToFeatures
Change-Id: Ifdc75c570faf4ae6784decf80a530c0e30d44e1d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-12 05:53:30 +00:00
Ulf Hermann
bdecee9feb QmlProfiler: Add some sanity checks to the various models
If we pop an event from the stack, then it should be the same type we
pushed earlier.

Change-Id: If4389cb57fa8996b3772fefca92d27c33dc35c65
Task-number: QTCREATORBUG-17885
Reviewed-by: hjk <hjk@qt.io>
2017-03-23 15:16:14 +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
bf69eb9467 QmlProfiler: Guard against the temporary trace file going away
If we cannot open a temporary file to cache a trace or retrieve a
previously cached trace, the QML profiler won't work correctly. Show
an error in this case.

Change-Id: I468d74d9c33033b9ad19501bccbd69a9fe164fed
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-02-24 11:55:16 +00:00
Ulf Hermann
9f0a51a0d1 QmlProfiler: Change total time and recursion display in statistics
The total time taken for a program should be the sum of durations of
events on the bottom of the stack. This is also what the flame graph
model does, and it results in useful percentages for total and self
times.

Recursion still has to be accounted for when showing the total time of
a specific event type, but we mark events with recursive calls and
show the time and percentage of recursion in the tooltip. As we already
showed binding loops on bindings and signal handlers before, this
integrates nicely.

Change-Id: Id4654e314bf86ce8bd06ceaaf93a67187c629adc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2017-02-21 10:43:53 +00:00
Ulf Hermann
5dd4b7d8fe QmlProfiler: Simplify stack handling in statistics model
There is no need to keep empty events at the bottom.

Change-Id: I072b50329a9f277005cbfa45350c060abd7e7a36
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-01-04 16:38:55 +00:00
Ulf Hermann
ba46ebc0f2 QmlProfiler: Remove unused member
Change-Id: Ieea5c09903477c9a9cb3ad158404ffe893f95c55
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-01-04 16:36:09 +00:00
Ulf Hermann
0d5f5bdd6c QmlProfiler: Keep Compile and QML/JS statistics separate
The QML compiler can run asynchronously and produce ranges that don't
match up with other QML/JS ranges. The statistics model assumes that
all ranges are perfectly nested, and produces incorrect data if they
aren't. The compile ranges are perfectly nested among themselves, and
the other QML/JS ranges are also perfectly nested among themselves, so
we can fix this by keeping separate statistics for them.

Also, choose a less insane data structure for the relatives model.

Change-Id: I146593b67586e7b5aba6b19d360961c142511289
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2016-09-09 08:21:20 +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
d33dcac6ca QmlProfiler: Fix "Callee" vs "Caller" labels in statistics view
Change-Id: I28a134b0ae72bb87ad6849f0f70a5332ec019a50
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-05-26 13:14:24 +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
dd87df7e5d QmlProfiler: Load data event by event in aggregated models
This paves the way for driving the event loading from the model
manager. Also, unify the loading and eliminate the two different
classes for the children models.

Change-Id: Ic89e757963292d75b3b6fd7d6012f09194dff5a9
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2016-05-23 12:31:28 +00:00
Ulf Hermann
1e8996b438 QmlProfiler: Methods for dispatching events by feature
When announcing features models have to provide functions that handle
events for those features now. The model manager gets a function to
dispatch events to the models that subscribe to them.

Change-Id: I3fd80443a68ba264a513d8d53ed473cf072f1dc7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-05-23 12:30:09 +00:00
Ulf Hermann
1093be0425 QmlProfiler: Remove detailed progress tracking
The progress bar in the state widget was rather meaningless. We rarely
know how many events we expect and it's rather hard to tell how long
each model will take to process them. Instead, we just show a 0-ranged
progress bar to tell the user that "something is happening".

Change-Id: Icb80840d1f0a1538bcf254faa37cbb36e25d342c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-05-23 11:44:13 +00:00
Ulf Hermann
215c0533d2 QmlProfiler: Rename QmlEvent::startTime to "timestamp"
As many events are instantaneous and we're going to drop the duration
property soon, this is more fitting.

Change-Id: I6e13dd076a5b9df16aed44bf9f631ea5760e9cbf
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-05-06 10:36:40 +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
a955537132 QmlProfiler: Fix the naming scheme for events and event types
Move them out of the QmlProfilerDataModel class, drop the "Data"
suffix, and rename symbols that refer to them in order to call them by
their names.

Change-Id: I41151359921b325edb79111371083c4185bd148b
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-05-04 09:49:32 +00:00
Ulf Hermann
5253dfeacf QmlProfiler: remove unused members from statistics relatives model
We never use the q pointer and we only show notes in the main model.

Change-Id: I635a97f8d878ba12b9ae55e2b758d1651d5e3aae
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-05-03 15:01:38 +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
Tobias Hunger
397e7f4843 Update License according to agreement with Free Qt Foundation
* Update files in src/plugins

Change-Id: Ia5d77fad7d19d4bb3498e78661982f68729adb22
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:57:01 +00:00
Ulf Hermann
3cd2d375ff QmlProfiler: Rename QmlProfilerEventsModelProxy
It is only used for the statistics view.

Change-Id: I71027dd864715b4a2f95c2b11af0c0d83c514229
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-01-06 14:25:15 +00:00