# Statistics API.

## Data Structures
struct | rpmsw_s
struct | rpmop_s
| Cumulative statistics for an operation. More...
## Typedefs
typedef unsigned long int | rpmtime_t
typedef struct rpmsw_s * | rpmsw
typedef struct rpmop_s * | rpmop
## Functions
rpmsw | rpmswNow (rpmsw sw)
| Return benchmark time stamp.
rpmtime_t | rpmswDiff (rpmsw end, rpmsw begin)
| Return benchmark time stamp difference.
rpmtime_t | rpmswInit (void)
| Return benchmark time stamp overhead.
int | rpmswEnter (rpmop op, ssize_t rc)
| Enter timed operation.
rpmtime_t | rpmswExit (rpmop op, ssize_t rc)
| Exit timed operation.
rpmtime_t | rpmswAdd (rpmop to, rpmop from)
| Sum statistic counters.
rpmtime_t | rpmswSub (rpmop to, rpmop from)
| Subtract statistic counters.

## Typedef Documentation

typedef struct rpmop_s* rpmop

Definition at line 25 of file rpmsw.h.

typedef struct rpmsw_s* rpmsw

Definition at line 21 of file rpmsw.h.

typedef unsigned long int rpmtime_t

Definition at line 17 of file rpmsw.h.

## Function Documentation

rpmtime_t rpmswAdd | ( | rpmop | to,
|  | rpmop | from |
| ) |  |  |

Sum statistic counters.

Parameters:

  | to | result statistics
  | from | operation statistics

Returns:
  cumulative usecs for operation

rpmtime_t rpmswDiff | ( | rpmsw | end,
|  | rpmsw | begin |
| ) |  |  |

Return benchmark time stamp difference.

Parameters:

  | *end | end time stamp
  | *begin | begin time stamp

Returns:
  difference in micro-seconds

int rpmswEnter | ( | rpmop | op,
|  | ssize_t | rc |
| ) |  |  |

Enter timed operation.

Parameters:

  | op | operation statistics
  | rc | -1 clears usec counter

Returns:
  0 always

rpmtime_t rpmswExit | ( | rpmop | op,
|  | ssize_t | rc |
| ) |  |  |

Exit timed operation.

Parameters:

  | op | operation statistics
  | rc | per-operation data (e.g. bytes transferred)

Returns:
  cumulative usecs for operation

rpmtime_t rpmswInit | ( | void |  | ) |

Return benchmark time stamp overhead.

Returns:
  overhead in micro-seconds

rpmsw rpmswNow | ( | rpmsw | sw | ) |

Return benchmark time stamp.

Parameters:

  | *sw | time stamp

Returns:
  0 on success

rpmtime_t rpmswSub | ( | rpmop | to,
|  | rpmop | from |
| ) |  |  |

Subtract statistic counters.

Parameters:

  | to | result statistics
  | from | operation statistics

Returns:
  cumulative usecs for operation