@@ -27,6 +27,10 @@ shm_toc *toc;
2727shm_mq * mq ;
2828static volatile sig_atomic_t shutdown_requested = false;
2929
30+ int historySize ;
31+ int historyPeriod ;
32+ bool historySkipLatch ;
33+
3034static void handle_sigterm (SIGNAL_ARGS );
3135static void collector_main (Datum main_arg );
3236
@@ -66,20 +70,6 @@ AllocateCollectorMem(void)
6670
6771 mq_mem = shm_toc_allocate (toc , COLLECTOR_QUEUE_SIZE );
6872 shm_toc_insert (toc , 1 , mq_mem );
69-
70- DefineCustomIntVariable ("pg_stat_wait.history_size" ,
71- "Sets size of waits history." , NULL ,
72- & hdr -> historySize , 5000 , 100 , INT_MAX ,
73- PGC_SUSET , 0 , NULL , NULL , NULL );
74-
75- DefineCustomIntVariable ("pg_stat_wait.history_period" ,
76- "Sets period of waits history sampling." , NULL ,
77- & hdr -> historyPeriod , 10 , 1 , INT_MAX ,
78- PGC_SUSET , 0 , NULL , NULL , NULL );
79-
80- DefineCustomBoolVariable ("pg_stat_wait.history_skip_latch" ,
81- "Skip latch events in waits history" , NULL ,
82- & hdr -> historySkipLatch , false, PGC_SUSET , 0 , NULL , NULL , NULL );
8373 }
8474 else
8575 {
@@ -185,7 +175,7 @@ write_waits_history(History *observations, TimestampTz current_ts)
185175
186176 if (stateOk )
187177 {
188- if (hdr -> historySkipLatch && item .classId == WAIT_LATCH )
178+ if (historySkipLatch && item .classId == WAIT_LATCH )
189179 continue ;
190180
191181 item .ts = current_ts ;
@@ -241,7 +231,7 @@ collector_main(Datum main_arg)
241231 ALLOCSET_DEFAULT_INITSIZE ,
242232 ALLOCSET_DEFAULT_MAXSIZE );
243233 old_context = MemoryContextSwitchTo (collector_context );
244- AllocHistory (& observations , hdr -> historySize );
234+ AllocHistory (& observations , historySize );
245235 MemoryContextSwitchTo (old_context );
246236
247237 while (1 )
@@ -258,7 +248,7 @@ collector_main(Datum main_arg)
258248
259249 rc = WaitLatch (& MyProc -> procLatch ,
260250 WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH ,
261- hdr -> historyPeriod );
251+ historyPeriod );
262252
263253 if (rc & WL_POSTMASTER_DEATH )
264254 exit (1 );
0 commit comments