|
Revision 213, 0.9 kB
(checked in by dirk, 2 years ago)
|
Added simple benchmarking toolkit. Not for permanent use, just for now.
|
- Property svn:executable set to
*
|
| Line | |
|---|
| 1 |
from osgbench import * |
|---|
| 2 |
t=TestWindow() |
|---|
| 3 |
t.setSize(300,300) |
|---|
| 4 |
t.open() |
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
nc=1 |
|---|
| 8 |
scene=Group() |
|---|
| 9 |
for i in range(-nc,nc): |
|---|
| 10 |
for j in range(-nc,nc): |
|---|
| 11 |
geo=makePlane(.8,.8,128,128) |
|---|
| 12 |
geo.setDlistCache(1) |
|---|
| 13 |
geo.translate(i*2, j*2, 0) |
|---|
| 14 |
scene.addChild(geo) |
|---|
| 15 |
|
|---|
| 16 |
test=Test() |
|---|
| 17 |
test.setWindow(t) |
|---|
| 18 |
test.setScene(scene) |
|---|
| 19 |
test.setHeadlight(1) |
|---|
| 20 |
test.setNFrames(100) |
|---|
| 21 |
|
|---|
| 22 |
test.clear() |
|---|
| 23 |
test.addFov(90) |
|---|
| 24 |
test.makeOrbit(0,1,0) |
|---|
| 25 |
|
|---|
| 26 |
test.run() |
|---|
| 27 |
fps=test.getFPS() |
|---|
| 28 |
|
|---|
| 29 |
for i in scene.geometries(): |
|---|
| 30 |
i.setDlistCache(0) |
|---|
| 31 |
|
|---|
| 32 |
test.run() |
|---|
| 33 |
ncfps=test.getFPS() |
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
test.setStatistics(2) |
|---|
| 37 |
test.setNFrames(2) |
|---|
| 38 |
test.run() |
|---|
| 39 |
|
|---|
| 40 |
print " cached: %d tri/frame at %.2f FPS: %.0f tri/sec" % \ |
|---|
| 41 |
( test.getStatValue("NTriangles", 0), fps, \ |
|---|
| 42 |
test.getStatValue("NTriangles", 0) * fps ) |
|---|
| 43 |
|
|---|
| 44 |
print "noncached: %d tri/frame at %.2f FPS: %.0f tri/sec" % \ |
|---|
| 45 |
( test.getStatValue("NTriangles", 0), ncfps, \ |
|---|
| 46 |
test.getStatValue("NTriangles", 0) * ncfps ) |
|---|