/** \ingroup rpmio
*/
+typedef struct rpmop_s * rpmop;
+
+/** \ingroup rpmio
+ */
struct rpmsw_s {
union {
struct timeval tv;
} u;
};
-#define RPMSW_SCALE (1000 * 1000)
+/** \ingroup rpmio
+ * Cumulative statistics for an operation.
+ */
+struct rpmop_s {
+ struct rpmsw_s begin; /*!< Starting time stamp. */
+ int count; /*!< Number of operations. */
+ size_t bytes; /*!< Number of bytes transferred. */
+ rpmtime_t usecs; /*!< Number of ticks. */
+};
#ifdef __cplusplus
extern "C" {
*/
/*@null@*/
rpmsw rpmswNow(/*@returned@*/ rpmsw sw)
- /*@modifies sw @*/;
+ /*@globals internalState @*/
+ /*@modifies sw, internalState @*/;
/** Return benchmark time stamp difference.
* @param *end end time stamp
* @return overhead in micro-seconds
*/
rpmtime_t rpmswInit(void)
- /*@*/;
+ /*@globals internalState @*/
+ /*@modifes internalState @*/;
+
+/** \ingroup rpmio
+ * Enter timed operation.
+ * @param op operation statistics
+ * @return 0 always
+ */
+int rpmswEnter(rpmop op)
+ /*@globals internalState @*/
+ /*@modifes op->count, op->begin, internalState @*/;
+
+/** \ingroup rpmio
+ * Exit timed operation.
+ * @param op operation statistics
+ * @param rc per-operation data (e.g. bytes transferred)
+ * @return 0 always
+ */
+int rpmswExit(rpmop op, ssize_t rc)
+ /*@globals internalState @*/
+ /*@modifes op-bytes, op->usecs, internalState @*/;
#ifdef __cplusplus
}