Permalink
Browse files

Added refresh of the local variables to the add_query method (to refr…

…esh it more often).
  • Loading branch information...
1 parent 10e7af4 commit 70678e8b0e2a473b2c4b262aa9d87bd5379c278f @tvondra committed Oct 30, 2011
Showing with 8 additions and 4 deletions.
  1. +8 −4 queryhist.c
View
@@ -429,13 +429,17 @@ void query_hist_add_query(hist_bin_time_t duration) {
semaphore_lock();
- bin = (int)ceil(duration * 1000.0) / (*histogram_step);
+ /* refresh the local variables */
+ default_histogram_bins = (*histogram_bins);
+ default_histogram_step = (*histogram_step);
+ default_histogram_sample_pct = (*histogram_sample_pct);
+ default_histogram_type = (*histogram_type);
+
+ bin = (int)ceil(duration * 1000.0) / default_histogram_step;
/* queries that take longer than the last bin should go to
* the (HIST_BINS_MAX+1) bin */
- if (bin >= (*histogram_bins)) {
- bin = (*histogram_bins);
- }
+ bin = (bin >= default_histogram_bins) ? default_histogram_bins : bin;
histogram_count_bins[bin] += 1;
histogram_time_bins[bin] += duration;

0 comments on commit 70678e8

Please sign in to comment.