diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-01-23 17:18:05 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-13 08:18:42 +0100 |
commit | eeaba26596d447c531dfac9d6e6bf5cfe4537813 (patch) | |
tree | 90cb8aa8a60c26ff7bf6ad85242069185453931e /src/qml/qml | |
parent | 68dabbf62b867e092a2860e5cde1813768176a3e (diff) |
Infrastructure for supporting multiple profilers in qqmlprofilerservice
The concepts of "global" and "engine" profilers are introduced. Profilers
can either be attached to specific QML engines and run in their threads
or they can be unspecific global profilers running in arbitrary threads.
Change-Id: I3862fc65c07ccb33a1ca08cd2425e4079d3ffc02
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index 26ef86836c..fbc41201fb 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -1422,10 +1422,6 @@ QV4::ReturnedValue ConsoleObject::method_log(CallContext *ctx) QV4::ReturnedValue ConsoleObject::method_profile(CallContext *ctx) { - //DeclarativeDebugTrace cannot handle nested profiling - //although v8 can handle several profiling at once, - //we do not allow that. Hence, we pass an empty(default) title - QString title; QV4::ExecutionEngine *v4 = ctx->engine; QV4::StackFrame frame = v4->currentStackFrame(); @@ -1434,12 +1430,9 @@ QV4::ReturnedValue ConsoleObject::method_profile(CallContext *ctx) QMessageLogger logger(baSource.constData(), frame.line, baFunction.constData()); if (!QQmlDebugService::isDebuggingEnabled()) { logger.warning("Cannot start profiling because debug service is disabled. Start with -qmljsdebugger=port:XXXXX."); - } else if (QQmlProfilerService::startProfiling()) { - QV4ProfilerService::instance()->startProfiling(title); - - logger.debug("Profiling started."); } else { - logger.warning("Profiling is already in progress. First, end current profiling session."); + QQmlProfilerService::instance()->startProfiling(v4->v8Engine->engine()); + logger.debug("Profiling started."); } return QV4::Encode::undefined(); @@ -1447,11 +1440,6 @@ QV4::ReturnedValue ConsoleObject::method_profile(CallContext *ctx) QV4::ReturnedValue ConsoleObject::method_profileEnd(CallContext *ctx) { - //DeclarativeDebugTrace cannot handle nested profiling - //although v8 can handle several profiling at once, - //we do not allow that. Hence, we pass an empty(default) title - QString title; - QV4::ExecutionEngine *v4 = ctx->engine; QV4::StackFrame frame = v4->currentStackFrame(); @@ -1459,15 +1447,11 @@ QV4::ReturnedValue ConsoleObject::method_profileEnd(CallContext *ctx) const QByteArray baFunction = frame.function.toUtf8(); QMessageLogger logger(baSource.constData(), frame.line, baFunction.constData()); - if (QQmlProfilerService::stopProfiling()) { - QV4ProfilerService *profiler = QV4ProfilerService::instance(); - profiler->stopProfiling(title); - QQmlProfilerService::sendProfilingData(); - profiler->sendProfilingData(); - - logger.debug("Profiling ended."); + if (!QQmlDebugService::isDebuggingEnabled()) { + logger.warning("Ignoring console.profileEnd(): the debug service is disabled."); } else { - logger.warning("Profiling was not started."); + QQmlProfilerService::instance()->stopProfiling(v4->v8Engine->engine()); + logger.debug("Profiling ended."); } return QV4::Encode::undefined(); |