Definition in file progress.h.
Go to the source code of this file.
Data Structures | |
struct | _RDD_PROGRESS |
struct | _RDD_PROGRESS_INFO |
Typedefs | |
typedef struct _RDD_PROGRESS | RDD_PROGRESS |
typedef struct _RDD_PROGRESS_INFO | RDD_PROGRESS_INFO |
Functions | |
int | rdd_progress_init (RDD_PROGRESS *p, rdd_count_t size, unsigned secs) |
Initializes a progress object. | |
int | rdd_progress_poll (RDD_PROGRESS *p, RDD_PROGRESS_INFO *info) |
Obtains progress information from a progress object. | |
int | rdd_progress_update (RDD_PROGRESS *p, rdd_count_t pos, rdd_count_t nsubst) |
Tells the progress object how much data has been copied so far. |
typedef struct _RDD_PROGRESS RDD_PROGRESS |
typedef struct _RDD_PROGRESS_INFO RDD_PROGRESS_INFO |
int rdd_progress_init | ( | RDD_PROGRESS * | p, | |
rdd_count_t | size, | |||
unsigned | secs | |||
) |
Initializes a progress object.
p | a pointer to the progress object (allocated by the client). | |
size | the number of bytes to be copied (or RDD_WHOLE_FILE). | |
secs | the progress update interval in seconds. |
Definition at line 63 of file progress.c.
References _RDD_PROGRESS::curpos, INIT_POLL_BYTES, _RDD_PROGRESS::input_size, _RDD_PROGRESS::last_pos, _RDD_PROGRESS::last_time, _RDD_PROGRESS::nsubst, _RDD_PROGRESS::period, _RDD_PROGRESS::poll_delta, rdd_gettime(), RDD_OK, and _RDD_PROGRESS::start_time.
int rdd_progress_poll | ( | RDD_PROGRESS * | p, | |
RDD_PROGRESS_INFO * | info | |||
) |
Obtains progress information from a progress object.
p | a pointer to the progress object. | |
info | a pointer to the progress information |
rdd_progress_update()
returns RDD_OK
then *info
will contain new progress information. Field info->pos
will be set to the last position passed to rdd_progress_update()
. Field info->speed
will be set to the average copying speed in bytes per second. The value of info->fraction
(the fraction of work completed) can be computed only if the input size is known. If RDD_WHOLE_FILE
was passed to rdd_progress_init()
as the input size then info->fraction
will invalid and will be set to a negative number.
Definition at line 88 of file progress.c.
References _RDD_PROGRESS::curpos, _RDD_PROGRESS_INFO::fraction, _RDD_PROGRESS::input_size, _RDD_PROGRESS::last_pos, _RDD_PROGRESS::last_time, _RDD_PROGRESS::nsubst, _RDD_PROGRESS_INFO::nsubst, _RDD_PROGRESS::period, _RDD_PROGRESS::poll_delta, _RDD_PROGRESS_INFO::pos, RDD_EAGAIN, rdd_gettime(), RDD_OK, RDD_WHOLE_FILE, _RDD_PROGRESS_INFO::speed, and _RDD_PROGRESS::start_time.
int rdd_progress_update | ( | RDD_PROGRESS * | p, | |
rdd_count_t | pos, | |||
rdd_count_t | nsubst | |||
) |
Tells the progress object how much data has been copied so far.
p | a pointer to the progress object. | |
pos | the current position in the input stream (in bytes). |
rdd_progress_update
should pass monotonically nondecreasing pos
values.
Definition at line 80 of file progress.c.
References _RDD_PROGRESS::curpos, _RDD_PROGRESS::nsubst, and RDD_OK.