#include #include #include #include class TestC { public: TestC*child1; TestC*child2; TestC*child3; TestC(int depth) { if (depth>0) { depth-=1; child1=new TestC(depth); child2=new TestC(depth); child3=new TestC(depth); } else { child1=NULL; child2=NULL; child3=NULL; } } ~TestC() { if (child1!=NULL) delete child1; if (child2!=NULL) delete child2; if (child3!=NULL) delete child3; } int Count() { int count=1; if (child1!=NULL) count+=child1->Count(); if (child2!=NULL) count+=child2->Count(); if (child3!=NULL) count+=child3->Count(); return count; } }; int main(int argc, char*argv[]) { if (argc<3) { printf("TestC \n"); return 0; } int depth=atoi(argv[1]); int reps=atoi(argv[2]); printf("TestC started depth=%d reps=%d\n",depth,reps); float min_time = LONG_MAX; float max_time = LONG_MIN; float avg_time = 0; int count = 0; for(int rep=0; repCount(); delete t; timespec stop; clock_gettime(CLOCK_REALTIME, &stop); float elapse = (stop.tv_sec-start.tv_sec) + (float)(stop.tv_nsec-start.tv_nsec)/1000000000; //printf("ELAPSE=%f\n", elapse); if (min_time>elapse) min_time=elapse; if (max_time