use the locations specified in the bcm2708_boot header
[AROS.git] / test / oop2 / test.c
blob0f864ce88856279f642f022c334d0f890c2a2a44
1 /*
2 Copyright © 1997-98, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Demo of new OOP system
6 Lang: english
7 */
9 #include "oop.h"
10 #include "timerclass.h"
11 #include "protos.h"
12 #include "support.h"
13 #include <stdio.h>
15 extern struct List ClassList;
18 #define NUM_ITERATIONS (10000000)
20 IPTR TestFunc(Class *cl, Object *o, Msg msg)
22 return (12345678);
26 int main(int argc, char **argv)
29 if (InitOOP())
31 Class *timercl;
33 printf("Object system initialized\n");
36 /* Initialize the timer class */
37 timercl = MakeTimerClass();
38 if (timercl)
41 struct Node *n;
42 Object *timer;
44 printf("Class list:\n");
45 ForeachNode(&ClassList, n)
47 printf("%s\n", n->ln_Name);
49 printf("\n\n");
51 printf("Hash table:\n");
53 /* Create a new instance */
54 timer = NewObject(NULL, TIMERCLASS, NULL);
55 if (timer)
57 ULONG i;
58 ULONG methodid = M_Timer_TestMethod;
60 printf("Timer object: %p\n", timer);
62 printf ("Doing ten billion calls to test method...\n");
65 /* Normal ivocation test */
66 printf ("Using normal invocation\n");
68 Timer_Start(timer);
70 for (i = 0; i < NUM_ITERATIONS; i ++)
72 Timer_TestMethod(timer);
75 Timer_Stop(timer);
76 printf("Time elapsed: ");
77 Timer_PrintElapsed(timer);
80 /* Function test */
81 printf("\nTen billion calls to empty *function*\n");
82 Timer_Start(timer);
84 for (i = 0; i < NUM_ITERATIONS; i ++)
86 TestFunc(timercl, timer, (Msg)&methodid);
90 Timer_Stop(timer);
91 printf("Time elapsed: ");
92 Timer_PrintElapsed(timer);
96 /* Loop test */
97 printf("\nLooping ten billion times\n");
98 Timer_Start(timer);
100 for (i = 0; i < NUM_ITERATIONS; i ++)
102 ULONG retval;
103 retval = 12345678;
106 Timer_Stop(timer);
107 printf("Time elapsed: ");
108 Timer_PrintElapsed(timer);
110 printf("\n\nTestMethod output: %ld\n", Timer_TestMethod(timer));
112 /* Dispose object */
113 DisposeObject(timer);
116 FreeTimerClass(timercl);
118 CleanupOOP();
121 return (0);