A PedTimer keeps track of the progress of a single (possibly compound) operation.
More...
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.
◆ PedTimer [1/2]
◆ PedTimer [2/2]
◆ PedTimerHandler [1/2]
typedef void PedTimerHandler(PedTimer *timer, void *context) |
◆ PedTimerHandler [2/2]
typedef void PedTimerHandler(PedTimer *timer, void *context) |
◆ ped_timer_destroy()
void ped_timer_destroy |
( |
PedTimer * |
timer | ) |
|
◆ ped_timer_destroy_nested()
void ped_timer_destroy_nested |
( |
PedTimer * |
timer | ) |
|
◆ ped_timer_new()
Creates a timer.
Context will be passed in the context
argument to the handler
, when it is invoked.
- Returns
- a new PedTimer
◆ ped_timer_new_nested()
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.
- Returns
- nested timer
◆ ped_timer_reset()
void ped_timer_reset |
( |
PedTimer * |
timer | ) |
|
◆ ped_timer_set_state_name()
void ped_timer_set_state_name |
( |
PedTimer * |
timer, |
|
|
const char * |
state_name |
|
) |
| |
◆ ped_timer_touch()
void ped_timer_touch |
( |
PedTimer * |
timer | ) |
|
◆ ped_timer_update()
void ped_timer_update |
( |
PedTimer * |
timer, |
|
|
float |
new_frac |
|
) |
| |