17 typedef unsigned long int rpmtime_t;
21 typedef struct rpmsw_s * rpmsw;
25 typedef struct rpmop_s * rpmop;
32 unsigned long long int ticks;
33 unsigned long int tocks[2];
38 * Cumulative statistics for an operation.
41 struct rpmsw_s begin; /*!< Starting time stamp. */
42 int count; /*!< Number of operations. */
43 size_t bytes; /*!< Number of bytes transferred. */
44 rpmtime_t usecs; /*!< Number of ticks. */
48 * Return benchmark time stamp.
49 * @param *sw time stamp
50 * @return 0 on success
52 rpmsw rpmswNow(rpmsw sw);
55 * Return benchmark time stamp difference.
56 * @param *end end time stamp
57 * @param *begin begin time stamp
58 * @return difference in micro-seconds
60 rpmtime_t rpmswDiff(rpmsw end, rpmsw begin);
63 * Return benchmark time stamp overhead.
64 * @return overhead in micro-seconds
66 rpmtime_t rpmswInit(void);
69 * Enter timed operation.
70 * @param op operation statistics
71 * @param rc -1 clears usec counter
74 int rpmswEnter(rpmop op, ssize_t rc);
77 * Exit timed operation.
78 * @param op operation statistics
79 * @param rc per-operation data (e.g. bytes transferred)
80 * @return cumulative usecs for operation
82 rpmtime_t rpmswExit(rpmop op, ssize_t rc);
85 * Sum statistic counters.
86 * @param to result statistics
87 * @param from operation statistics
88 * @return cumulative usecs for operation
90 rpmtime_t rpmswAdd(rpmop to, rpmop from);
93 * Subtract statistic counters.
94 * @param to result statistics
95 * @param from operation statistics
96 * @return cumulative usecs for operation
98 rpmtime_t rpmswSub(rpmop to, rpmop from);