VirtualBox

source: kStuff/trunk/kProfiler2/tst.c@ 121

Last change on this file since 121 was 2, checked in by bird, 17 years ago

Imported http://svn.netlabs.org/repos/libc/trunk/kStuff, revision 3612.

  • Property svn:keywords set to Id Revision
File size: 700 bytes
Line 
1#include <stdio.h>
2
3#ifdef _MSC_VER
4void __cdecl _penter(void);
5void __cdecl _pexit(void);
6__declspec(naked) int naked(void)
7{
8 __asm
9 {
10 call _penter
11 call _pexit
12 xor eax, eax
13 ret
14 }
15}
16
17#endif
18
19int bar(void)
20{
21 unsigned i;
22 for (i = 0; i < 1000; i += 7)
23 i += i & 1;
24 return i;
25}
26
27int foo(void)
28{
29 unsigned i, rc = 0;
30 for (i = 0; i < 1000; i++)
31 rc += bar();
32#ifdef _MSC_VER
33 for (; i < 2000; i++)
34 rc += naked();
35#endif
36 return i;
37}
38
39int main()
40{
41 int rc;
42 printf("hello");
43 fflush(stdout);
44 rc = foo();
45 printf("world\n");
46 return rc;
47}
48
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette