Commit Graph

52 Commits

Author SHA1 Message Date
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
Alessandro Portale
59ae002e92 QmlProfiler: Convert to using Tr::tr
Change-Id: I9f4f8c0e499eeb1e686d1094f3442c415b845c21
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-09-22 07:33:51 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Artem Sokolovskii
92b3a51358 QMLPlugins: Remove foreach / Q_FOREACH usage
Task-number: QTCREATORBUG-27464
Change-Id: Ie3e3ec9fdaea856943e5325cabd21e52bf290e70
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-01 13:47:19 +00:00
Christian Stenger
5104798b8c Check for selection support of clipboard
Setting the data on a non-supported MIME data will fail
and get deleted.
Checking beforehand gets rid of a warning printed by
QClipboard.

Change-Id: I5b5a371ce5b904f61a1aed5ea21a98908155357b
Reviewed-by: hjk <hjk@qt.io>
2020-05-14 13:19:18 +00:00
Ulf Hermann
5e7818c48c QmlProfiler: Don't assert on data from invalid model index
When selecting an item that has no equivalent in the statistics view, we
should just clear the statistics view's selection.

Fixes: QTCREATORBUG-22262
Change-Id: Id43a46859ab33285fdfb1beafe7137e1bbb3b362
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-04-09 11:25:59 +00:00
Alessandro Portale
d1df55d128 QmlProfiler: Modernize
modernize-*

Change-Id: Ibdf9c0ae91bf8a622facc7f323112b550f532f15
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-12-02 14:27:29 +00:00
Ulf Hermann
d1d4d0cdcd Qml Profiler: Do toggle extended statistics when option is checked
Task-number: QTCREATORBUG-20778
Change-Id: I3390241c25ab7a87329bc8b20c49c32cf4c02944
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-07-16 09:41:54 +00:00
Ulf Hermann
aee9cde160 QmlProfiler: In statistics view use source model for location lookup
The sorted model's rows are not equivalent to typeIDs.

Change-Id: I88868e192079f61bd1d336dac98142fd415d9a4a
Task-number: QTCREATORBUG-20501
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-05-31 07:50:48 +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
7f7fe1a9db QmlProfiler: Avoid some 0 as nullptr warnings
Change-Id: I4763a22c6624eaffbb583bf26bf74a3e282b042f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-17 13:19:30 +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
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
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
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
1732b6f882 QmlProfiler: Drop some dead code
Change-Id: I43e0803461ff8d6e30fde3c526d62402fedb6f4b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-12 05:51:42 +00:00
Ulf Hermann
5aaaa7c198 QmlProfiler: Get rid of field/column mapping in statistics view
None of the fields are ever unavailable, and they are always shown in
the same order, so we can just use the enums directly instead of a
mapping and an extra whitelist. This enables us to also drop some magic
numbers. In addition, none of the items have children. So we don't need
to expand or collapse them.

Change-Id: Ibf3d1933d1fb703f5d8e74ae5043c3d1db462738
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-12 05:51:34 +00:00
Ulf Hermann
c1a5494594 QmlProfiler: Preserve statistics sorting order across model reloads
Task-number: QTCREATORBUG-19660
Change-Id: I19e20cbeddf91790a4aec056a438e97c96f57735
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
2018-02-01 11:14:21 +00:00
Ulf Hermann
13ba063696 QmlProfiler: Fix translations and tests for statistics view
The statistics view is not called "events" anymore.

Task-number: QTCREATORBUG-19658
Change-Id: Iff4375d3dc0cf5d82d118244698887818f924c07
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
2018-01-26 11:26:48 +00:00
Ulf Hermann
e7c950eb11 QmlProfiler: In statistics use non-recursive time as total
Otherwise the percentages and totals don't match. The extra recursive
time is shown in the tooltip, without percentage (as there wouldn't be a
sensible base value for a percentage number).

Change-Id: I47fcf92aac3f60554219f7da9dd2ac90061ce496
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-08-14 09:39:50 +00:00
Ulf Hermann
e8a481744d QmlProfiler: Don't crash if a statistics entry is empty
In pathological cases we might get event types without any calls.

Change-Id: Id5c9f02c95b60fe49a7cbbac511c3727ade71db0
Task-number: QTCREATORBUG-17885
Reviewed-by: hjk <hjk@qt.io>
2017-03-21 14:16:43 +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
548a86f577 QmlProfiler: Add text marks for QML/JS types into documents
The text marks are little labels next to the lines in the editor
that tell you how much of total run time was spent in the
respective QML/JS construct during the last profiling session.
This is similar to what the valgrind profiler does.

We add the text marks only when the documents are loaded into an
editor. This keeps the number of text marks manageable. Multiple
events on a single line are shown using a tooltip.

Task-number: QTCREATORBUG-17757
Change-Id: Ie38b8ab880a718a1ef72ef343d84070ab34bc5bc
Reviewed-by: hjk <hjk@qt.io>
2017-02-21 10:43:47 +00:00
Ulf Hermann
ba1f5efca5 QmlProfiler: Change statistics view labels
They should bei in line with how we call the event types in other
places.

Change-Id: Id6a5a42bdf745d6827deeca713a0e78c5fae4783
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-12-28 10:48:32 +00:00
Ulf Hermann
35782c8e9e QmlProfiler: Drop some useless members from statistics view
Change-Id: Ic116ecaa0cb6bf5d17b4351bd751a013cd5b9636
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-12-21 14:36:30 +00:00
Ulf Hermann
18332d15b5 Timeline: Move printTime() into Timeline and add hours, minutes, nanos
We should use it for all time printing instead of duplicating the code
everywhere.

Change-Id: I530baa31fd7044aefce6201fec0ab27c99a61a1d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-12-19 13:24:16 +00:00
Ulf Hermann
a7a02897e7 QmlProfiler: Clean up view initialization
As there are only two events views we can handle them separately rather
than keeping them in a list. Also, the object names and dock IDs should
match. This breaks the settings, but that shouldn't be a big problem.

Change-Id: Iac46fd7976d1e747fef4b40cead9a54e830d188f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-12-14 16:48:36 +00:00
Ulf Hermann
de589042c0 QmlProfiler: Fix sorting of statistics items
Enforce the presence of a sort role for all items and make sure we
don't call column() during sorting. column() can be very expensive on
large models.

Change-Id: I89555072d8ef051d6e0b4f9819159238a1a40859
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2016-12-13 10:10:54 +00:00
Ulf Hermann
5101a504b3 QmlProfiler: Clean up statistics view
Fix some misnomers and remove an unused declaration.

Change-Id: Ia5e30ccc7c465a10c5214b7fe025aa0f578cdab4
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-06-10 12:43:33 +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
ebab4eb406 QmlProfiler: Remove references to binding types
They don't exist anymore.

Change-Id: Id8650dbba15e90f7cd4c485471792bfc8f40674f
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-06-10 09:13:36 +00:00
Ulf Hermann
7be3713bde QmlProfiler: Drop some useless QVariant ctors
Change-Id: Iadaa9378536cbf3fdc96ea7f7b9cd61b71f1d75e
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-06-10 09:03:31 +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
d527cc8d5a QmlProfiler: Add default argument for parent widgets on event views
Change-Id: Id67e87920a09ff2f5f5bbf73327f2cac6b299973
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-06-01 09:23:36 +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
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
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
Ulf Hermann
a01dccb426 QmlProfiler: Remove QmlProfilerStatisticsView::getStatisticsInRange()
Change-Id: I49afff5b522fe51651b65046dc560aeb8217e23c
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-04-29 13:32:50 +00:00
Ulf Hermann
e3ce0435e7 QmlProfiler: Clear range restrictions when clearing events views
Range restrictions don't persist across profiling sessions, in contrast
to feature selections.

Change-Id: If98a8dae7eed3019e68e361ea69689658241d39d
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-02-18 10:53:08 +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
ffa0c86617 QmlProfiler: Allow multiple events views loaded from plugins
Change-Id: Ifaf4e63f4a843a42a1a22f005e87d8c1a4604686
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-01-06 14:28:24 +00:00
Ulf Hermann
e4efb9bb3b QmlProfiler: Retrieve common actions from ActionManager
This removes the need to pass the QmlProfilerTool instance to all views.
QmlProfilerTool is exported so that we can access the common actions
from plugins.

Change-Id: Ie7072c23ef35763b729f4b87acce47ecbdb76e43
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-01-06 14:28:20 +00:00
Ulf Hermann
c16b843ecc QmlProfiler: Remove "Limit to Range" option from statistics view
You don't see the range you are limiting to in the statistics view, so
I doubt that anyone has ever understood what this does.

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