@@ -34,7 +34,6 @@ struct progress {
3434 unsigned total ;
3535 unsigned last_percent ;
3636 unsigned delay ;
37- unsigned delayed_percent_threshold ;
3837 struct throughput * throughput ;
3938 uint64_t start_ns ;
4039};
@@ -83,20 +82,8 @@ static int display(struct progress *progress, unsigned n, const char *done)
8382{
8483 const char * eol , * tp ;
8584
86- if (progress -> delay ) {
87- if (!progress_update || -- progress -> delay )
88- return 0 ;
89- if (progress -> total ) {
90- unsigned percent = n * 100 / progress -> total ;
91- if (percent > progress -> delayed_percent_threshold ) {
92- /* inhibit this progress report entirely */
93- clear_progress_signal ();
94- progress -> delay = -1 ;
95- progress -> total = 0 ;
96- return 0 ;
97- }
98- }
99- }
85+ if (progress -> delay && (!progress_update || -- progress -> delay ))
86+ return 0 ;
10087
10188 progress -> last_value = n ;
10289 tp = (progress -> throughput ) ? progress -> throughput -> display .buf : "" ;
@@ -206,7 +193,7 @@ int display_progress(struct progress *progress, unsigned n)
206193}
207194
208195static struct progress * start_progress_delay (const char * title , unsigned total ,
209- unsigned percent_threshold , unsigned delay )
196+ unsigned delay )
210197{
211198 struct progress * progress = malloc (sizeof (* progress ));
212199 if (!progress ) {
@@ -219,7 +206,6 @@ static struct progress *start_progress_delay(const char *title, unsigned total,
219206 progress -> total = total ;
220207 progress -> last_value = -1 ;
221208 progress -> last_percent = -1 ;
222- progress -> delayed_percent_threshold = percent_threshold ;
223209 progress -> delay = delay ;
224210 progress -> throughput = NULL ;
225211 progress -> start_ns = getnanotime ();
@@ -229,12 +215,12 @@ static struct progress *start_progress_delay(const char *title, unsigned total,
229215
230216struct progress * start_delayed_progress (const char * title , unsigned total )
231217{
232- return start_progress_delay (title , total , 0 , 2 );
218+ return start_progress_delay (title , total , 2 );
233219}
234220
235221struct progress * start_progress (const char * title , unsigned total )
236222{
237- return start_progress_delay (title , total , 0 , 0 );
223+ return start_progress_delay (title , total , 0 );
238224}
239225
240226void stop_progress (struct progress * * p_progress )
0 commit comments