19 typedef unsigned long int rpmtime_t;
23 typedef struct rpmsw_s * rpmsw;
27 typedef struct rpmop_s * rpmop;
34 unsigned long long int ticks;
35 unsigned long int tocks[2];
40 * Cumulative statistics for an operation.
43 struct rpmsw_s begin; /*!< Starting time stamp. */
44 int count; /*!< Number of operations. */
45 size_t bytes; /*!< Number of bytes transferred. */
46 rpmtime_t usecs; /*!< Number of ticks. */
50 * Return benchmark time stamp.
51 * @param *sw time stamp
52 * @return 0 on success
54 rpmsw rpmswNow(rpmsw sw);
57 * Return benchmark time stamp difference.
58 * @param *end end time stamp
59 * @param *begin begin time stamp
60 * @return difference in micro-seconds
62 rpmtime_t rpmswDiff(rpmsw end, rpmsw begin);
65 * Return benchmark time stamp overhead.
66 * @return overhead in micro-seconds
68 rpmtime_t rpmswInit(void);
71 * Enter timed operation.
72 * @param op operation statistics
73 * @param rc -1 clears usec counter
76 int rpmswEnter(rpmop op, ssize_t rc);
79 * Exit timed operation.
80 * @param op operation statistics
81 * @param rc per-operation data (e.g. bytes transferred)
82 * @return cumulative usecs for operation
84 rpmtime_t rpmswExit(rpmop op, ssize_t rc);
87 * Sum statistic counters.
88 * @param to result statistics
89 * @param from operation statistics
90 * @return cumulative usecs for operation
92 rpmtime_t rpmswAdd(rpmop to, rpmop from);
95 * Subtract statistic counters.
96 * @param to result statistics
97 * @param from operation statistics
98 * @return cumulative usecs for operation
100 rpmtime_t rpmswSub(rpmop to, rpmop from);