The ClippedLineTest now runs for 5 seconds max (should change the other tests

accordingly and refactor a bit). It also prints the number of clipping rects.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26685 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2008-07-30 11:40:18 +00:00
parent 0b46f622d1
commit 87b8310c0f
4 changed files with 18 additions and 12 deletions

View File

@ -22,7 +22,7 @@ ClippedLineTest::ClippedLineTest()
fLinesPerIteration(20),
fIterations(0),
fMaxIterations(100),
fMaxTestDuration(5000000),
fViewBounds(0, 0, -1, -1)
{
@ -74,7 +74,7 @@ ClippedLineTest::RunIteration(BView* view)
fTestDuration += system_time() - now;
fIterations++;
return fIterations < fMaxIterations;
return system_time() - fTestStart < fMaxTestDuration;
}
@ -87,6 +87,8 @@ ClippedLineTest::PrintResults()
}
bigtime_t timeLeak = system_time() - fTestStart - fTestDuration;
printf("Lines per iteration: %lu\n", fLinesPerIteration);
printf("Clipping rects: %ld\n", fClippingRegion.CountRects());
printf("Total lines rendered: %llu\n", fLinesRendered);
printf("Lines per second: %.3f\n",
fLinesRendered * 1000000.0 / fTestDuration);
printf("Average time between iterations: %.4f seconds.\n",

View File

@ -25,7 +25,7 @@ private:
uint32 fLinesPerIteration;
uint32 fIterations;
uint32 fMaxIterations;
bigtime_t fMaxTestDuration;
BRect fViewBounds;
};

View File

@ -5,7 +5,6 @@
#include "Test.h"
#include <Region.h>
#include <View.h>
@ -23,16 +22,16 @@ void
Test::SetupClipping(BView* view)
{
BRect bounds = view->Bounds();
BRegion clipping(bounds);
BRect grid(bounds.InsetByCopy(10, 10));
for (float y = grid.top; y < grid.bottom - 5; y += grid.Height() / 20) {
for (float x = grid.left; x < grid.right - 5;
x += grid.Width() / 20) {
fClippingRegion.Set(bounds);
BRect grid(bounds.InsetByCopy(40, 40));
for (float y = grid.top; y < grid.bottom + 5; y += grid.Height() / 2) {
for (float x = grid.left; x < grid.right + 5;
x += grid.Width() / 2) {
BRect r(x, y, x, y);
r.InsetBy(-5, -5);
clipping.Exclude(r);
r.InsetBy(-30, -30);
fClippingRegion.Exclude(r);
}
}
view->ConstrainClippingRegion(&clipping);
view->ConstrainClippingRegion(&fClippingRegion);
}

View File

@ -5,6 +5,8 @@
#ifndef TEST_H
#define TEST_H
#include <Region.h>
class BView;
class Test {
@ -17,6 +19,9 @@ public:
virtual void PrintResults() = 0;
void SetupClipping(BView* view);
protected:
BRegion fClippingRegion;
};
#endif // TEST_H