From c9525d561fa05f0914546315fc33d8942b80742a Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 2 Jul 2009 12:58:07 +1000 Subject: Make performance logging classes private. --- src/declarative/extra/qfxparticles.cpp | 2 +- src/declarative/fx/qfxcomponentinstance.cpp | 2 +- src/declarative/fx/qfximage.cpp | 2 +- src/declarative/fx/qfxitem.cpp | 2 +- src/declarative/fx/qfxlayouts.cpp | 2 +- src/declarative/fx/qfxpath.cpp | 2 +- src/declarative/fx/qfxpixmap.cpp | 2 +- src/declarative/fx/qfxtext.cpp | 2 +- src/declarative/fx/qfxtextedit.cpp | 2 +- src/declarative/qml/qmlbasicscript.cpp | 2 +- src/declarative/qml/qmlbindablevalue.cpp | 2 +- src/declarative/qml/qmlcompiler.cpp | 2 +- src/declarative/qml/qmlcomponent.cpp | 2 +- src/declarative/qml/qmlengine.cpp | 2 +- src/declarative/qml/qmlmetaproperty.cpp | 2 +- src/declarative/qml/qmlparser.cpp | 2 +- src/declarative/qml/qmlscriptparser.cpp | 2 +- src/declarative/qml/qmlvme.cpp | 3 +- src/declarative/util/qfxperf.cpp | 2 +- src/declarative/util/qfxperf.h | 80 ---------------- src/declarative/util/qfxperf_p.h | 91 ++++++++++++++++++ src/declarative/util/qfxview.cpp | 4 +- src/declarative/util/qmlscript.cpp | 2 +- src/declarative/util/qperformancelog.cpp | 2 +- src/declarative/util/qperformancelog.h | 141 ---------------------------- src/declarative/util/qperformancelog_p.h | 141 ++++++++++++++++++++++++++++ src/declarative/util/util.pri | 4 +- tools/qmlviewer/qmlviewer.cpp | 2 +- 28 files changed, 258 insertions(+), 248 deletions(-) delete mode 100644 src/declarative/util/qfxperf.h create mode 100644 src/declarative/util/qfxperf_p.h delete mode 100644 src/declarative/util/qperformancelog.h create mode 100644 src/declarative/util/qperformancelog_p.h diff --git a/src/declarative/extra/qfxparticles.cpp b/src/declarative/extra/qfxparticles.cpp index 62fe4c1..3130f06 100644 --- a/src/declarative/extra/qfxparticles.cpp +++ b/src/declarative/extra/qfxparticles.cpp @@ -54,7 +54,7 @@ #define INT_MAX 2147483647 #endif #include -#include +#include #include #include "qfxparticles.h" diff --git a/src/declarative/fx/qfxcomponentinstance.cpp b/src/declarative/fx/qfxcomponentinstance.cpp index d3f7061..7f592a9 100644 --- a/src/declarative/fx/qfxcomponentinstance.cpp +++ b/src/declarative/fx/qfxcomponentinstance.cpp @@ -41,7 +41,7 @@ #include "qfxcomponentinstance.h" #include "qfxcomponentinstance_p.h" -#include +#include #include #include diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index 58d597a..539ad02 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -41,7 +41,7 @@ #include "qfximage.h" #include "qfximage_p.h" -#include +#include #if defined(QFX_RENDER_OPENGL) #include #endif diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 7ccad5f..223af60 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include "qmlengine.h" #include "qmlstate.h" diff --git a/src/declarative/fx/qfxlayouts.cpp b/src/declarative/fx/qfxlayouts.cpp index e27135c..4ca3353 100644 --- a/src/declarative/fx/qfxlayouts.cpp +++ b/src/declarative/fx/qfxlayouts.cpp @@ -45,7 +45,7 @@ #include "qmlstate.h" #include "qmlstategroup.h" #include "qmlstateoperations.h" -#include "qfxperf.h" +#include "private/qfxperf_p.h" #include "qfxlayouts.h" #include "qfxlayouts_p.h" diff --git a/src/declarative/fx/qfxpath.cpp b/src/declarative/fx/qfxpath.cpp index be731b1..4c241d3 100644 --- a/src/declarative/fx/qfxpath.cpp +++ b/src/declarative/fx/qfxpath.cpp @@ -41,7 +41,7 @@ #include "qfxpath.h" #include "qfxpath_p.h" -#include +#include #include diff --git a/src/declarative/fx/qfxpixmap.cpp b/src/declarative/fx/qfxpixmap.cpp index 0ea94f5..5ee6528 100644 --- a/src/declarative/fx/qfxpixmap.cpp +++ b/src/declarative/fx/qfxpixmap.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index 9550af9..c9875d9 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -48,7 +48,7 @@ #include "glbasicshaders.h" #endif -#include +#include #include #include #include diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index 03dd63f..7f08fba 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -48,7 +48,7 @@ #include "glbasicshaders.h" #endif -#include +#include #include "qfxevents_p.h" #include #include diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp index 80ca5a9..8f25ea4 100644 --- a/src/declarative/qml/qmlbasicscript.cpp +++ b/src/declarative/qml/qmlbasicscript.cpp @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/declarative/qml/qmlbindablevalue.cpp b/src/declarative/qml/qmlbindablevalue.cpp index f447d4f..8e74250 100644 --- a/src/declarative/qml/qmlbindablevalue.cpp +++ b/src/declarative/qml/qmlbindablevalue.cpp @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include Q_DECLARE_METATYPE(QList); diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index c2b2fb4..3353838 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "private/qmlcompiler_p.h" -#include +#include #include "qmlparser_p.h" #include "private/qmlscriptparser_p.h" #include diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index 1144639..0fd65d3 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -46,7 +46,7 @@ #include "qmlvme_p.h" #include "qml.h" #include -#include +#include #include #include #include diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 294e333..d6bc537 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -57,7 +57,7 @@ #include #include #include "qml.h" -#include +#include #include #include "private/qmlbasicscript_p.h" #include "private/qmlcompiledcomponent_p.h" diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 448671e..292aacd 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -42,7 +42,7 @@ #include "qmlmetaproperty.h" #include "qmlmetaproperty_p.h" #include -#include +#include #include #include #include diff --git a/src/declarative/qml/qmlparser.cpp b/src/declarative/qml/qmlparser.cpp index 6f0b0b7..e9dedf8 100644 --- a/src/declarative/qml/qmlparser.cpp +++ b/src/declarative/qml/qmlparser.cpp @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include "private/qmlcomponent_p.h" #include diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index b957499..1f31e54 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -55,7 +55,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index 962d917..d24c03e 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -40,14 +40,13 @@ ****************************************************************************/ #include "qmlvme_p.h" -#include +#include #include #include #include "private/qmetaobjectbuilder_p.h" #include "private/qmldeclarativedata_p.h" #include #include -#include #include #include #include diff --git a/src/declarative/util/qfxperf.cpp b/src/declarative/util/qfxperf.cpp index 9ac9e8d..db56b37 100644 --- a/src/declarative/util/qfxperf.cpp +++ b/src/declarative/util/qfxperf.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qfxperf.h" +#include "private/qfxperf_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qfxperf.h b/src/declarative/util/qfxperf.h deleted file mode 100644 index 0bc0cc9..0000000 --- a/src/declarative/util/qfxperf.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** 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.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QFXPERF_H -#define QFXPERF_H - -#include "qperformancelog.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -Q_DECLARE_PERFORMANCE_LOG(QFxPerf) { - Q_DECLARE_PERFORMANCE_METRIC(QmlParsing) - - Q_DECLARE_PERFORMANCE_METRIC(Compilation) - Q_DECLARE_PERFORMANCE_METRIC(VMEExecution) - - Q_DECLARE_PERFORMANCE_METRIC(BindInit) - Q_DECLARE_PERFORMANCE_METRIC(BindValue) - Q_DECLARE_PERFORMANCE_METRIC(BindValueSSE) - Q_DECLARE_PERFORMANCE_METRIC(BindValueQt) - Q_DECLARE_PERFORMANCE_METRIC(BindableValueUpdate) - Q_DECLARE_PERFORMANCE_METRIC(PixmapLoad) - Q_DECLARE_PERFORMANCE_METRIC(FontDatabase) - Q_DECLARE_PERFORMANCE_METRIC(QFxPathViewPathCache) - Q_DECLARE_PERFORMANCE_METRIC(CreateParticle) - Q_DECLARE_PERFORMANCE_METRIC(ItemComponentComplete) - Q_DECLARE_PERFORMANCE_METRIC(ImageComponentComplete) - Q_DECLARE_PERFORMANCE_METRIC(ComponentInstanceComponentComplete) - Q_DECLARE_PERFORMANCE_METRIC(BaseLayoutComponentComplete) - Q_DECLARE_PERFORMANCE_METRIC(TextComponentComplete) - Q_DECLARE_PERFORMANCE_METRIC(QFxText_setText) - Q_DECLARE_PERFORMANCE_METRIC(AddScript) -} - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QFXPERF_H diff --git a/src/declarative/util/qfxperf_p.h b/src/declarative/util/qfxperf_p.h new file mode 100644 index 0000000..a1e38b7 --- /dev/null +++ b/src/declarative/util/qfxperf_p.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QFXPERF_H +#define QFXPERF_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "private/qperformancelog_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +Q_DECLARE_PERFORMANCE_LOG(QFxPerf) { + Q_DECLARE_PERFORMANCE_METRIC(QmlParsing) + + Q_DECLARE_PERFORMANCE_METRIC(Compilation) + Q_DECLARE_PERFORMANCE_METRIC(VMEExecution) + + Q_DECLARE_PERFORMANCE_METRIC(BindInit) + Q_DECLARE_PERFORMANCE_METRIC(BindValue) + Q_DECLARE_PERFORMANCE_METRIC(BindValueSSE) + Q_DECLARE_PERFORMANCE_METRIC(BindValueQt) + Q_DECLARE_PERFORMANCE_METRIC(BindableValueUpdate) + Q_DECLARE_PERFORMANCE_METRIC(PixmapLoad) + Q_DECLARE_PERFORMANCE_METRIC(FontDatabase) + Q_DECLARE_PERFORMANCE_METRIC(QFxPathViewPathCache) + Q_DECLARE_PERFORMANCE_METRIC(CreateParticle) + Q_DECLARE_PERFORMANCE_METRIC(ItemComponentComplete) + Q_DECLARE_PERFORMANCE_METRIC(ImageComponentComplete) + Q_DECLARE_PERFORMANCE_METRIC(ComponentInstanceComponentComplete) + Q_DECLARE_PERFORMANCE_METRIC(BaseLayoutComponentComplete) + Q_DECLARE_PERFORMANCE_METRIC(TextComponentComplete) + Q_DECLARE_PERFORMANCE_METRIC(QFxText_setText) + Q_DECLARE_PERFORMANCE_METRIC(AddScript) +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QFXPERF_H diff --git a/src/declarative/util/qfxview.cpp b/src/declarative/util/qfxview.cpp index 0855224..0a3afda 100644 --- a/src/declarative/util/qfxview.cpp +++ b/src/declarative/util/qfxview.cpp @@ -54,8 +54,8 @@ #include "qmlbindablevalue.h" #include "qml.h" #include "qfxitem.h" -#include "qperformancelog.h" -#include "qfxperf.h" +#include "private/qperformancelog_p.h" +#include "private/qfxperf_p.h" #include "qfxview.h" #include diff --git a/src/declarative/util/qmlscript.cpp b/src/declarative/util/qmlscript.cpp index ab095b1..07cc1d5 100644 --- a/src/declarative/util/qmlscript.cpp +++ b/src/declarative/util/qmlscript.cpp @@ -55,7 +55,7 @@ #include #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qperformancelog.cpp b/src/declarative/util/qperformancelog.cpp index 932e4b3..8e11997 100644 --- a/src/declarative/util/qperformancelog.cpp +++ b/src/declarative/util/qperformancelog.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qperformancelog.h" +#include "qperformancelog_p.h" #include #include diff --git a/src/declarative/util/qperformancelog.h b/src/declarative/util/qperformancelog.h deleted file mode 100644 index 6655a8d..0000000 --- a/src/declarative/util/qperformancelog.h +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** 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.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPERFORMANCELOG_H -#define QPERFORMANCELOG_H - -#include - -QT_BEGIN_NAMESPACE - -namespace QPerformanceLog -{ - Q_DECLARATIVE_EXPORT void displayData(); - Q_DECLARATIVE_EXPORT void clear(); - -#ifdef Q_ENABLE_PERFORMANCE_LOG - struct LogData { - LogData(const char *); - QTime timer; - int sumTime; - unsigned int *data; - }; - - struct LogMetric { - LogMetric(LogData *, int, const char *); - }; - - // Internal - void displayData(LogData *); - void clear(LogData *); -#endif -} - -#ifdef Q_ENABLE_PERFORMANCE_LOG - -#define Q_DECLARE_PERFORMANCE_METRIC(name) \ - enum { name = ValueChoice<0, ValueTracker<0, __LINE__>::value, __LINE__>::value }; \ - template \ - struct ValueTracker \ - { \ - enum { value = name }; \ - }; \ - extern QPerformanceLog::LogMetric metric ## name; - -#define Q_DECLARE_PERFORMANCE_LOG(name) \ - namespace name { \ - extern QPerformanceLog::LogData log; \ - inline void displayData() { QPerformanceLog::displayData(&log); } \ - inline void clear() { QPerformanceLog::clear(&log); } \ - } \ - template \ - class name ## Timer { \ - public: \ - name ## Timer() { \ - lastSum = name::log.sumTime + name::log.timer.restart(); \ - name::log.sumTime = 0; \ - } \ - ~ name ## Timer() { \ - name::log.data[2 * N] += name::log.sumTime + name::log.timer.restart(); \ - ++name::log.data[2 * N + 1]; \ - name::log.sumTime = lastSum; \ - } \ - private: \ - int lastSum; \ - }; \ - namespace name { \ - template \ - struct ValueTracker \ - { \ - enum { value = -1 }; \ - }; \ - template \ - struct ValueChoice \ - { \ - enum { value = ValueChoice::value, L>::value }; \ - }; \ - template \ - struct ValueChoice \ - { \ - enum { value = DefNextValue }; \ - }; \ - } \ - namespace name - -#define Q_DEFINE_PERFORMANCE_LOG(name, desc) \ - QPerformanceLog::LogData name::log(desc); \ - namespace name - -#define Q_DEFINE_PERFORMANCE_METRIC(name, desc) \ - QPerformanceLog::LogMetric metrix ## name(&log, name, desc); - -#else // Q_ENABLE_PERFORMANCE_LOG - -#define Q_DECLARE_PERFORMANCE_METRIC(name) -#define Q_DECLARE_PERFORMANCE_LOG(name) namespace name -#define Q_DEFINE_PERFORMANCE_LOG(name, desc) namespace name -#define Q_DEFINE_PERFORMANCE_METRIC(name, desc) - -#endif // Q_ENABLE_PERFORMANCE_LOG - -QT_END_NAMESPACE - -#endif // QPERFORMANCELOG_H diff --git a/src/declarative/util/qperformancelog_p.h b/src/declarative/util/qperformancelog_p.h new file mode 100644 index 0000000..6655a8d --- /dev/null +++ b/src/declarative/util/qperformancelog_p.h @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPERFORMANCELOG_H +#define QPERFORMANCELOG_H + +#include + +QT_BEGIN_NAMESPACE + +namespace QPerformanceLog +{ + Q_DECLARATIVE_EXPORT void displayData(); + Q_DECLARATIVE_EXPORT void clear(); + +#ifdef Q_ENABLE_PERFORMANCE_LOG + struct LogData { + LogData(const char *); + QTime timer; + int sumTime; + unsigned int *data; + }; + + struct LogMetric { + LogMetric(LogData *, int, const char *); + }; + + // Internal + void displayData(LogData *); + void clear(LogData *); +#endif +} + +#ifdef Q_ENABLE_PERFORMANCE_LOG + +#define Q_DECLARE_PERFORMANCE_METRIC(name) \ + enum { name = ValueChoice<0, ValueTracker<0, __LINE__>::value, __LINE__>::value }; \ + template \ + struct ValueTracker \ + { \ + enum { value = name }; \ + }; \ + extern QPerformanceLog::LogMetric metric ## name; + +#define Q_DECLARE_PERFORMANCE_LOG(name) \ + namespace name { \ + extern QPerformanceLog::LogData log; \ + inline void displayData() { QPerformanceLog::displayData(&log); } \ + inline void clear() { QPerformanceLog::clear(&log); } \ + } \ + template \ + class name ## Timer { \ + public: \ + name ## Timer() { \ + lastSum = name::log.sumTime + name::log.timer.restart(); \ + name::log.sumTime = 0; \ + } \ + ~ name ## Timer() { \ + name::log.data[2 * N] += name::log.sumTime + name::log.timer.restart(); \ + ++name::log.data[2 * N + 1]; \ + name::log.sumTime = lastSum; \ + } \ + private: \ + int lastSum; \ + }; \ + namespace name { \ + template \ + struct ValueTracker \ + { \ + enum { value = -1 }; \ + }; \ + template \ + struct ValueChoice \ + { \ + enum { value = ValueChoice::value, L>::value }; \ + }; \ + template \ + struct ValueChoice \ + { \ + enum { value = DefNextValue }; \ + }; \ + } \ + namespace name + +#define Q_DEFINE_PERFORMANCE_LOG(name, desc) \ + QPerformanceLog::LogData name::log(desc); \ + namespace name + +#define Q_DEFINE_PERFORMANCE_METRIC(name, desc) \ + QPerformanceLog::LogMetric metrix ## name(&log, name, desc); + +#else // Q_ENABLE_PERFORMANCE_LOG + +#define Q_DECLARE_PERFORMANCE_METRIC(name) +#define Q_DECLARE_PERFORMANCE_LOG(name) namespace name +#define Q_DEFINE_PERFORMANCE_LOG(name, desc) namespace name +#define Q_DEFINE_PERFORMANCE_METRIC(name, desc) + +#endif // Q_ENABLE_PERFORMANCE_LOG + +QT_END_NAMESPACE + +#endif // QPERFORMANCELOG_H diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri index 543e2d2..157c2d9 100644 --- a/src/declarative/util/util.pri +++ b/src/declarative/util/util.pri @@ -21,9 +21,9 @@ SOURCES += \ HEADERS += \ util/qfxview.h \ - util/qfxperf.h \ + util/qfxperf_p.h \ util/qfxglobal.h \ - util/qperformancelog.h \ + util/qperformancelog_p.h \ util/qmlconnection.h \ util/qmlpackage.h \ util/qmlscript.h \ diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index cb7d00c..db0dc18 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -18,7 +18,7 @@ #include #include #include "qml.h" -#include "qperformancelog.h" +#include #include "qfxtestengine.h" #include "deviceskin.h" -- cgit v0.12