From 4343bb8c9898e2fe62efcf895580cf54739de9a5 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 7 Aug 2001 16:01:08 +0000 Subject: [PATCH] update test_sgraph --- panda/src/sgraph/Sources.pp | 2 ++ panda/src/sgraph/test_sgraph.cxx | 34 +++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/panda/src/sgraph/Sources.pp b/panda/src/sgraph/Sources.pp index f9f90d0fd1..1714fce2e6 100644 --- a/panda/src/sgraph/Sources.pp +++ b/panda/src/sgraph/Sources.pp @@ -36,6 +36,8 @@ #define TARGET test_sgraph #define LOCAL_LIBS \ sgraph mathutil graph putil + #define OTHER_LIBS \ + pystub #define SOURCES \ test_sgraph.cxx diff --git a/panda/src/sgraph/test_sgraph.cxx b/panda/src/sgraph/test_sgraph.cxx index a32cce79e8..b2bcdd7adc 100644 --- a/panda/src/sgraph/test_sgraph.cxx +++ b/panda/src/sgraph/test_sgraph.cxx @@ -16,12 +16,40 @@ // //////////////////////////////////////////////////////////////////// -#include "camera.h" +#include "geomNode.h" -#include +#include "pointerTo.h" +#include "clockObject.h" +#include "notify.h" int main() { nout << "running test_sgraph" << endl; - PT(Camera) cam = new Camera("camera"); + + ClockObject *c = ClockObject::get_global_clock(); + int i; + int count = 100000; + double start, finish; + PT(Node) node; + + node = new GeomNode("foo"); + start = c->get_real_time(); + for (i = 0; i < count; i++) { + node->is_of_type(GeomNode::get_class_type()); + } + finish = c->get_real_time(); + + cerr << "test 1: " << (finish - start) / (double)count * 1000.0 + << " ms\n"; + + node = new NamedNode("foo"); + start = c->get_real_time(); + for (i = 0; i < count; i++) { + node->is_of_type(GeomNode::get_class_type()); + } + finish = c->get_real_time(); + + cerr << "test 2: " << (finish - start) / (double)count * 1000.0 + << " ms\n"; + return 0; }