QmlProfiler: sending start profiling message
authorChristiaan Janssen <christiaan.janssen@nokia.com>
Mon, 13 Feb 2012 13:06:47 +0000 (14:06 +0100)
committerQt by Nokia <qt-info@nokia.com>
Wed, 15 Feb 2012 15:43:11 +0000 (16:43 +0100)
Will be used by the client to show status in the GUI.
When profiling is stopped, data is sent immediately,
therefore no "stop profiling" message.

Change-Id: Idd12069a9707296b87e305e8b3cbf8e324989a3f
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
src/declarative/debugger/qdeclarativeprofilerservice.cpp
src/declarative/debugger/qdeclarativeprofilerservice_p.h

index c5b6b65..17ee3e5 100644 (file)
@@ -124,6 +124,11 @@ bool QDeclarativeProfilerService::stopProfiling()
     return profilerInstance()->stopProfilingImpl();
 }
 
+void QDeclarativeProfilerService::sendStartedProfilingMessage()
+{
+    profilerInstance()->sendStartedProfilingMessageImpl();
+}
+
 void QDeclarativeProfilerService::addEvent(EventType t)
 {
     profilerInstance()->addEventImpl(t);
@@ -174,7 +179,7 @@ bool QDeclarativeProfilerService::startProfilingImpl()
     bool success = false;
     if (!profilingEnabled()) {
         setProfilingEnabled(true);
-        addEventImpl(StartTrace);
+        sendStartedProfilingMessageImpl();
         success = true;
     }
     return success;
@@ -191,6 +196,15 @@ bool QDeclarativeProfilerService::stopProfilingImpl()
     return success;
 }
 
+void QDeclarativeProfilerService::sendStartedProfilingMessageImpl()
+{
+    if (!QDeclarativeDebugService::isDebuggingEnabled() || !m_enabled)
+        return;
+
+    QDeclarativeProfilerData ed = {m_timer.nsecsElapsed(), (int)Event, (int)StartTrace, QString(), -1, -1, 0, 0};
+    QDeclarativeDebugService::sendMessage(ed.toByteArray());
+}
+
 void QDeclarativeProfilerService::addEventImpl(EventType event)
 {
     if (!QDeclarativeDebugService::isDebuggingEnabled() || !m_enabled)
index f5ca8ec..d29690b 100644 (file)
@@ -130,6 +130,7 @@ public:
 
     static bool startProfiling();
     static bool stopProfiling();
+    static void sendStartedProfilingMessage();
     static void addEvent(EventType);
     static void startRange(RangeType);
     static void rangeData(RangeType, const QString &);
@@ -151,6 +152,7 @@ protected:
 private:
     bool startProfilingImpl();
     bool stopProfilingImpl();
+    void sendStartedProfilingMessageImpl();
     void addEventImpl(EventType);
     void startRangeImpl(RangeType);
     void rangeDataImpl(RangeType, const QString &);