Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaa8e1bb

Browse files
author
Sergey Shinderuk
committed
pgindent
1 parent8e0e23e commitaa8e1bb

File tree

3 files changed

+208
-202
lines changed

3 files changed

+208
-202
lines changed

‎collector.c

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ alloc_history(History *observations, int count)
7474
staticvoid
7575
realloc_history(History*observations,intcount)
7676
{
77-
HistoryItem*newitems;
78-
intcopyCount,
79-
i,
80-
j;
77+
HistoryItem*newitems;
78+
intcopyCount,
79+
i,
80+
j;
8181

8282
/* Allocate new array for history */
8383
newitems= (HistoryItem*)palloc0(sizeof(HistoryItem)*count);
@@ -115,7 +115,8 @@ realloc_history(History *observations, int count)
115115
staticvoid
116116
handle_sigterm(SIGNAL_ARGS)
117117
{
118-
intsave_errno=errno;
118+
intsave_errno=errno;
119+
119120
shutdown_requested= true;
120121
if (MyProc)
121122
SetLatch(&MyProc->procLatch);
@@ -150,7 +151,7 @@ probe_waits(History *observations, HTAB *profile_hash,
150151
{
151152
inti,
152153
newSize;
153-
TimestampTzts=GetCurrentTimestamp();
154+
TimestampTzts=GetCurrentTimestamp();
154155

155156
/* Realloc waits history if needed */
156157
newSize=pgws_historySize;
@@ -161,9 +162,9 @@ probe_waits(History *observations, HTAB *profile_hash,
161162
LWLockAcquire(ProcArrayLock,LW_SHARED);
162163
for (i=0;i<ProcGlobal->allProcCount;i++)
163164
{
164-
HistoryItemitem,
165-
*observation;
166-
PGPROC*proc=&ProcGlobal->allProcs[i];
165+
HistoryItemitem,
166+
*observation;
167+
PGPROC*proc=&ProcGlobal->allProcs[i];
167168

168169
if (!pgws_should_sample_proc(proc,&item.pid,&item.wait_event_info))
169170
continue;
@@ -185,8 +186,8 @@ probe_waits(History *observations, HTAB *profile_hash,
185186
/* Write to the profile if needed */
186187
if (write_profile)
187188
{
188-
ProfileItem*profileItem;
189-
boolfound;
189+
ProfileItem*profileItem;
190+
boolfound;
190191

191192
if (!profile_pid)
192193
item.pid=0;
@@ -207,9 +208,9 @@ probe_waits(History *observations, HTAB *profile_hash,
207208
staticvoid
208209
send_history(History*observations,shm_mq_handle*mqh)
209210
{
210-
Sizecount,
211-
i;
212-
shm_mq_resultmq_result;
211+
Sizecount,
212+
i;
213+
shm_mq_resultmq_result;
213214

214215
if (observations->wraparound)
215216
count=observations->count;
@@ -227,10 +228,10 @@ send_history(History *observations, shm_mq_handle *mqh)
227228
for (i=0;i<count;i++)
228229
{
229230
mq_result=shm_mq_send_compat(mqh,
230-
sizeof(HistoryItem),
231-
&observations->items[i],
232-
false,
233-
true);
231+
sizeof(HistoryItem),
232+
&observations->items[i],
233+
false,
234+
true);
234235
if (mq_result==SHM_MQ_DETACHED)
235236
{
236237
ereport(WARNING,
@@ -247,10 +248,10 @@ send_history(History *observations, shm_mq_handle *mqh)
247248
staticvoid
248249
send_profile(HTAB*profile_hash,shm_mq_handle*mqh)
249250
{
250-
HASH_SEQ_STATUSscan_status;
251-
ProfileItem*item;
252-
Sizecount=hash_get_num_entries(profile_hash);
253-
shm_mq_resultmq_result;
251+
HASH_SEQ_STATUSscan_status;
252+
ProfileItem*item;
253+
Sizecount=hash_get_num_entries(profile_hash);
254+
shm_mq_resultmq_result;
254255

255256
mq_result=shm_mq_send_compat(mqh,sizeof(count),&count, false, true);
256257
if (mq_result==SHM_MQ_DETACHED)
@@ -282,7 +283,7 @@ send_profile(HTAB *profile_hash, shm_mq_handle *mqh)
282283
staticHTAB*
283284
make_profile_hash()
284285
{
285-
HASHCTLhash_ctl;
286+
HASHCTLhash_ctl;
286287

287288
hash_ctl.hash=tag_hash;
288289
hash_ctl.hcxt=TopMemoryContext;
@@ -303,8 +304,8 @@ make_profile_hash()
303304
staticint64
304305
millisecs_diff(TimestampTztz1,TimestampTztz2)
305306
{
306-
longsecs;
307-
intmicrosecs;
307+
longsecs;
308+
intmicrosecs;
308309

309310
TimestampDifference(tz1,tz2,&secs,&microsecs);
310311

@@ -318,13 +319,13 @@ millisecs_diff(TimestampTz tz1, TimestampTz tz2)
318319
void
319320
pgws_collector_main(Datummain_arg)
320321
{
321-
HTAB*profile_hash=NULL;
322-
Historyobservations;
323-
MemoryContextold_context,
324-
collector_context;
325-
TimestampTzcurrent_ts,
326-
history_ts,
327-
profile_ts;
322+
HTAB*profile_hash=NULL;
323+
Historyobservations;
324+
MemoryContextold_context,
325+
collector_context;
326+
TimestampTzcurrent_ts,
327+
history_ts,
328+
profile_ts;
328329

329330
/*
330331
* Establish signal handlers.
@@ -358,7 +359,7 @@ pgws_collector_main(Datum main_arg)
358359

359360
CurrentResourceOwner=ResourceOwnerCreate(NULL,"pg_wait_sampling collector");
360361
collector_context=AllocSetContextCreate(TopMemoryContext,
361-
"pg_wait_sampling context",ALLOCSET_DEFAULT_SIZES);
362+
"pg_wait_sampling context",ALLOCSET_DEFAULT_SIZES);
362363
old_context=MemoryContextSwitchTo(collector_context);
363364
alloc_history(&observations,pgws_historySize);
364365
MemoryContextSwitchTo(old_context);
@@ -370,12 +371,12 @@ pgws_collector_main(Datum main_arg)
370371

371372
while (1)
372373
{
373-
intrc;
374-
shm_mq_handle*mqh;
375-
int64history_diff,
376-
profile_diff;
377-
boolwrite_history,
378-
write_profile;
374+
intrc;
375+
shm_mq_handle*mqh;
376+
int64history_diff,
377+
profile_diff;
378+
boolwrite_history,
379+
write_profile;
379380

380381
/* We need an explicit call for at least ProcSignal notifications. */
381382
CHECK_FOR_INTERRUPTS();
@@ -392,8 +393,8 @@ pgws_collector_main(Datum main_arg)
392393
history_diff=millisecs_diff(history_ts,current_ts);
393394
profile_diff=millisecs_diff(profile_ts,current_ts);
394395

395-
write_history= (history_diff >= (int64)pgws_historyPeriod);
396-
write_profile= (profile_diff >= (int64)pgws_profilePeriod);
396+
write_history= (history_diff >= (int64)pgws_historyPeriod);
397+
write_profile= (profile_diff >= (int64)pgws_profilePeriod);
397398

398399
if (write_history||write_profile)
399400
{
@@ -422,8 +423,8 @@ pgws_collector_main(Datum main_arg)
422423
* shared memory.
423424
*/
424425
rc=WaitLatch(&MyProc->procLatch,WL_LATCH_SET |WL_TIMEOUT |WL_POSTMASTER_DEATH,
425-
Min(pgws_historyPeriod- (int)history_diff,
426-
pgws_historyPeriod- (int)profile_diff),PG_WAIT_EXTENSION);
426+
Min(pgws_historyPeriod- (int)history_diff,
427+
pgws_historyPeriod- (int)profile_diff),PG_WAIT_EXTENSION);
427428

428429
if (rc&WL_POSTMASTER_DEATH)
429430
proc_exit(1);
@@ -444,7 +445,7 @@ pgws_collector_main(Datum main_arg)
444445

445446
if (request==HISTORY_REQUEST||request==PROFILE_REQUEST)
446447
{
447-
shm_mq_resultmq_result;
448+
shm_mq_resultmq_result;
448449

449450
/* Send history or profile */
450451
shm_mq_set_sender(pgws_collector_mq,MyProc);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp