diff options
Diffstat (limited to 'src/lib/kStuff/kProfiler2/tst.c')
-rw-r--r-- | src/lib/kStuff/kProfiler2/tst.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/lib/kStuff/kProfiler2/tst.c b/src/lib/kStuff/kProfiler2/tst.c new file mode 100644 index 0000000..f56204c --- /dev/null +++ b/src/lib/kStuff/kProfiler2/tst.c @@ -0,0 +1,48 @@ +#include <stdio.h>
+
+#ifdef _MSC_VER
+void __cdecl _penter(void);
+void __cdecl _pexit(void);
+__declspec(naked) int naked(void)
+{
+ __asm
+ {
+ call _penter
+ call _pexit
+ xor eax, eax
+ ret
+ }
+}
+
+#endif
+
+int bar(void)
+{
+ unsigned i;
+ for (i = 0; i < 1000; i += 7)
+ i += i & 1;
+ return i;
+}
+
+int foo(void)
+{
+ unsigned i, rc = 0;
+ for (i = 0; i < 1000; i++)
+ rc += bar();
+#ifdef _MSC_VER
+ for (; i < 2000; i++)
+ rc += naked();
+#endif
+ return i;
+}
+
+int main()
+{
+ int rc;
+ printf("hello");
+ fflush(stdout);
+ rc = foo();
+ printf("world\n");
+ return rc;
+}
+
|