|
Revision 213, 1.0 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 |
|
|---|
| 2 |
from osgbench import * |
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
win=TestWindow() |
|---|
| 6 |
win.setSize(300,300) |
|---|
| 7 |
win.open() |
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
scene=Group() |
|---|
| 11 |
|
|---|
| 12 |
nc=8 |
|---|
| 13 |
|
|---|
| 14 |
scene=Group() |
|---|
| 15 |
|
|---|
| 16 |
for i in range(-nc,nc): |
|---|
| 17 |
inode=Group() |
|---|
| 18 |
scene.addChild(inode) |
|---|
| 19 |
for j in range(-nc,nc): |
|---|
| 20 |
jnode=Group() |
|---|
| 21 |
inode.addChild(jnode) |
|---|
| 22 |
for k in range(-nc,nc): |
|---|
| 23 |
geo=makeBox(1,1,1, 1,1,1) |
|---|
| 24 |
geo.translate(i*2, j*2, k*2) |
|---|
| 25 |
jnode.addChild(geo) |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
test=Test() |
|---|
| 29 |
test.setWindow(win) |
|---|
| 30 |
test.setNFrames(100) |
|---|
| 31 |
test.setMinTime(5) |
|---|
| 32 |
test.setScene(scene) |
|---|
| 33 |
test.setStatistics(1) |
|---|
| 34 |
|
|---|
| 35 |
test.addFov(90) |
|---|
| 36 |
test.makeOrbit(0,1,0) |
|---|
| 37 |
|
|---|
| 38 |
test.run() |
|---|
| 39 |
|
|---|
| 40 |
print "%d transformed cubes took %f seconds: %f fps" % ((nc*2)*(nc*2)*(nc*2), test.getTime(), test.getFPS()) |
|---|
| 41 |
|
|---|
| 42 |
culled=0 |
|---|
| 43 |
culltested=0 |
|---|
| 44 |
|
|---|
| 45 |
for i in range(0,test.getNRenderedFrames()): |
|---|
| 46 |
culled += test.getStatValue("culledNodes", i) |
|---|
| 47 |
culltested += test.getStatValue("cullTestedNodes", i) |
|---|
| 48 |
|
|---|
| 49 |
print "%d nodes culled, %d nodes culltested" % (culled, culltested) |
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|