14 typedef unsigned long int rpmtime_t;
18 typedef struct rpmsw_s * rpmsw;
22 typedef struct rpmop_s * rpmop;
29 unsigned long long int ticks;
30 unsigned long int tocks[2];
35 * Cumulative statistics for an operation.
38 struct rpmsw_s begin; /*!< Starting time stamp. */
39 int count; /*!< Number of operations. */
40 size_t bytes; /*!< Number of bytes transferred. */
41 rpmtime_t usecs; /*!< Number of ticks. */
45 * Return benchmark time stamp.
46 * @param *sw time stamp
47 * @return 0 on success
49 rpmsw rpmswNow(rpmsw sw);
52 * Return benchmark time stamp difference.
53 * @param *end end time stamp
54 * @param *begin begin time stamp
55 * @return difference in micro-seconds
57 rpmtime_t rpmswDiff(rpmsw end, rpmsw begin);
60 * Return benchmark time stamp overhead.
61 * @return overhead in micro-seconds
63 rpmtime_t rpmswInit(void);
66 * Enter timed operation.
67 * @param op operation statistics
68 * @param rc -1 clears usec counter
71 int rpmswEnter(rpmop op, ssize_t rc);
74 * Exit timed operation.
75 * @param op operation statistics
76 * @param rc per-operation data (e.g. bytes transferred)
77 * @return cumulative usecs for operation
79 rpmtime_t rpmswExit(rpmop op, ssize_t rc);
82 * Sum statistic counters.
83 * @param to result statistics
84 * @param from operation statistics
85 * @return cumulative usecs for operation
87 rpmtime_t rpmswAdd(rpmop to, rpmop from);
90 * Subtract statistic counters.
91 * @param to result statistics
92 * @param from operation statistics
93 * @return cumulative usecs for operation
95 rpmtime_t rpmswSub(rpmop to, rpmop from);