]>
git.ipfire.org Git - people/stevee/pakfire.git/blob - tools/rpmsw.h
10 typedef unsigned long int rpmtime_t
;
14 typedef struct rpmsw_s
* rpmsw
;
18 typedef struct rpmop_s
* rpmop
;
25 unsigned long long int ticks
;
26 unsigned long int tocks
[2];
31 * Cumulative statistics for an operation.
34 struct rpmsw_s begin
; /*!< Starting time stamp. */
35 int count
; /*!< Number of operations. */
36 unsigned long long bytes
; /*!< Number of bytes transferred. */
37 rpmtime_t usecs
; /*!< Number of ticks. */
41 extern int _rpmsw_stats
;
44 * Indices for timestamps.
46 typedef enum rpmswOpX_e
{
50 RPMSW_OP_FINGERPRINT
= 3,
51 RPMSW_OP_REPACKAGE
= 4,
54 RPMSW_OP_SCRIPTLETS
= 7,
55 RPMSW_OP_COMPRESS
= 8,
56 RPMSW_OP_UNCOMPRESS
= 9,
58 RPMSW_OP_SIGNATURE
= 11,
60 RPMSW_OP_DBREMOVE
= 13,
64 RPMSW_OP_READHDR
= 17,
65 RPMSW_OP_HDRLOAD
= 18,
75 /** Return benchmark time stamp.
76 * @param *sw time stamp
77 * @return 0 on success
81 rpmsw
rpmswNow(/*@returned@*/ rpmsw sw
)
82 /*@globals internalState @*/
83 /*@modifies sw, internalState @*/;
86 /** Return benchmark time stamp difference.
87 * @param *end end time stamp
88 * @param *begin begin time stamp
89 * @return difference in micro-seconds
92 rpmtime_t
rpmswDiff(/*@null@*/ rpmsw end
, /*@null@*/ rpmsw begin
)
96 /** Return benchmark time stamp overhead.
97 * @return overhead in micro-seconds
100 rpmtime_t
rpmswInit(void)
101 /*@globals internalState @*/
102 /*@modifies internalState @*/;
106 * Enter timed operation.
107 * @param op operation statistics
108 * @param rc -1 clears usec counter
111 int rpmswEnter(/*@null@*/ rpmop op
, ssize_t rc
)
112 /*@globals internalState @*/
113 /*@modifies *op, internalState @*/;
116 * Exit timed operation.
117 * @param op operation statistics
118 * @param rc per-operation data (e.g. bytes transferred)
119 * @return cumulative usecs for operation
121 rpmtime_t
rpmswExit(/*@null@*/ rpmop op
, ssize_t rc
)
122 /*@globals internalState @*/
123 /*@modifies op, internalState @*/;
126 * Sum statistic counters.
127 * @param to result statistics
128 * @param from operation statistics
129 * @return cumulative usecs for operation
131 rpmtime_t
rpmswAdd(/*@null@*/ rpmop to
, /*@null@*/ rpmop from
)
135 * Subtract statistic counters.
136 * @param to result statistics
137 * @param from operation statistics
138 * @return cumulative usecs for operation
140 rpmtime_t
rpmswSub(rpmop to
, rpmop from
)
144 * Print operation statistics.
145 * @param name operation name
146 * @param op operation statistics
147 * @param fp file handle (NULL uses stderr)
149 void rpmswPrint(const char * name
, /*@null@*/ rpmop op
, /*@null@*/ FILE * fp
)
150 /*@globals fileSystem @*/
151 /*@modifies fp, fileSystem @*/;