From 7184c41453c64f177f337b173f4ca82afead731d Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 27 May 2010 19:16:08 +1000 Subject: Rename QDeclarativeDebugTiming -> QDeclarativeDebugTrace --- src/declarative/debugger/debugger.pri | 4 +- .../debugger/qdeclarativedebugtiming.cpp | 95 ------------------ .../debugger/qdeclarativedebugtiming_p.h | 96 ------------------ .../debugger/qdeclarativedebugtrace.cpp | 110 +++++++++++++++++++++ .../debugger/qdeclarativedebugtrace_p.h | 101 +++++++++++++++++++ src/declarative/qml/qdeclarativecomponent.cpp | 7 +- src/declarative/util/qdeclarativeview.cpp | 18 ++-- 7 files changed, 226 insertions(+), 205 deletions(-) delete mode 100644 src/declarative/debugger/qdeclarativedebugtiming.cpp delete mode 100644 src/declarative/debugger/qdeclarativedebugtiming_p.h create mode 100644 src/declarative/debugger/qdeclarativedebugtrace.cpp create mode 100644 src/declarative/debugger/qdeclarativedebugtrace_p.h diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri index 6777868..33d0843 100644 --- a/src/declarative/debugger/debugger.pri +++ b/src/declarative/debugger/debugger.pri @@ -6,7 +6,7 @@ SOURCES += \ $$PWD/qdeclarativedebugservice.cpp \ $$PWD/qdeclarativedebugclient.cpp \ $$PWD/qdeclarativedebug.cpp \ - $$PWD/qdeclarativedebugtiming.cpp + $$PWD/qdeclarativedebugtrace.cpp HEADERS += \ $$PWD/qdeclarativedebuggerstatus_p.h \ @@ -14,4 +14,4 @@ HEADERS += \ $$PWD/qdeclarativedebugservice_p.h \ $$PWD/qdeclarativedebugclient_p.h \ $$PWD/qdeclarativedebug_p.h \ - $$PWD/qdeclarativedebugtiming_p.h + $$PWD/qdeclarativedebugtrace_p.h diff --git a/src/declarative/debugger/qdeclarativedebugtiming.cpp b/src/declarative/debugger/qdeclarativedebugtiming.cpp deleted file mode 100644 index 5b93852..0000000 --- a/src/declarative/debugger/qdeclarativedebugtiming.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativedebugtiming_p.h" - -#include - -Q_GLOBAL_STATIC(QDeclarativeDebugTiming, timerInstance); - -QDeclarativeDebugTiming::QDeclarativeDebugTiming() -: QDeclarativeDebugService(QLatin1String("CanvasFrameRate")) -{ - m_timer.start(); -} - -void QDeclarativeDebugTiming::addEvent(EventType t) -{ - if (QDeclarativeDebugService::isDebuggingEnabled()) - timerInstance()->addEventImpl(t); -} - -void QDeclarativeDebugTiming::startRange(RangeType t) -{ - if (QDeclarativeDebugService::isDebuggingEnabled()) - timerInstance()->startRangeImpl(t); -} - -void QDeclarativeDebugTiming::endRange(RangeType t) -{ - if (QDeclarativeDebugService::isDebuggingEnabled()) - timerInstance()->endRangeImpl(t); -} - -void QDeclarativeDebugTiming::addEventImpl(EventType event) -{ - QByteArray data; - QDataStream ds(&data, QIODevice::WriteOnly); - ds << m_timer.elapsed() << (int)Event << (int)event; - sendMessage(data); -} - -void QDeclarativeDebugTiming::startRangeImpl(RangeType range) -{ - QByteArray data; - QDataStream ds(&data, QIODevice::WriteOnly); - ds << m_timer.elapsed() << (int)RangeStart << (int)range; - sendMessage(data); -} - -void QDeclarativeDebugTiming::endRangeImpl(RangeType range) -{ - QByteArray data; - QDataStream ds(&data, QIODevice::WriteOnly); - ds << m_timer.elapsed() << (int)RangeEnd << (int)range; - sendMessage(data); -} - diff --git a/src/declarative/debugger/qdeclarativedebugtiming_p.h b/src/declarative/debugger/qdeclarativedebugtiming_p.h deleted file mode 100644 index d9ed67c..0000000 --- a/src/declarative/debugger/qdeclarativedebugtiming_p.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEDEBUGTIMING_P_H -#define QDECLARATIVEDEBUGTIMING_P_H - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QDeclarativeDebugTiming : public QDeclarativeDebugService -{ -public: - enum EventType { - FramePaint, - Mouse, - Key, - - MaximumEventType - }; - - enum Message { - Event, - RangeStart, - RangeEnd, - - MaximumMessage - }; - - enum RangeType { - Painting, - Compiling, - Creating, - - MaximumRangeType - }; - - static void addEvent(EventType); - static void startRange(RangeType); - static void endRange(RangeType); - - QDeclarativeDebugTiming(); -private: - void addEventImpl(EventType); - void startRangeImpl(RangeType); - void endRangeImpl(RangeType); - QElapsedTimer m_timer; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVEDEBUGTIMING_P_H - diff --git a/src/declarative/debugger/qdeclarativedebugtrace.cpp b/src/declarative/debugger/qdeclarativedebugtrace.cpp new file mode 100644 index 0000000..5e6d5e7 --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebugtrace.cpp @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativedebugtrace_p.h" + +#include +#include + +Q_GLOBAL_STATIC(QDeclarativeDebugTrace, traceInstance); + +QDeclarativeDebugTrace::QDeclarativeDebugTrace() +: QDeclarativeDebugService(QLatin1String("CanvasFrameRate")) +{ + m_timer.start(); +} + +void QDeclarativeDebugTrace::addEvent(EventType t) +{ + if (QDeclarativeDebugService::isDebuggingEnabled()) + traceInstance()->addEventImpl(t); +} + +void QDeclarativeDebugTrace::startRange(RangeType t) +{ + if (QDeclarativeDebugService::isDebuggingEnabled()) + traceInstance()->startRangeImpl(t); +} + +void QDeclarativeDebugTrace::rangeData(RangeType t, const QUrl &url) +{ + if (QDeclarativeDebugService::isDebuggingEnabled()) + traceInstance()->rangeDataImpl(t, url); +} + +void QDeclarativeDebugTrace::endRange(RangeType t) +{ + if (QDeclarativeDebugService::isDebuggingEnabled()) + traceInstance()->endRangeImpl(t); +} + +void QDeclarativeDebugTrace::addEventImpl(EventType event) +{ + QByteArray data; + QDataStream ds(&data, QIODevice::WriteOnly); + ds << m_timer.elapsed() << (int)Event << (int)event; + sendMessage(data); +} + +void QDeclarativeDebugTrace::startRangeImpl(RangeType range) +{ + QByteArray data; + QDataStream ds(&data, QIODevice::WriteOnly); + ds << m_timer.elapsed() << (int)RangeStart << (int)range; + sendMessage(data); +} + +void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QUrl &u) +{ + QByteArray data; + QDataStream ds(&data, QIODevice::WriteOnly); + ds << m_timer.elapsed() << (int)RangeData << (int)range << (QString)u.toString(); + sendMessage(data); +} + +void QDeclarativeDebugTrace::endRangeImpl(RangeType range) +{ + QByteArray data; + QDataStream ds(&data, QIODevice::WriteOnly); + ds << m_timer.elapsed() << (int)RangeEnd << (int)range; + sendMessage(data); +} + diff --git a/src/declarative/debugger/qdeclarativedebugtrace_p.h b/src/declarative/debugger/qdeclarativedebugtrace_p.h new file mode 100644 index 0000000..5ba49a8 --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebugtrace_p.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEDEBUGTRACE_P_H +#define QDECLARATIVEDEBUGTRACE_P_H + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QUrl; +class QDeclarativeDebugTrace : public QDeclarativeDebugService +{ +public: + enum EventType { + FramePaint, + Mouse, + Key, + + MaximumEventType + }; + + enum Message { + Event, + RangeStart, + RangeData, + RangeEnd, + + MaximumMessage + }; + + enum RangeType { + Painting, + Compiling, + Creating, + + MaximumRangeType + }; + + static void addEvent(EventType); + + static void startRange(RangeType); + static void rangeData(RangeType, const QUrl &); + static void endRange(RangeType); + + QDeclarativeDebugTrace(); +private: + void addEventImpl(EventType); + void startRangeImpl(RangeType); + void rangeDataImpl(RangeType, const QUrl &); + void endRangeImpl(RangeType); + QElapsedTimer m_timer; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEDEBUGTRACE_P_H + diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 2dc2d2d..9847079 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -53,7 +53,7 @@ #include "private/qdeclarativebinding_p_p.h" #include "private/qdeclarativeglobal_p.h" #include "private/qdeclarativescriptparser_p.h" -#include "private/qdeclarativedebugtiming_p.h" +#include "private/qdeclarativedebugtrace_p.h" #include #include @@ -696,7 +696,8 @@ QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context, cons bool isRoot = !ep->inBeginCreate; if (isRoot) - QDeclarativeDebugTiming::startRange(QDeclarativeDebugTiming::Creating); + QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Creating); + QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::Creating, cc->url); QDeclarativeContextData *ctxt = new QDeclarativeContextData; ctxt->isInternal = true; @@ -867,7 +868,7 @@ void QDeclarativeComponentPrivate::completeCreate() QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); complete(ep, &state); - QDeclarativeDebugTiming::endRange(QDeclarativeDebugTiming::Creating); + QDeclarativeDebugTrace::endRange(QDeclarativeDebugTrace::Creating); } } diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index d2dab76..6059ad6 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -48,7 +48,7 @@ #include #include -#include +#include #include #include @@ -93,35 +93,35 @@ QDeclarativeScene::QDeclarativeScene() void QDeclarativeScene::keyPressEvent(QKeyEvent *e) { - QDeclarativeDebugTiming::addEvent(QDeclarativeDebugTiming::Key); + QDeclarativeDebugTrace::addEvent(QDeclarativeDebugTrace::Key); QGraphicsScene::keyPressEvent(e); } void QDeclarativeScene::keyReleaseEvent(QKeyEvent *e) { - QDeclarativeDebugTiming::addEvent(QDeclarativeDebugTiming::Key); + QDeclarativeDebugTrace::addEvent(QDeclarativeDebugTrace::Key); QGraphicsScene::keyReleaseEvent(e); } void QDeclarativeScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) { - QDeclarativeDebugTiming::addEvent(QDeclarativeDebugTiming::Mouse); + QDeclarativeDebugTrace::addEvent(QDeclarativeDebugTrace::Mouse); QGraphicsScene::mouseMoveEvent(e); } void QDeclarativeScene::mousePressEvent(QGraphicsSceneMouseEvent *e) { - QDeclarativeDebugTiming::addEvent(QDeclarativeDebugTiming::Mouse); + QDeclarativeDebugTrace::addEvent(QDeclarativeDebugTrace::Mouse); QGraphicsScene::mousePressEvent(e); } void QDeclarativeScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) { - QDeclarativeDebugTiming::addEvent(QDeclarativeDebugTiming::Mouse); + QDeclarativeDebugTrace::addEvent(QDeclarativeDebugTrace::Mouse); QGraphicsScene::mouseReleaseEvent(e); } @@ -675,8 +675,8 @@ void QDeclarativeView::paintEvent(QPaintEvent *event) { Q_D(QDeclarativeView); - QDeclarativeDebugTiming::addEvent(QDeclarativeDebugTiming::FramePaint); - QDeclarativeDebugTiming::startRange(QDeclarativeDebugTiming::Painting); + QDeclarativeDebugTrace::addEvent(QDeclarativeDebugTrace::FramePaint); + QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Painting); int time = 0; if (frameRateDebug()) @@ -684,7 +684,7 @@ void QDeclarativeView::paintEvent(QPaintEvent *event) QGraphicsView::paintEvent(event); - QDeclarativeDebugTiming::endRange(QDeclarativeDebugTiming::Painting); + QDeclarativeDebugTrace::endRange(QDeclarativeDebugTrace::Painting); if (frameRateDebug()) qDebug() << "paintEvent:" << d->frameTimer.elapsed() << "time since last frame:" << time; -- cgit v0.12