Permalink
Browse files

Implemented histogram shared by backends (shared memory segment and a…

… semaphore).
  • Loading branch information...
1 parent aabec36 commit 0a06bea78b1f77dcce9eec4e8aefbc622ee53830 @tvondra committed Oct 29, 2011
Showing with 305 additions and 78 deletions.
  1. +7 −1 query_histogram--1.0.sql
  2. +9 −0 query_histogram.c
  3. +282 −68 queryhist.c
  4. +7 −9 queryhist.h
View
@@ -1,4 +1,10 @@
-CREATE OR REPLACE FUNCTION query_histogram(OUT bin_from INT, OUT bin_to INT, OUT bin_count INT, OUT bin_count_pct REAL, OUT bin_time INT, OUT bin_time_pct REAL)
+CREATE OR REPLACE FUNCTION query_histogram( OUT bin_from INT, OUT bin_to INT, OUT bin_count INT, OUT bin_count_pct REAL,
+ OUT bin_time INT, OUT bin_time_pct REAL)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'query_histogram'
LANGUAGE C IMMUTABLE;
+
+CREATE OR REPLACE FUNCTION query_histogram_reset()
+ RETURNS void
+ AS 'MODULE_PATHNAME', 'query_histogram_reset'
+ LANGUAGE C IMMUTABLE;
View
@@ -15,8 +15,10 @@ PG_MODULE_MAGIC;
#endif
PG_FUNCTION_INFO_V1(query_histogram);
+PG_FUNCTION_INFO_V1(query_histogram_reset);
Datum query_histogram(PG_FUNCTION_ARGS);
+Datum query_histogram_reset(PG_FUNCTION_ARGS);
Datum
query_histogram(PG_FUNCTION_ARGS)
@@ -126,3 +128,10 @@ query_histogram(PG_FUNCTION_ARGS)
}
}
+
+Datum
+query_histogram_reset(PG_FUNCTION_ARGS)
+{
+ query_hist_reset(false);
+ PG_RETURN_VOID();
+}
Oops, something went wrong.

0 comments on commit 0a06bea

Please sign in to comment.