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

Commitefeef65

Browse files
committed
Separately report sleep time
1 parentad57f55 commitefeef65

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

‎pg_dtm.c‎

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ static void dtm_sleep(timestamp_t interval)
115115
{
116116
structtimespects;
117117
structtimespecrem;
118-
#ifTRACE_SLEEP_TIME
119-
timestamp_tnow=dtm_get_current_time();
120-
#endif
121118
ts.tv_sec=0;
122119
ts.tv_nsec=interval*1000;
123120

@@ -126,17 +123,6 @@ static void dtm_sleep(timestamp_t interval)
126123
Assert(errno==EINTR);
127124
ts=rem;
128125
}
129-
#ifTRACE_SLEEP_TIME
130-
totalSleepTime+=dtm_get_current_time()-now;
131-
if (now>prevReportTime+USEC*10) {
132-
prevReportTime=now;
133-
if (firstReportTime==0) {
134-
firstReportTime=now;
135-
}else {
136-
fprintf(stderr,"Sleep %lu of %lu usec (%f%%)\n",totalSleepTime,now-firstReportTime,totalSleepTime*100.0/(now-firstReportTime));
137-
}
138-
}
139-
#endif
140126
}
141127

142128
staticcid_tdtm_get_cid()
@@ -155,7 +141,23 @@ static cid_t dtm_sync(cid_t global_cid)
155141
cid_tlocal_cid;
156142
while ((local_cid=dtm_get_cid())<global_cid) {
157143
SpinLockRelease(&local->lock);
144+
#ifTRACE_SLEEP_TIME
145+
{
146+
timestamp_tnow=dtm_get_current_time();
147+
#endif
158148
dtm_sleep(global_cid-local_cid);
149+
#ifTRACE_SLEEP_TIME
150+
totalSleepTime+=dtm_get_current_time()-now;
151+
if (now>prevReportTime+USEC*10) {
152+
prevReportTime=now;
153+
if (firstReportTime==0) {
154+
firstReportTime=now;
155+
}else {
156+
fprintf(stderr,"Sleep %lu of %lu usec (%f%%)\n",totalSleepTime,now-firstReportTime,totalSleepTime*100.0/(now-firstReportTime));
157+
}
158+
}
159+
}
160+
#endif
159161
SpinLockAcquire(&local->lock);
160162
}
161163
returnglobal_cid;
@@ -449,7 +451,23 @@ bool DtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
449451
{
450452
DTM_TRACE((stderr,"%d: wait for in-doubt transaction %u in snapshot %lu\n",getpid(),xid,dtm_tx.snapshot));
451453
SpinLockRelease(&local->lock);
454+
#ifTRACE_SLEEP_TIME
455+
{
456+
timestamp_tnow=dtm_get_current_time();
457+
#endif
452458
dtm_sleep(delay);
459+
#ifTRACE_SLEEP_TIME
460+
totalSleepTime+=dtm_get_current_time()-now;
461+
if (now>prevReportTime+USEC*10) {
462+
prevReportTime=now;
463+
if (firstReportTime==0) {
464+
firstReportTime=now;
465+
}else {
466+
fprintf(stderr,"Sleep %lu of %lu usec (%f%%)\n",totalSleepTime,now-firstReportTime,totalSleepTime*100.0/(now-firstReportTime));
467+
}
468+
}
469+
}
470+
#endif
453471
if (delay*2 <=MAX_WAIT_TIMEOUT) {
454472
delay *=2;
455473
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp