Make git ignore files only generated at build time.
[mesa.git] / progs / tests / api_speed.py
index d209676261fa207b1d6c2a20f0c02f74a97be938..0ddaf5836c901d6b55e628c3764d51b2be8a9bfa 100755 (executable)
@@ -70,10 +70,13 @@ class results:
        def compare_results(self, other):
                for name in self.cycles:
                        if other.cycles.has_key(name):
-                               a = float(self.cycles[name])  / self.iterations
-                               b = float(other.cycles[name]) / other.iterations
-                               p = (100.0 * b / a) - 100.0
-                               print "%- 20s %7.2f - %7.2f = % -6.2f (%+.1f%%)" % (name, a, b, a - b, p)
+                               a = float(self.cycles[name])  / float(self.iterations)
+                               b = float(other.cycles[name]) / float(other.iterations)
+                               if abs( a ) < 0.000001:
+                                   print "a = %f, b = %f" % (a, b)
+                               else:
+                                   p = (100.0 * b / a) - 100.0
+                                   print "%- 20s %7.2f - %7.2f = % -6.2f (%+.1f%%)" % (name, a, b, a - b, p)
                return
 
 
@@ -109,25 +112,22 @@ if __name__ == '__main__':
                show_usage()
 
 
-       result_array = []
-       names = []
-
-
        # If no libraries were specifically named, just run the test against
        # the default system libGL.
 
        if len(trail) == 0:
-               s = make_execution_string( None, iterations )
+               trail.append(None)
+
+
+       result_array = []
+       names = []
+
+       for lib in trail:
+               s = make_execution_string( lib, iterations )
                r = results()
                r.process_file( os.popen(s) )
+               names.append(lib)
                result_array.append(r)
-       else:
-               for lib in trail:
-                       s = make_execution_string( lib, iterations )
-                       r = results()
-                       r.process_file( os.popen(s) )
-                       names.append(lib)
-                       result_array.append(r)
 
 
        # If the test was only run against one library, just show the results