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
b6fb8bba
Commit
b6fb8bba
authored
May 12, 2010
by
Friedemann Kleint
Browse files
Pluginmanager: Make startup profiling API accessible.A
Add verbosity option showing timestamps for PluginManager::addObject.
parent
259007f5
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/libs/extensionsystem/pluginmanager.cpp
View file @
b6fb8bba
...
...
@@ -574,6 +574,17 @@ QString PluginManager::testDataDirectory() const
return
s
;
}
/*!
\fn void PluginManager::profilingReport(const char *what, const PluginSpec *spec = 0)
Create a profiling entry showing the elapsed time if profiling is activated.
*/
void
PluginManager
::
profilingReport
(
const
char
*
what
,
const
PluginSpec
*
spec
)
{
d
->
profilingReport
(
what
,
spec
);
}
//============PluginManagerPrivate===========
/*!
...
...
@@ -601,6 +612,7 @@ PluginSpecPrivate *PluginManagerPrivate::privateSpec(PluginSpec *spec)
PluginManagerPrivate
::
PluginManagerPrivate
(
PluginManager
*
pluginManager
)
:
extension
(
QLatin1String
(
"xml"
)),
m_profileElapsedMS
(
0
),
m_profilingVerbosity
(
0
),
q
(
pluginManager
)
{
}
...
...
@@ -679,6 +691,13 @@ void PluginManagerPrivate::addObject(QObject *obj)
if
(
debugLeaks
)
qDebug
()
<<
"PluginManagerPrivate::addObject"
<<
obj
<<
obj
->
objectName
();
if
(
m_profilingVerbosity
&&
!
m_profileTimer
.
isNull
())
{
// Report a timestamp when adding an object. Useful for profiling
// its initialization time.
const
int
absoluteElapsedMS
=
m_profileTimer
->
elapsed
();
qDebug
(
" %-43s %8dms"
,
obj
->
metaObject
()
->
className
(),
absoluteElapsedMS
);
}
allObjects
.
append
(
obj
);
}
emit
q
->
objectAdded
(
obj
);
...
...
@@ -964,6 +983,8 @@ void PluginManagerPrivate::initProfiling()
m_profileTimer
->
start
();
m_profileElapsedMS
=
0
;
qDebug
(
"Profiling started"
);
}
else
{
m_profilingVerbosity
++
;
}
}
...
...
@@ -976,7 +997,7 @@ void PluginManagerPrivate::profilingReport(const char *what, const PluginSpec *s
if
(
spec
)
{
qDebug
(
"%-22s %-22s %8dms (%8dms)"
,
what
,
qPrintable
(
spec
->
name
()),
absoluteElapsedMS
,
elapsedMS
);
}
else
{
qDebug
(
"%-
22
s %8dms (%8dms)"
,
what
,
absoluteElapsedMS
,
elapsedMS
);
qDebug
(
"%-
45
s %8dms (%8dms)"
,
what
,
absoluteElapsedMS
,
elapsedMS
);
}
}
}
src/libs/extensionsystem/pluginmanager.h
View file @
b6fb8bba
...
...
@@ -118,6 +118,8 @@ public:
bool
runningTests
()
const
;
QString
testDataDirectory
()
const
;
void
profilingReport
(
const
char
*
what
,
const
PluginSpec
*
spec
=
0
);
signals:
void
objectAdded
(
QObject
*
obj
);
void
aboutToRemoveObject
(
QObject
*
obj
);
...
...
src/libs/extensionsystem/pluginmanager_p.h
View file @
b6fb8bba
...
...
@@ -85,6 +85,7 @@ public:
QStringList
arguments
;
QScopedPointer
<
QTime
>
m_profileTimer
;
int
m_profileElapsedMS
;
unsigned
m_profilingVerbosity
;
// Look in argument descriptions of the specs for the option.
PluginSpec
*
pluginForOption
(
const
QString
&
option
,
bool
*
requiresArgument
)
const
;
...
...
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