commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/geas/examples/python neil_methods_test.py


From: Neil Tiffin
Subject: gnue/geas/examples/python neil_methods_test.py
Date: Thu, 20 Sep 2001 18:12:42 -0400

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Neil Tiffin <address@hidden>    01/09/20 18:12:42

Modified files:
        geas/examples/python: neil_methods_test.py 

Log message:
        start the basis for geas peformance test.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/examples/python/neil_methods_test.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gnue/geas/examples/python/neil_methods_test.py
diff -u gnue/geas/examples/python/neil_methods_test.py:1.1 
gnue/geas/examples/python/neil_methods_test.py:1.2
--- gnue/geas/examples/python/neil_methods_test.py:1.1  Tue Sep 18 20:45:59 2001
+++ gnue/geas/examples/python/neil_methods_test.py      Thu Sep 20 18:12:42 2001
@@ -3,10 +3,11 @@
 # a test file: relies on GEAS being run from gnue/geas/src
 # and this from gnue/geas/examples/python
 
-# $Id: neil_methods_test.py,v 1.1 2001/09/19 00:45:59 ntiffin Exp $
+# $Id: neil_methods_test.py,v 1.2 2001/09/20 22:12:42 ntiffin Exp $
 
 import sys
 import md5
+import time
 from string import * 
 
 try:
@@ -32,17 +33,48 @@
 except GEAS.ServerError,ex:
     print "error? " + ex.detail
 
-try:
-    obj = con.newObject( "mod1::class1" )
-    obj.setField("a_text_field","joe")
+num_loops = 100
+print "neil_methods_test.py"
+print time.asctime(time.gmtime()), "UTC"
+print "loop count = %i" % num_loops
+
+# first test is create objects
+x = 0
+time_start = time.time()
+while (x < num_loops):
     try:
-        print "Call method: " + obj.callMethod( "helloworld" , ["a", "b"] )
-    except GEAS.NullField,ex:
+        obj = con.newObject( "mod1::class1" )
+        obj.setField("a_text_field","joe")
+        obj.delete()
+    except GEAS.ServerError,ex:
         print ex.detail
-    except GEAS.MethodError,ex:
+    x = x+1
+time_end = time.time()
+create_and_set_time = (time_end - time_start) / x
+print "time to create object and set one field = ", "%.3f" % 
(create_and_set_time*1000), " milliseconds."
+
+x = 0
+a = "a"
+b = "b"
+time_start = time.time()
+while (x < num_loops):
+    try:
+        obj = con.newObject( "mod1::class1" )
+        obj.setField("a_text_field","joe")
+        try:
+            a_result = obj.callMethod( "helloworld" , [a, b])
+            # print str(x) + ", Call method: " +  str(a_result)
+        except GEAS.NullField,ex:
+            print ex.detail
+        except GEAS.MethodError,ex:
+            print ex.detail
+    
+        obj.delete()
+    
+    except GEAS.ServerError,ex:
         print ex.detail
-
-    obj.delete()
-
-except GEAS.ServerError,ex:
-    print ex.detail
+    x = x+1
+time_end = time.time()
+create_and_set_method_time = (time_end - time_start) / x
+print "time to create object, set one field, and call method = ", "%.3f" % 
(create_and_set_method_time*1000), " milliseconds."
+print "time to call a method only = ", "%.3f" % ((create_and_set_method_time - 
create_and_set_time)*1000), " milliseconds."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]