@@ -438,11 +438,21 @@ TransactionId DtmGetOldestXmin(Relation rel, bool ignoreVacuum)
438
438
439
439
bool DtmXidInMVCCSnapshot (TransactionId xid ,Snapshot snapshot )
440
440
{
441
+ #if TRACE_SLEEP_TIME
442
+ static timestamp_t firstReportTime ;
443
+ static timestamp_t prevReportTime ;
444
+ static timestamp_t totalSleepTime ;
445
+ #endif
441
446
timestamp_t delay = MIN_WAIT_TIMEOUT ;
442
447
Assert (xid != InvalidTransactionId );
443
448
444
449
SpinLockAcquire (& local -> lock );
445
450
451
+ #if TRACE_SLEEP_TIME
452
+ if (firstReportTime == 0 ) {
453
+ firstReportTime = dtm_get_current_time ();
454
+ }
455
+ #endif
446
456
while (true)
447
457
{
448
458
DtmTransStatus * ts = (DtmTransStatus * )hash_search (xid2status ,& xid ,HASH_FIND ,NULL );
@@ -461,14 +471,11 @@ bool DtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
461
471
#if TRACE_SLEEP_TIME
462
472
{
463
473
timestamp_t now = dtm_get_current_time ();
464
- static timestamp_t firstReportTime ;
465
- static timestamp_t prevReportTime ;
466
- static timestamp_t totalSleepTime ;
467
474
#endif
468
475
dtm_sleep (delay );
469
476
#if TRACE_SLEEP_TIME
470
477
totalSleepTime += dtm_get_current_time ()- now ;
471
- if (now > prevReportTime + USEC * 10 ) {
478
+ if (now > prevReportTime + USEC * 1 ) {
472
479
prevReportTime = now ;
473
480
if (firstReportTime == 0 ) {
474
481
firstReportTime = now ;