Commit Graph

1631 Commits

Author SHA1 Message Date
hjk
2360a2d743 ProjectExplorer: Run RunControl::{start,stop} always asynchronously
This introduces a mini-state-"machine" to handle RunControl states
Intialized->[Starting->Running->Stopping->Stopped->]*->Finished.

Needing time between trying to start and getting feedback is nowadays
the normal setup for all remote targets as well as for most local tools.
Making that the default for all runs simplifies the code and provides an
opportunity to (a) fix some currently wrong reports of "stopped
immediately" and (b) to remove target-specific (WinRT) or tool-specific
(Valgrind, GammaRay) state members doing essentially the same.

Change-Id: I7f52fee41144188ee8389e922fdc265f8c0a6459
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-03-24 13:37:46 +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
b609f2d9e9 QmlProfiler: Correctly process coarse-grained traces
If many events start or end at the same time, the parser would confuse
their order, resulting in meaningless statistics.

Change-Id: I05f94e694c16d6c22b6e937c2f979ce572a068d1
Task-number: QTCREATORBUG-17885
Reviewed-by: hjk <hjk@qt.io>
2017-03-23 15:09:15 +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
Robert Loehning
312784a930 QmlProfiler: Avoid overflows in loadEvent
Change-Id: I23271d6dc8ede3f76ef712547519b04dc86d94a6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2017-03-21 12:39:57 +00:00
Robert Loehning
9a9f1f9cfe QmlProfiler: Add comments about deliberate fallthroughs
Change-Id: Ia9a7d62f8f3dbc753f2746f3f53f5557d9607d45
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2017-03-21 12:19:22 +00:00
Ulf Hermann
883492c135 TextEditor: Set widthFactor from TextMark ctor
The text marks are added to the document from their ctor. The document
then uses the widthFactor to calculate the space needed for them. If the
widthFactor is only set afterwards, the calculated space is wrong.

Change-Id: Ic7d24f99cc78d1bf084b2b1cfdf6b955496072f3
Task-number: QTCREATORBUG-17833
Reviewed-by: hjk <hjk@qt.io>
2017-03-16 16:19:22 +00:00
Orgad Shaneh
da7cb91446 Merge remote-tracking branch 'origin/4.2' into 4.3
Change-Id: I4931dcc81be872d7712e67123e94d15ee696459f
2017-03-14 16:20:14 +02:00
Samuel Gaist
4033471aa9 QRegExp include cleanup
This patch adds the missing include statements for QRegExp.

Change-Id: Ibb03b929940adb84ae190b5090cb6b88653cc14c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-03-13 22:05:30 +00:00
Tobias Hunger
e07c6383d7 ProjectExplorer: Unify RunControl setup/teardown
Provide protected methods in RunControl to handle the notification
of when the RunControl starts and stops. Use these helpers to
move the isRunning() method into the RunConfiguration itself instead
of reimplementing it everywhere.

Change-Id: Ia8de42f7a6a14a049870d4e7fcb9af6756c2caa4
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-01 12:46:59 +00:00
Robert Loehning
e6fd203b76 QmlProfiler: Initialize members inside class
Change-Id: I8154dad0eef9e11650e257b46840c295cf5e0624
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2017-02-28 12:57:20 +00:00
Ulf Hermann
c84f650fb2 QmlProfiler: Integrate QmlProfilerDataModel into model manager
There is no need to keep them separate as the data model is not
accessed from the outside anymore. This removes a lot of indirection.

Change-Id: I91da4dfa816295300c8cfcca22430d5c5b3298c0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-02-24 11:55:53 +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
2b75df2139 QmlProfiler: Simplify buffer handling when loading trace
The inserting of events into the buffer is not the bottleneck here.
The book keeping is probably more expensive than just always using
all the events contained in a chuck from the file for one batch.

Change-Id: I75a936fdf9e3a1d9675b44d67b98f14594f87ffd
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-02-24 11:55:34 +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
1ee8d0fb64 QmlProfiler: Improve error and progress handling for loading and saving
* Clear the trace and send the loadingFinished() signal when loading
  fails or is canceled. loadingFinished() re-enables the UI, which is
  in fact important.

* Check more consistently for whether the operation was canceled and
  add a separate signal for that.

* When saving fails or is canceled, remove the half-written file.

* Don't try to guess the number of events for progress reporting when
  saving. Use the event timestamps and start/end time instead.

* Properly initialize the progress range in all cases.

* Drop the bool return value from the load methods. Nobody uses that.

* Send loadFinished() only after loading a file, not every time we
  reach the Done state.

Change-Id: I507f11c667e20534ea335e84798de11aa06fb6f2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2017-02-24 11:55:10 +00:00
Tim Jenssen
2631ffabd5 Remove spaces in initializer lists
Format initializer lists code style like.

Change-Id: Ib82c235e4ba7dc75ee96a7abc0c47eff7b0a9013
Reviewed-by: hjk <hjk@qt.io>
2017-02-22 16:25:09 +00:00
Ulf Hermann
65e22d5a0a QmlProfiler: Drop some dead code
Change-Id: I3eead26da7048ecc839edcc946c677da8a7134be
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-02-22 10:17:02 +00:00
Ulf Hermann
39459f98e8 QmlProfiler: Optimize flame graph model
foreach() is slow in hot loops like these. Also, by moving frequently
used children to the front we reduce the effort to find them in
further iterations.

Change-Id: Ib5dceb82511fdd1cb59c50e1ab2485f5035fbef8
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2017-02-21 15:16:18 +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
Robert Loehning
6600328979 QmlProfiler: Initialize QmlProfilerDetailsRewriter::detailsRewriter
Change-Id: I4891885ff30c88bdca32af062e161758501db6c1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2017-02-20 15:04:37 +00:00
Ulf Hermann
3cf6f3d5dd QmlProfiler: Don't try to open editor at line 0
There is no line 0, so if the document is already open, the editor
won't move to the beginning. Use line 1 instead, so that we jump to the
location of the corresponding text mark.

Change-Id: I0c5605d2d48b02d73dd97ddc87a527cf1b5dba8f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-02-15 16:00:53 +00:00
Ulf Hermann
1cf40ae647 QmlProfiler: Don't register a model ID for the QML model
We never do anything useful with it. This relieves us from the need to
keep the manager around in the QML model and decouples them.

Change-Id: If58fc147b86b07f533aeaaa896f3416d4c0ef6bb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-02-15 12:38:46 +00:00
Ulf Hermann
827d48db6e QmlProfiler: Move the file finder into the QML model
This is the place where we need it most. In addition, this allows us to
use the DetailsRewriter's cache also on gotoSourceLocation.

Change-Id: I14e0f11ba7c8a2a3888b2e8439a375068b36e29a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2017-02-15 12:38:30 +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
9fc79c43d8 QmlProfiler: Optimize loop over event types
Change-Id: I656ff49a9e62f128c4eed84882245aa490e2960e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-02-01 12:56:40 +00:00
Tobias Hunger
c6f90e575e Utils: Introduce a TemporaryDirectory and TemporaryFile class
Both wrap the corresponding Qt class, but make sure all temporary files
or directories are created inside a "master temporary directory".

Change-Id: I55461be507c828c965224c02863ea5ed9bbf9498
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-20 12:17:10 +00:00
Ulf Hermann
eaba6ff660 QmlProfiler: Fix pixmapcachemodel test
Since the cache size is not given for individual file events anymore,
the test should only check it for the events in row 1.

Change-Id: Idfc7ec90ab8da214f4eedce36dd3b84fb00ed553
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-01-10 10:09:01 +00:00
Ulf Hermann
7477411d71 QmlProfiler: Calculate the model ID in the flame graph model test
... instead of guessing it. This is more robust.

Change-Id: I4855b78da23cb1caefa3a7a95bfa60c5733b32c5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-01-10 10:07:02 +00:00
Ulf Hermann
405c456d0d QmlProfiler: Print timestamps with context
For traces that start at a high timestamp, we want the timestamps to
still have some meaning. Without context the formatter will only
print something like "5h 25m" for all of them, which is not very
useful.

Change-Id: I7ec37659083f967c9ed03a843f6b7c9430214670
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-01-04 16:57:03 +00:00
Ulf Hermann
59c186de5f QmlProfiler: Resolve pixmap file name via pixmapcache model in test
This tests that the file name is correctly stored in the model and it
removes the detour via the model manager.

Change-Id: Icc592b6383edcb18bfe31a81eb7ae0736a4f5508
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-01-04 16:39:24 +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
55d6997154 QmlProfiler: Only show pixmap cache size on cache change events
... and make the default size 0, rather than -1. Showing cache sizes
for individual pixmaps doesn't make much sense as other pixmaps might
get loaded at the same time.

Task-number: QTCREATORBUG-17424
Change-Id: Iead21c21d87b454ef03961d22119e0f5351d11ea
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2017-01-03 12:40:42 +00:00
Ulf Hermann
3ed12811e0 QmlProfiler: Remove unused include
Change-Id: If7334bc067fde54fcc7806c0e785fe694bcbcf4f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-01-02 12:00:02 +00:00
Ulf Hermann
90e09f7658 QmlProfiler: rename requestId into typeId
No need to invent a new name for the same thing.

Change-Id: I370ec7be9c762642ae35e4f7a60ff9f5eb8ae3fe
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-12-28 10:48:42 +00:00
Ulf Hermann
795b8bcb9e QmlProfiler: don't manually delete parented QObjects
Change-Id: I8098cdb09fa347d7c792ee34e51ad31be85923a3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-12-28 10:48:38 +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
2ad8e27d53 QmlProfiler: Make the views accessible from the view manager
And then, drop some methods we don't need anymore.

Change-Id: I057bdc012072abddca2df83918ee9a0460f78611
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-12-28 10:48:14 +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
31e2fcc893 QmlProfiler: Avoid QHash::equal_range()
It was only introduced in Qt 5.7.

Change-Id: I5f810c7244b8e8551c3249d8a8f7c6625185692e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-12-21 09:28:59 +00:00
Eike Ziller
589fedf455 Merge remote-tracking branch 'origin/4.2'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri
	src/plugins/projectexplorer/kitinformation.cpp

Change-Id: I94299b069418586db97d1d596a252794e4037556
2016-12-20 17:14:19 +01:00
Ulf Hermann
fcb38d1443 QmlProfiler: Make various primitive types Q_MOVABLE_TYPE
Change-Id: I08c37b33fcc2ec8c3610d52a55571878ff8bdc7d
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2016-12-20 13:36:18 +00:00
Ulf Hermann
5479143bde QmlProfiler: Simplify details rewriter
There is not need to constantly loop all the requests. We can simply
hash them by file name. Also, we only need one container for file names
and requests, and we don't need to construct a QTextStream, just to do
QString::mid(), and the connecting and disconnecting to/from the QML
code model needs to be centralized.

Change-Id: I6a887f3375f0534e4b8fab6613882038ea4ddf43
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2016-12-20 13:36:14 +00:00
Ulf Hermann
ee766f6d52 QmlProfiler: Remove pimpl pattern from details rewriter
It's internal, so we don't need to hide it behind a d pointer.

Change-Id: Ib5b7ac790a1c143414a7ed11e06a5d8a9464de55
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2016-12-20 13:36:09 +00:00
Ulf Hermann
5ec8cb437a QmlProfiler: Apply some coding style
Change-Id: Id214986aaf6c7b0de50fdba2e45d8d0a309dabc3
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2016-12-20 09:14:23 +00:00
Ulf Hermann
6fa4722020 Timeline: Use formatTime also from QML
Change-Id: I14c8e8a216008c2dafaa2d42bd3237d33cc2b781
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-12-19 13:24:23 +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
be705a3ea1 QmlProfiler: Disable note search button if timeline is unusable
Change-Id: I4c57f99bdea365b2ade913cb6b44ddf401f47aa8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-12-15 10:29:30 +00:00