@ -325,9 +325,12 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
new_rel_allvisible ;
new_rel_allvisible ;
PGRUsage ru0 ;
PGRUsage ru0 ;
TimestampTz starttime = 0 ;
TimestampTz starttime = 0 ;
PgStat_Counter startreadtime = 0 ;
PgStat_Counter startreadtime = 0 ,
PgStat_Counter startwritetime = 0 ;
startwritetime = 0 ;
WalUsage walusage_start = pgWalUsage ;
WalUsage startwalusage = pgWalUsage ;
int64 StartPageHit = VacuumPageHit ,
StartPageMiss = VacuumPageMiss ,
StartPageDirty = VacuumPageDirty ;
ErrorContextCallback errcallback ;
ErrorContextCallback errcallback ;
char * * indnames = NULL ;
char * * indnames = NULL ;
@ -639,12 +642,15 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
StringInfoData buf ;
StringInfoData buf ;
char * msgfmt ;
char * msgfmt ;
int32 diff ;
int32 diff ;
int64 PageHitOp = VacuumPageHit - StartPageHit ,
PageMissOp = VacuumPageMiss - StartPageMiss ,
PageDirtyOp = VacuumPageDirty - StartPageDirty ;
double read_rate = 0 ,
double read_rate = 0 ,
write_rate = 0 ;
write_rate = 0 ;
TimestampDifference ( starttime , endtime , & secs_dur , & usecs_dur ) ;
TimestampDifference ( starttime , endtime , & secs_dur , & usecs_dur ) ;
memset ( & walusage , 0 , sizeof ( WalUsage ) ) ;
memset ( & walusage , 0 , sizeof ( WalUsage ) ) ;
WalUsageAccumDiff ( & walusage , & pgWalUsage , & walusage_start ) ;
WalUsageAccumDiff ( & walusage , & pgWalUsage , & start walusage) ;
initStringInfo ( & buf ) ;
initStringInfo ( & buf ) ;
if ( verbose )
if ( verbose )
@ -763,18 +769,18 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
}
}
if ( secs_dur > 0 | | usecs_dur > 0 )
if ( secs_dur > 0 | | usecs_dur > 0 )
{
{
read_rate = ( double ) BLCKSZ * Vacuum PageMiss / ( 1024 * 1024 ) /
read_rate = ( double ) BLCKSZ * PageMissOp / ( 1024 * 1024 ) /
( secs_dur + usecs_dur / 1000000.0 ) ;
( secs_dur + usecs_dur / 1000000.0 ) ;
write_rate = ( double ) BLCKSZ * Vacuum PageDirty / ( 1024 * 1024 ) /
write_rate = ( double ) BLCKSZ * PageDirtyOp / ( 1024 * 1024 ) /
( secs_dur + usecs_dur / 1000000.0 ) ;
( secs_dur + usecs_dur / 1000000.0 ) ;
}
}
appendStringInfo ( & buf , _ ( " avg read rate: %.3f MB/s, avg write rate: %.3f MB/s \n " ) ,
appendStringInfo ( & buf , _ ( " avg read rate: %.3f MB/s, avg write rate: %.3f MB/s \n " ) ,
read_rate , write_rate ) ;
read_rate , write_rate ) ;
appendStringInfo ( & buf ,
appendStringInfo ( & buf ,
_ ( " buffer usage: %lld hits, %lld misses, %lld dirtied \n " ) ,
_ ( " buffer usage: %lld hits, %lld misses, %lld dirtied \n " ) ,
( long long ) Vacuum PageHit,
( long long ) PageHitOp ,
( long long ) Vacuum PageMiss,
( long long ) PageMissOp ,
( long long ) Vacuum PageDirty) ;
( long long ) PageDirtyOp ) ;
appendStringInfo ( & buf ,
appendStringInfo ( & buf ,
_ ( " WAL usage: %lld records, %lld full page images, %llu bytes \n " ) ,
_ ( " WAL usage: %lld records, %lld full page images, %llu bytes \n " ) ,
( long long ) walusage . wal_records ,
( long long ) walusage . wal_records ,