diff python/pydc/examples/sintest.py @ 5:bf5625bb6f05

- brought python binding up to dc v0.9
author cslag
date Tue, 22 Mar 2016 01:49:34 +0100
parents 0cfcc391201f
children edbbd467f50a
line wrap: on
line diff
--- a/python/pydc/examples/sintest.py	Tue Mar 22 00:55:15 2016 +0100
+++ b/python/pydc/examples/sintest.py	Tue Mar 22 01:49:34 2016 +0100
@@ -1,33 +1,42 @@
 import math
 import os
 import pydc
+import sys
+import platform
+
+if sys.platform == "win32":
+  libm = pydc.load("msvcrt")
+elif sys.platform == "darwin":
+  libm = pydc.load("/usr/lib/libm.dylib")
+elif "bsd" in sys.platform:
+  libm = pydc.load("/usr/lib/libm.so")
+elif platform.architecture()[0] == "64bit":
+  libm = pydc.load("/lib64/libm.so.6")
+else:
+  libm = pydc.load("/lib/libm.so.6")
+
+fpsin = pydc.find(libm,"sin")
+
+
 
 def f1(n):
   for x in xrange(n):
     math.sin(x)
 #  filter( math.sin, range(0,n) )
 
-
-libc = pydc.load("msvcrt")
-fpsin = pydc.find(libc,"sin")
-
-def libcsin(x): pass
+def libmsin(x): pass
 
 def f2(n):
   for x in xrange(n):
     pydc.call(fpsin,"d)d",float(x))
-#    libcsin(i)
+#    libmsin(i)
 
-#  filter( libcsin , range(0,n) )
+#  filter( libmsin , range(0,n) )
 
 
-#b = os.times()
+print "start_native"+str(os.times())
 f1(10000000)
-#f2(10000000)
-e = os.times()
+print "start_dc"+str(os.times())
+f2(10000000)
+print "end"+str(os.times())
 
-print e
-
-
-
-