Loading...
Searching...
No Matches
PedTimer

## Files

file | timer.h

## Data Structures

struct | _PedTimer

## Typedefs

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

## Functions

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 new_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.

## Typedef Documentation

## PedTimer [1/2]

typedef struct _PedTimer PedTimer

## PedTimer [2/2]

typedef struct _PedTimer PedTimer

## PedTimerHandler [1/2]

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

## PedTimerHandler [2/2]

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

## Function Documentation

## ped_timer_destroy()

void ped_timer_destroy | ( | PedTimer * | timer | ) |

extern

Destroys a `timer`.

## ped_timer_destroy_nested()

void ped_timer_destroy_nested | ( | PedTimer * | timer | ) |

extern

Destroys a nested `timer`.

## ped_timer_new()

PedTimer * ped_timer_new | ( | PedTimerHandler * | handler,
|  | void * | context )

extern

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()

PedTimer * ped_timer_new_nested | ( | PedTimer * | parent,
|  | float | nest_frac )

extern

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 | ) |

extern

## ped_timer_set_state_name()

void ped_timer_set_state_name | ( | PedTimer * | timer,
|  | const char * | state_name )

extern

## ped_timer_touch()

void ped_timer_touch | ( | PedTimer * | timer | ) |

extern

## ped_timer_update()

void ped_timer_update | ( | PedTimer * | timer,
|  | float | new_frac )

extern