src/progress.c File Reference

#include <string.h>
#include <sys/time.h>
#include "rdd.h"
#include "rdd_internals.h"
#include "error.h"
#include "progress.h"

Include dependency graph for progress.c:

Go to the source code of this file.

Defines

#define INIT_POLL_BYTES   1048576

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.

Variables

static char copyright []


Define Documentation

#define INIT_POLL_BYTES   1048576

Definition at line 60 of file progress.c.


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.


Variable Documentation

char copyright[] [static]

Initial value:

"@(#) Copyright (c) 2002\n\
    Netherlands Forensic Institute.  All rights reserved.\n"

Definition at line 39 of file progress.c.


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