src/progress.h File Reference


Detailed Description

Progress class; used to track copy speed and progres.

Definition in file progress.h.

This graph shows which files directly or indirectly include this file:

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 Documentation

typedef struct _RDD_PROGRESS RDD_PROGRESS


Function Documentation

int rdd_progress_init ( RDD_PROGRESS p,
rdd_count_t  size,
unsigned  secs 
)

Initializes a progress object.

Parameters:
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.
Returns:
Returns RDD_OK on success.

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.

Here is the call graph for this function:

int rdd_progress_poll ( RDD_PROGRESS p,
RDD_PROGRESS_INFO info 
)

Obtains progress information from a progress object.

Parameters:
p a pointer to the progress object.
info a pointer to the progress information
Returns:
Returns RDD_OK on success. Returns RDD_EAGAIN if no new progress information is available; new information is made available at approximately the rate specified by the user's update interval.
If 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.

Here is the call graph for this function:

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.

Parameters:
p a pointer to the progress object.
pos the current position in the input stream (in bytes).
Returns:
Returns RDD_OK on success.
Successive calls to 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.


Generated on Sun Feb 6 12:36:21 2011 for rdd by  doxygen 1.5.6