@ -3835,6 +3835,9 @@ initGenerateDataClientSide(PGconn *con)
remaining_sec ;
int log_interval = 1 ;
/* Stay on the same line if reporting to a terminal */
char eol = isatty ( fileno ( stderr ) ) ? ' \r ' : ' \n ' ;
fprintf ( stderr , " generating data (client-side)... \n " ) ;
/*
@ -3910,10 +3913,10 @@ initGenerateDataClientSide(PGconn *con)
elapsed_sec = INSTR_TIME_GET_DOUBLE ( diff ) ;
remaining_sec = ( ( double ) scale * naccounts - j ) * elapsed_sec / j ;
fprintf ( stderr , INT64_FORMAT " of " INT64_FORMAT " tuples (%d%%) done (elapsed %.2f s, remaining %.2f s) \n " ,
fprintf ( stderr , INT64_FORMAT " of " INT64_FORMAT " tuples (%d%%) done (elapsed %.2f s, remaining %.2f s)%c " ,
j , ( int64 ) naccounts * scale ,
( int ) ( ( ( int64 ) j * 100 ) / ( naccounts * ( int64 ) scale ) ) ,
elapsed_sec , remaining_sec ) ;
elapsed_sec , remaining_sec , eol ) ;
}
/* let's not call the timing for each row, but only each 100 rows */
else if ( use_quiet & & ( j % 100 = = 0 ) )
@ -3927,16 +3930,19 @@ initGenerateDataClientSide(PGconn *con)
/* have we reached the next interval (or end)? */
if ( ( j = = scale * naccounts ) | | ( elapsed_sec > = log_interval * LOG_STEP_SECONDS ) )
{
fprintf ( stderr , INT64_FORMAT " of " INT64_FORMAT " tuples (%d%%) done (elapsed %.2f s, remaining %.2f s) \n " ,
fprintf ( stderr , INT64_FORMAT " of " INT64_FORMAT " tuples (%d%%) done (elapsed %.2f s, remaining %.2f s)%c " ,
j , ( int64 ) naccounts * scale ,
( int ) ( ( ( int64 ) j * 100 ) / ( naccounts * ( int64 ) scale ) ) , elapsed_sec , remaining_sec ) ;
( int ) ( ( ( int64 ) j * 100 ) / ( naccounts * ( int64 ) scale ) ) , elapsed_sec , remaining_sec , eol ) ;
/* skip to the next interval */
log_interval = ( int ) ceil ( elapsed_sec / LOG_STEP_SECONDS ) ;
}
}
}
if ( eol ! = ' \n ' )
fputc ( ' \n ' , stderr ) ; /* Need to move to next line */
if ( PQputline ( con , " \\ . \n " ) )
{
fprintf ( stderr , " very last PQputline failed \n " ) ;