/[projet1]/users/dbug/tests/IrqBenchmark/profiler/Main.c
Defence Force logotype

Contents of /users/dbug/tests/IrqBenchmark/profiler/Main.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 938 - (show annotations)
Sun Jun 9 19:22:25 2013 UTC (6 years, 11 months ago) by coco
File MIME type: text/plain
File size: 2377 byte(s)


1 // --------------------------------------
2 // Profile
3 // --------------------------------------
4 // (c) 2009-2010
5 // Mickael Pointier and Jonathan Bristow
6 //
7 // This code is provided as-is.
8 // I do not assume any responsability
9 // concerning the fact this is a bug-free
10 // software !!!
11 // Except that, you can use this example
12 // without any limitation !
13 // If you manage to do something with that
14 // please, contact me :)
15 // --------------------------------------
16 // --------------------------------------
17 // For more information, please contact me
18 // on internet:
19 // e-mail: mike@defence-force.org
20 // URL: http://www.defence-force.org
21 // --------------------------------------
22 // Note: This text was typed with a Win32
23 // editor. So perhaps the text will not be
24 // displayed correctly with other OS.
25
26 #include "lib.h"
27 #include "profile.h"
28
29
30 void Test_20000();
31 void TestAsm();
32
33
34 void TestSpeed()
35 {
36 PROFILE_ENTER(ROUTINE_TEST20000);
37 Test_20000();
38 PROFILE_LEAVE(ROUTINE_TEST20000);
39
40 PROFILE_ENTER(ROUTINE_TEST20000);
41 Test_20000();
42 PROFILE_LEAVE(ROUTINE_TEST20000);
43
44 PROFILE_ENTER(ROUTINE_TEST20000);
45 Test_20000();
46 PROFILE_LEAVE(ROUTINE_TEST20000);
47 }
48
49
50 void DoSomething()
51 {
52 static int x=1;
53 static int y=1;
54 static int r=1;
55
56 PROFILE_ENTER(ROUTINE_DOSOMETHING);
57
58 if (r<99)
59 {
60 curset(x,y,1);
61 circle(r,2);
62
63 r+=1;
64 x+=1;
65 y+=1;
66 }
67
68 PROFILE_LEAVE(ROUTINE_DOSOMETHING);
69 }
70
71
72 void RandomSubroutine()
73 {
74 PROFILE_ENTER(ROUTINE_SUBROUTINE);
75 PROFILE_LEAVE(ROUTINE_SUBROUTINE);
76 }
77
78
79 void DoSomethingElse()
80 {
81 static int x=238;
82 static int y=1;
83 static int r=1;
84
85 PROFILE_ENTER(ROUTINE_DOSOMETHINGELSE);
86
87 if (r<99)
88 {
89 RandomSubroutine();
90 curset(x,y,1);
91 RandomSubroutine();
92 circle(r,1);
93 RandomSubroutine();
94
95 r+=1;
96 x-=1;
97 y+=1;
98 }
99 PROFILE_LEAVE(ROUTINE_DOSOMETHINGELSE);
100 }
101
102
103 void main()
104 {
105 printf("If you see this message, you probably need to enable the PRINTER output when booting - F3 in Euphoric -\nResults are in PROFILE.TXT");
106 ProfilerInitialize();
107
108 hires();
109
110 while (1)
111 {
112 ProfilerNextFrame();
113
114 PROFILE_ENTER(ROUTINE_GLOBAL);
115 TestSpeed();
116 TestAsm();
117 DoSomething();
118 DoSomethingElse();
119 PROFILE_LEAVE(ROUTINE_GLOBAL);
120
121 ProfilerDisplay();
122 }
123
124 ProfilerTerminate();
125
126 printf("Done\n");
127 }
128
129

  ViewVC Help
Powered by ViewVC 1.1.26