Revision 3bfe4dbf

b/qemu-common.h
341 341

  
342 342
void qemu_progress_init(int enabled, float min_skip);
343 343
void qemu_progress_end(void);
344
void qemu_progress_print(float percent, int max);
344
void qemu_progress_print(float delta, int max);
345 345

  
346 346
#define QEMU_FILE_TYPE_BIOS   0
347 347
#define QEMU_FILE_TYPE_KEYMAP 1
b/qemu-progress.c
96 96
    state.end = progress_dummy_end;
97 97
}
98 98

  
99
/*
100
 * Initialize progress reporting.
101
 * If @enabled is false, actual reporting is suppressed.  The user can
102
 * still trigger a report by sending a SIGUSR1.
103
 * Reports are also suppressed unless we've had at least @min_skip
104
 * percent progress since the last report.
105
 */
99 106
void qemu_progress_init(int enabled, float min_skip)
100 107
{
101 108
    state.min_skip = min_skip;
......
111 118
    state.end();
112 119
}
113 120

  
114
void qemu_progress_print(float percent, int max)
121
/*
122
 * Report progress.
123
 * @delta is how much progress we made.
124
 * If @max is zero, @delta is an absolut value of the total job done.
125
 * Else, @delta is a progress delta since the last call, as a fraction
126
 * of @max.  I.e. the delta is @delta * @max / 100. This allows
127
 * relative accounting of functions which may be a different fraction of
128
 * the full job, depending on the context they are called in. I.e.
129
 * a function might be considered 40% of the full job if used from
130
 * bdrv_img_create() but only 20% if called from img_convert().
131
 */
132
void qemu_progress_print(float delta, int max)
115 133
{
116 134
    float current;
117 135

  
118 136
    if (max == 0) {
119
        current = percent;
137
        current = delta;
120 138
    } else {
121
        current = state.current + percent / 100 * max;
139
        current = state.current + delta / 100 * max;
122 140
    }
123 141
    if (current > 100) {
124 142
        current = 100;

Also available in: Unified diff