@@ -34,7 +34,6 @@ struct progress {
34
34
unsigned total ;
35
35
unsigned last_percent ;
36
36
unsigned delay ;
37
- unsigned delayed_percent_threshold ;
38
37
struct throughput * throughput ;
39
38
uint64_t start_ns ;
40
39
};
@@ -83,20 +82,8 @@ static int display(struct progress *progress, unsigned n, const char *done)
83
82
{
84
83
const char * eol , * tp ;
85
84
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 ;
100
87
101
88
progress -> last_value = n ;
102
89
tp = (progress -> throughput ) ? progress -> throughput -> display .buf : "" ;
@@ -206,7 +193,7 @@ int display_progress(struct progress *progress, unsigned n)
206
193
}
207
194
208
195
static struct progress * start_progress_delay (const char * title , unsigned total ,
209
- unsigned percent_threshold , unsigned delay )
196
+ unsigned delay )
210
197
{
211
198
struct progress * progress = malloc (sizeof (* progress ));
212
199
if (!progress ) {
@@ -219,7 +206,6 @@ static struct progress *start_progress_delay(const char *title, unsigned total,
219
206
progress -> total = total ;
220
207
progress -> last_value = -1 ;
221
208
progress -> last_percent = -1 ;
222
- progress -> delayed_percent_threshold = percent_threshold ;
223
209
progress -> delay = delay ;
224
210
progress -> throughput = NULL ;
225
211
progress -> start_ns = getnanotime ();
@@ -229,12 +215,12 @@ static struct progress *start_progress_delay(const char *title, unsigned total,
229
215
230
216
struct progress * start_delayed_progress (const char * title , unsigned total )
231
217
{
232
- return start_progress_delay (title , total , 0 , 2 );
218
+ return start_progress_delay (title , total , 2 );
233
219
}
234
220
235
221
struct progress * start_progress (const char * title , unsigned total )
236
222
{
237
- return start_progress_delay (title , total , 0 , 0 );
223
+ return start_progress_delay (title , total , 0 );
238
224
}
239
225
240
226
void stop_progress (struct progress * * p_progress )
0 commit comments