Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
fbe9925d
Commit
fbe9925d
authored
Mar 24, 2011
by
Christiaan Janssen
Browse files
QmlProfiler: ongoing work
parent
66413d9a
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/plugins/analyzerbase/analyzermanager.h
View file @
fbe9925d
...
...
@@ -96,10 +96,10 @@ public:
public
slots
:
void
showStatusMessage
(
const
QString
&
message
,
int
timeoutMS
=
10000
);
void
showPermanentStatusMessage
(
const
QString
&
message
);
private
slots
:
void
startTool
();
void
stopTool
();
private
slots
:
void
handleToolFinished
();
void
toolSelected
(
int
);
void
toolSelected
(
QAction
*
);
...
...
src/plugins/qmlprofiler/Elapsed.qml
deleted
100644 → 0
View file @
66413d9a
import
QtQuick
1.1
import
Monitor
1.0
import
"
MainView.js
"
as
Plotter
Text
{
id
:
elapsed
color
:
"
white
"
Timer
{
property
date
startDate
property
bool
reset
:
true
running
:
connection
.
recording
repeat
:
true
onRunningChanged
:
if
(
running
)
reset
=
true
interval
:
100
triggeredOnStart
:
true
onTriggered
:
{
if
(
reset
)
{
startDate
=
new
Date
()
reset
=
false
}
var
time
=
(
new
Date
()
-
startDate
)
/
1000
elapsed
.
text
=
time
.
toFixed
(
1
)
+
"
s
"
}
}
}
src/plugins/qmlprofiler/MainView.qml
View file @
fbe9925d
...
...
@@ -60,6 +60,29 @@ Rectangle {
}
// Elapsed
property
real
elapsedTime
;
signal
updateTimer
;
Timer
{
property
date
startDate
property
bool
reset
:
true
running
:
connection
.
recording
repeat
:
true
onRunningChanged
:
if
(
running
)
reset
=
true
interval
:
100
triggeredOnStart
:
true
onTriggered
:
{
if
(
reset
)
{
startDate
=
new
Date
()
reset
=
false
}
var
time
=
(
new
Date
()
-
startDate
)
/
1000
//elapsed.text = time.toFixed(1) + "s"
root
.
elapsedTime
=
time
.
toFixed
(
1
);
root
.
updateTimer
();
}
}
//timeline background
Item
{
anchors.fill
:
flick
...
...
@@ -246,17 +269,4 @@ Rectangle {
anchors.top
:
canvas
.
top
}
Rectangle
{
width
:
50
height
:
30
anchors.right
:
root
.
right
anchors.top
:
root
.
top
radius
:
4
color
:
"
#606085
"
Elapsed
{
anchors.centerIn
:
parent
horizontalAlignment
:
Text
.
AlignHCenter
}
}
}
src/plugins/qmlprofiler/qmlprofiler.qrc
View file @
fbe9925d
<RCC>
<qresource prefix="/qml">
<file>Detail.qml</file>
<file>Elapsed.qml</file>
<file>Label.qml</file>
<file>lock.png</file>
<file>MainView.js</file>
...
...
src/plugins/qmlprofiler/qmlprofilerengine.cpp
View file @
fbe9925d
...
...
@@ -3,6 +3,9 @@
#include "qmlprofilerplugin.h"
#include "qmlprofilertool.h"
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerconstants.h>
#include <projectexplorer/applicationrunconfiguration.h>
#include <private/qdeclarativedebugclient_p.h>
...
...
@@ -83,16 +86,27 @@ void QmlProfilerEngine::stop()
emit
stopRecording
();
}
void
QmlProfilerEngine
::
spontaneousStop
()
{
AnalyzerManager
::
instance
()
->
stopTool
();
}
void
QmlProfilerEngine
::
viewUpdated
()
{
d
->
m_process
->
terminate
();
if
(
!
d
->
m_process
->
waitForFinished
(
1000
))
{
d
->
m_process
->
kill
();
d
->
m_process
->
waitForFinished
();
if
(
d
->
m_process
)
{
disconnect
(
d
->
m_process
,
SIGNAL
(
finished
(
int
)),
this
,
SLOT
(
spontaneousStop
()));
if
(
d
->
m_process
->
state
()
==
QProcess
::
Running
)
{
d
->
m_process
->
terminate
();
if
(
!
d
->
m_process
->
waitForFinished
(
1000
))
{
d
->
m_process
->
kill
();
d
->
m_process
->
waitForFinished
();
}
}
delete
d
->
m_process
;
d
->
m_process
=
0
;
}
emit
processTerminated
();
delete
d
->
m_process
;
}
bool
QmlProfilerEngine
::
QmlProfilerEnginePrivate
::
launchperfmonitor
()
...
...
@@ -113,16 +127,18 @@ bool QmlProfilerEngine::QmlProfilerEnginePrivate::launchperfmonitor()
m_process
->
setProcessChannelMode
(
QProcess
::
ForwardedChannels
);
m_process
->
setWorkingDirectory
(
m_workingDirectory
);
connect
(
m_process
,
SIGNAL
(
finished
(
int
)),
q
,
SLOT
(
spontaneousStop
()));
m_process
->
start
(
m_executable
,
arguments
);
// give the process time to start
sleep
(
1
);
if
(
!
m_process
->
waitForStarted
())
{
if
(
QmlProfilerPlugin
::
debugOutput
)
qWarning
(
"QmlProfiler: %s failed to start"
,
qPrintable
(
m_executable
));
return
false
;
}
sleep
(
1
);
if
(
QmlProfilerPlugin
::
debugOutput
)
qWarning
(
"QmlProfiler: Connecting to %s:%d"
,
qPrintable
(
QmlProfilerTool
::
host
),
QmlProfilerTool
::
port
);
...
...
src/plugins/qmlprofiler/qmlprofilerengine.h
View file @
fbe9925d
...
...
@@ -14,15 +14,16 @@ public:
explicit
QmlProfilerEngine
(
ProjectExplorer
::
RunConfiguration
*
runConfiguration
);
~
QmlProfilerEngine
();
void
start
();
void
stop
();
signals:
void
processRunning
();
void
processTerminated
();
void
stopRecording
();
public
slots
:
void
start
();
void
stop
();
void
spontaneousStop
();
void
viewUpdated
();
private:
...
...
src/plugins/qmlprofiler/qmlprofilertool.cpp
View file @
fbe9925d
...
...
@@ -25,12 +25,15 @@
#include <QtCore/QFile>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
using
namespace
Analyzer
;
using
namespace
Analyzer
::
Internal
;
QString
QmlProfilerTool
::
host
=
QLatin1String
(
"localhost"
);
quint16
QmlProfilerTool
::
port
=
3345
5
;
quint16
QmlProfilerTool
::
port
=
3345
6
;
// Adapter for output pane.
...
...
@@ -112,6 +115,7 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(ProjectExplorer::RunConfiguration
connect
(
engine
,
SIGNAL
(
stopRecording
()),
this
,
SLOT
(
stopRecording
()));
connect
(
d
->
m_traceWindow
,
SIGNAL
(
viewUpdated
()),
engine
,
SLOT
(
viewUpdated
()));
connect
(
d
->
m_traceWindow
,
SIGNAL
(
gotoSourceLocation
(
QString
,
int
)),
this
,
SLOT
(
gotoSourceLocation
(
QString
,
int
)));
connect
(
d
->
m_traceWindow
,
SIGNAL
(
timeChanged
(
qreal
)),
this
,
SLOT
(
updateTimer
(
qreal
)));
return
engine
;
...
...
@@ -142,7 +146,23 @@ IAnalyzerOutputPaneAdapter *QmlProfilerTool::outputPaneAdapter()
QWidget
*
QmlProfilerTool
::
createToolBarWidget
()
{
// custom toolbar (TODO)
return
0
;
QWidget
*
toolbarWidget
=
new
QWidget
;
toolbarWidget
->
setObjectName
(
QLatin1String
(
"QmlProfilerToolBarWidget"
));
QHBoxLayout
*
layout
=
new
QHBoxLayout
;
layout
->
setMargin
(
0
);
layout
->
setSpacing
(
0
);
QLabel
*
timeLabel
=
new
QLabel
(
tr
(
"elapsed: 0 s"
));
QPalette
palette
=
timeLabel
->
palette
();
palette
.
setColor
(
QPalette
::
WindowText
,
Qt
::
white
);
timeLabel
->
setPalette
(
palette
);
connect
(
this
,
SIGNAL
(
setTimeLabel
(
QString
)),
timeLabel
,
SLOT
(
setText
(
QString
)));
layout
->
addWidget
(
timeLabel
);
toolbarWidget
->
setLayout
(
layout
);
return
toolbarWidget
;
}
QWidget
*
QmlProfilerTool
::
createTimeLineWidget
()
...
...
@@ -203,3 +223,10 @@ void QmlProfilerTool::gotoSourceLocation(const QString &fileName, int lineNumber
textEditor
->
widget
()
->
setFocus
();
}
}
void
QmlProfilerTool
::
updateTimer
(
qreal
elapsedSeconds
)
{
QString
timeString
=
QString
::
number
(
elapsedSeconds
,
'f'
,
1
);
timeString
=
QString
(
" "
).
left
(
6
-
timeString
.
length
())
+
timeString
;
emit
setTimeLabel
(
tr
(
"elapsed: "
)
+
timeString
+
QLatin1String
(
" s"
));
}
src/plugins/qmlprofiler/qmlprofilertool.h
View file @
fbe9925d
...
...
@@ -33,6 +33,10 @@ public slots:
void
stopRecording
();
void
gotoSourceLocation
(
const
QString
&
fileName
,
int
lineNumber
);
void
updateTimer
(
qreal
elapsedSeconds
);
signals:
void
setTimeLabel
(
const
QString
&
);
public:
// Todo: configurable parameters
...
...
src/plugins/qmlprofiler/tracewindow.cpp
View file @
fbe9925d
...
...
@@ -288,6 +288,7 @@ void TraceWindow::reset(QDeclarativeDebugConnection *conn)
m_view
->
setSource
(
QUrl
(
"qrc:/qml/MainView.qml"
));
connect
(
m_view
->
rootObject
(),
SIGNAL
(
updateCursorPosition
()),
this
,
SLOT
(
updateCursorPosition
()));
connect
(
m_view
->
rootObject
(),
SIGNAL
(
updateTimer
()),
this
,
SLOT
(
updateTimer
()));
}
void
TraceWindow
::
updateCursorPosition
()
...
...
@@ -296,6 +297,11 @@ void TraceWindow::updateCursorPosition()
m_view
->
rootObject
()
->
property
(
"lineNumber"
).
toInt
());
}
void
TraceWindow
::
updateTimer
()
{
emit
timeChanged
(
m_view
->
rootObject
()
->
property
(
"elapsedTime"
).
toDouble
());
}
void
TraceWindow
::
setRecordAtStart
(
bool
record
)
{
m_recordAtStart
=
record
;
...
...
src/plugins/qmlprofiler/tracewindow.h
View file @
fbe9925d
...
...
@@ -60,10 +60,12 @@ public:
public
slots
:
void
updateCursorPosition
();
void
updateTimer
();
signals:
void
viewUpdated
();
void
gotoSourceLocation
(
const
QString
&
fileName
,
int
lineNumber
);
void
timeChanged
(
qreal
newTime
);
private:
TracePlugin
*
m_plugin
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment