2003-11-06 Zoltan Varga <zovarga@ws-zovarga2>
authorZoltan Varga <vargaz@gmail.com>
Thu, 6 Nov 2003 20:54:00 +0000 (20:54 -0000)
committerZoltan Varga <vargaz@gmail.com>
Thu, 6 Nov 2003 20:54:00 +0000 (20:54 -0000)
* mono/benchmark/pinvoke.cs: New benchmark for testing the performance
of the managed/unmanaged boundary.

svn path=/trunk/mono/; revision=19695

ChangeLog
mono/benchmark/pinvoke.cs [new file with mode: 0755]

index 9c6e9830368cf477edeb0fa66d65acaf77656602..3cc86d8bf4e5fc122674300d7788696fbb250edc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-11-06  Zoltan Varga  <zovarga@ws-zovarga2>
+
+       * mono/benchmark/pinvoke.cs: New benchmark for testing the performance
+       of the managed/unmanaged boundary.
+
 2003-11-06  Zoltan Varga  <vargaz@freemail.hu>
 
        * configure.in acconfig.h: Add check for __thread keyword in gcc.
diff --git a/mono/benchmark/pinvoke.cs b/mono/benchmark/pinvoke.cs
new file mode 100755 (executable)
index 0000000..5ec3a6b
--- /dev/null
@@ -0,0 +1,31 @@
+using System;
+using System.Runtime.InteropServices;
+
+public class Test {
+
+       public static int delegate_test (int a)
+       {
+               if (a == 2)
+                       return 0;
+
+               return 1;
+       }
+       
+       [DllImport ("libtest", EntryPoint="mono_test_empty_pinvoke")]
+       public static extern int mono_test_empty_pinvoke (int i);
+
+       public static int Main (String[] args) {
+               int repeat = 1;
+                               
+               if (args.Length == 1)
+                       repeat = Convert.ToInt32 (args [0]);
+               
+               Console.WriteLine ("Repeat = " + repeat);
+
+               for (int i = 0; i < (repeat * 5000); i++)
+                       for (int j = 0; j < 10000; j++)
+                               mono_test_empty_pinvoke (5);
+               
+               return 0;
+       }
+}