diff options
Diffstat (limited to 'benchmarks/pt_mtheme')
-rw-r--r-- | benchmarks/pt_mtheme/pt_mtheme.cpp | 14 | ||||
-rw-r--r-- | benchmarks/pt_mtheme/pt_mtheme.h | 14 | ||||
-rw-r--r-- | benchmarks/pt_mtheme/pt_mtheme.pro | 1 |
3 files changed, 24 insertions, 5 deletions
diff --git a/benchmarks/pt_mtheme/pt_mtheme.cpp b/benchmarks/pt_mtheme/pt_mtheme.cpp index 596e6273..a6d6b965 100644 --- a/benchmarks/pt_mtheme/pt_mtheme.cpp +++ b/benchmarks/pt_mtheme/pt_mtheme.cpp @@ -20,14 +20,22 @@ #include "pt_mtheme.h" #include <mbenchmark.h> -#include <MComponentData> #include <MTheme> #include <QtTest/QtTest> -void Pt_MTheme::constructor() +void Pt_MTheme::uncachedConstructor() { - MTheme *theme = NULL; + MTheme *theme = 0; + MBENCHMARK_ONCE ( + theme = new MTheme("widgetsgallery"); + ) + delete theme; +} + +void Pt_MTheme::cachedConstructor() +{ + MTheme *theme = 0; MBENCHMARK_ONCE ( theme = new MTheme("widgetsgallery"); ) diff --git a/benchmarks/pt_mtheme/pt_mtheme.h b/benchmarks/pt_mtheme/pt_mtheme.h index cb7783f5..7049ba6c 100644 --- a/benchmarks/pt_mtheme/pt_mtheme.h +++ b/benchmarks/pt_mtheme/pt_mtheme.h @@ -26,14 +26,24 @@ class MComponentData; class MWidgetView; /** - * This test benchmarks the MTheme creation. + * This test benchmarks the MTheme creation. Most of the time when creating + * a MTheme instance is spend with loading stylesheets. Check pt_mstylesheet + * for getting more details. */ class Pt_MTheme : public QObject { Q_OBJECT private slots: - void constructor(); + /** + * Test the performance of the MTheme constructor. + */ + void uncachedConstructor(); + + /** + * Execute the constructor a second time to evaluate caching possibilities. + */ + void cachedConstructor(); }; #endif diff --git a/benchmarks/pt_mtheme/pt_mtheme.pro b/benchmarks/pt_mtheme/pt_mtheme.pro index ba8d9cd3..c57470cf 100644 --- a/benchmarks/pt_mtheme/pt_mtheme.pro +++ b/benchmarks/pt_mtheme/pt_mtheme.pro @@ -4,4 +4,5 @@ DEPENDPATH += $$INCLUDEPATH TARGET = pt_mtheme SOURCES += pt_mtheme.cpp + HEADERS += pt_mtheme.h |