A PedTimer keeps track of the progress of a single (possibly compound) operation. More...


file  timer.h

Data Structures

struct  _PedTimer




typedef _PedTimer PedTimer
typedef void PedTimerHandler (PedTimer *timer, void *context)


void ped_timer_destroy (PedTimer *timer)
 Destroys a timer.
void ped_timer_destroy_nested (PedTimer *timer)
 Destroys a nested timer.
PedTimer * ped_timer_new (PedTimerHandler *handler, void *context)
 Creates a timer.
PedTimer * ped_timer_new_nested (PedTimer *parent, float nest_frac)
 Creates a new nested timer.
void ped_timer_reset (PedTimer *timer)
void ped_timer_set_state_name (PedTimer *timer, const char *state_name)
void ped_timer_touch (PedTimer *timer)
void ped_timer_update (PedTimer *timer, float frac)

Detailed Description

A PedTimer keeps track of the progress of a single (possibly compound) operation.

The user of libparted constructs a PedTimer, and passes it to libparted functions that are likely to be expensive operations (like ped_file_system_resize). Use of timers is optional... you may pass NULL instead.

When you create a PedTimer, you must specify a timer handler function. This will be called when there's an update on how work is progressing.

Timers may be nested. When a timer is constructed, you can choose to assign it a parent, along with an estimate of what proportion of the total (parent's) time will be used in the nested operation. In this case, the nested timer's handler is internal to libparted, and simply updates the parent's progress, and calls its handler.

Function Documentation

PedTimer * ped_timer_new ( PedTimerHandler *  handler,
void *  context 

Creates a timer.

Context will be passed in the context argument to the handler, when it is invoked.

a new PedTimer

PedTimer * ped_timer_new_nested ( PedTimer *  parent,
float  nest_frac 

Creates a new nested timer.

This function creates a "nested" timer that describes the progress of a subtask. parent is the parent timer, and nested_frac is the estimated proportion (between 0 and 1) of the time that will be spent doing the nested timer's operation. The timer should only be constructed immediately prior to starting the nested operation. (It will be inaccurate, otherwise). Updates to the progress of the subtask are propagated back through to the parent task's timer.

nested timer

Generated on Fri May 4 05:15:31 2007 for libparted by  doxygen 1.5.2