Commits

tuck committed 602d63f

bug fix round on float

Comments (0)

Files changed (2)

pyramid_perfstat/perf_serializer.py

 #              
 #              (even if sql is boring ...  :'( )
 #
+#              to reduce overhead :
+#                    - no object
+#                    - procedural code
+#                    - simple sql query
+#
 #              TODO : add some configuration key to change default db
 #              TODO : add interface for serialization
 #              TODO : write other db target
         new_sql_nb_queries = 0
         if sql_sigma_duration is not None :
             new_sql_sigma_duration = self.cumulative_upkeep(last_sql_avg_duration, last_cpt, sql_sigma_duration)
-            new_sql_nb_queries = int(self.cumulative_upkeep(last_sql_nb_queries, last_cpt, sql_nb_queries))
+            new_sql_nb_queries = int(round(self.cumulative_upkeep(last_sql_nb_queries, last_cpt, sql_nb_queries)))
         if last_record_resume is None :
             self.update_mean_route_perf_value(new_record_resume, new_sql_sigma_duration, new_sql_nb_queries, insert=True)
         else :
         
         if sql_sigma_duration is not None :
             new_sql_sigma_duration = self.cumulative_upkeep(last_sql_avg_duration, last_cpt, sql_sigma_duration)
-            new_sql_nb_queries = int(self.cumulative_upkeep(last_sql_nb_queries, last_cpt, sql_nb_queries))
+            new_sql_nb_queries = int(round(self.cumulative_upkeep(last_sql_nb_queries, last_cpt, sql_nb_queries)))
         
         if last_record_resume is None :
             self.update_mean_view_perf_value(new_avg_resume, new_sql_sigma_duration, new_sql_nb_queries, insert=True)

pyramid_perfstat/templates/reporting.mako

 		<td>${id}</td>
 		<td>${get_color_perf(request_avg_time)}</td>
 		<td>${get_label_perf(request_avg_time)}</td>
-            % if sql_avg_time is not None and sql_avg_time > 0 :
+            % if sql_avg_time is not None and sql_avg_time >= 0 :
 		<td>${get_color_perf(sql_avg_time)}</td>
             % else :
 		<td>-</td>