Commit a2297804 authored by Lukáš Tvrdý's avatar Lukáš Tvrdý

o Add KisPainter benchmark

o Remove redundant benchmarks from horizontal iterators

svn path=/trunk/koffice/; revision=1080662
parent 91e93a33
......@@ -15,7 +15,7 @@ set(kis_random_iterator_benchmark_SRCS kis_random_iterator_benchmark.cpp)
set(kis_projection_benchmark_SRCS kis_projection_benchmark.cpp)
set(kis_bcontrast_benchmark_SRCS kis_bcontrast_benchmark.cpp)
set(kis_blur_benchmark_SRCS kis_blur_benchmark.cpp)
set(kis_painter_benchmark_SRCS kis_painter_benchmark.cpp)
kde4_add_unit_test(KisDatamanagerBenchmark TESTNAME krita-benchmarks-KisDataManager ${kis_datamanager_benchmark_SRCS})
kde4_add_unit_test(KisHLineIteratorBenchmark TESTNAME krita-benchmarks-KisHLineIterator ${kis_hiterator_benchmark_SRCS})
......@@ -25,6 +25,7 @@ kde4_add_unit_test(KisRandomIteratorBenchmark TESTNAME krita-benchmarks-KisRando
kde4_add_unit_test(KisProjectionBenchmark TESTNAME krita-benchmarks-KisProjectionBenchmark ${kis_projection_benchmark_SRCS})
kde4_add_unit_test(KisBContrastBenchmark TESTNAME krita-benchmarks-KisBContrastBenchmark ${kis_bcontrast_benchmark_SRCS})
kde4_add_unit_test(KisBlurBenchmark TESTNAME krita-benchmarks-KisBlurBenchmark ${kis_blur_benchmark_SRCS})
kde4_add_unit_test(KisPainterBenchmark TESTNAME krita-benchmarks-KisPainterBenchmark ${kis_painter_benchmark_SRCS})
target_link_libraries(KisDatamanagerBenchmark ${KDE4_KDEUI_LIBS} kritaimage ${QT_QTTEST_LIBRARY})
target_link_libraries(KisHLineIteratorBenchmark ${KDE4_KDEUI_LIBS} kritaimage ${QT_QTTEST_LIBRARY})
......@@ -33,4 +34,5 @@ target_link_libraries(KisRectIteratorBenchmark ${KDE4_KDEUI_LIBS} kritaimage ${Q
target_link_libraries(KisRandomIteratorBenchmark ${KDE4_KDEUI_LIBS} kritaimage ${QT_QTTEST_LIBRARY})
target_link_libraries(KisProjectionBenchmark ${KDE4_KDEUI_LIBS} kritaimage kritaui ${QT_QTTEST_LIBRARY})
target_link_libraries(KisBContrastBenchmark ${KDE4_KDEUI_LIBS} kritaimage ${QT_QTTEST_LIBRARY})
target_link_libraries(KisBlurBenchmark ${KDE4_KDEUI_LIBS} kritaimage ${QT_QTTEST_LIBRARY})
\ No newline at end of file
target_link_libraries(KisBlurBenchmark ${KDE4_KDEUI_LIBS} kritaimage ${QT_QTTEST_LIBRARY})
target_link_libraries(KisPainterBenchmark ${KDE4_KDEUI_LIBS} kritaimage ${QT_QTTEST_LIBRARY})
\ No newline at end of file
......@@ -122,21 +122,8 @@ void KisHLineIteratorBenchmark::benchmarkReadWriteBytes(){
}
void KisHLineIteratorBenchmark::benchmarkWriteBytesNoMemCpy()
{
KisHLineIteratorPixel it = m_device->createHLineIterator(0, 0, TEST_IMAGE_WIDTH);
QBENCHMARK{
for (int j = 0; j < TEST_IMAGE_HEIGHT; j++) {
while (!it.isDone()) {
++it;
}
it.nextRow();
}
}
}
void KisHLineIteratorBenchmark::benchmarkReadBytesNoMemCpy()
void KisHLineIteratorBenchmark::benchmarkNoMemCpy()
{
KisHLineIteratorPixel it = m_device->createHLineIterator(0, 0, TEST_IMAGE_WIDTH);
......
......@@ -50,11 +50,8 @@ private slots:
// copy from one device to another
void benchmarkReadWriteBytes();
// memcpy from KoColor to device
void benchmarkWriteBytesNoMemCpy();
// memcpy from device to KoColor
void benchmarkReadBytesNoMemCpy();
// const hline iterator used
void benchmarkNoMemCpy();
void benchmarkConstReadBytesNoMemCpy();
// copy from one device to another
void benchmarkReadWriteBytesNoMemCpy();
......
/*
* Copyright (c) 2010 Lukáš Tvrdý lukast.dev@gmail.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <qtest_kde.h>
#include "kis_painter_benchmark.h"
#include "kis_benchmark_values.h"
#include "kis_paint_device.h"
#include "kis_iterators_pixel.h"
#include <KoColorSpace.h>
#include <KoColorSpaceRegistry.h>
#include <KoColor.h>
#include <kis_image.h>
#include <kis_painter.h>
#define GMP_IMAGE_WIDTH 1600
#define GMP_IMAGE_HEIGHT 1000
void KisPainterBenchmark::initTestCase()
{
m_colorSpace = KoColorSpaceRegistry::instance()->rgb8();
m_color = new KoColor(m_colorSpace);
m_color->fromQColor(Qt::red);
}
void KisPainterBenchmark::cleanupTestCase()
{
delete m_color;
}
void KisPainterBenchmark::benchmarkBitBlt()
{
KisPaintDeviceSP src = new KisPaintDevice(m_colorSpace);
KisPaintDeviceSP dst = new KisPaintDevice(m_colorSpace);
src->fill(0,0,GMP_IMAGE_WIDTH, GMP_IMAGE_HEIGHT, m_color->data());
dst->fill(0,0,GMP_IMAGE_WIDTH, GMP_IMAGE_HEIGHT, m_color->data());
KisPainter * painter = new KisPainter(dst);
QPoint pos(0,0);
QRect rc(0,0,GMP_IMAGE_WIDTH, GMP_IMAGE_HEIGHT);
painter->bitBlt(pos,src, rc);
QBENCHMARK_ONCE{
// painter->bitBlt(pos,src,rc);
}
}
QTEST_KDEMAIN(KisPainterBenchmark, NoGUI)
#include "kis_painter_benchmark.moc"
/*
* Copyright (c) 2010 Lukáš Tvrdý lukast.dev@gmail.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINTER_BENCHMARK_H
#define KIS_PAINTER_BENCHMARK_H
#include <QtTest/QtTest>
#include <kis_types.h>
class KisPaintDevice;
class KoColorSpace;
class KoColor;
class KisPainterBenchmark : public QObject
{
Q_OBJECT
private:
const KoColorSpace * m_colorSpace;
KoColor * m_color;
private slots:
void initTestCase();
void cleanupTestCase();
void benchmarkBitBlt();
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment