Splint clean.
[platform/upstream/rpm.git] / rpmio / rpmsw.h
1 #ifndef H_RPMSW
2 #define H_RPMSW
3
4 /** \ingroup rpmio
5  * \file rpmio/rpmsw.h
6  */
7
8 /** \ingroup rpmio
9  */
10 typedef unsigned long int rpmtime_t;
11
12 /** \ingroup rpmio
13  */
14 typedef struct rpmsw_s * rpmsw;
15
16 /** \ingroup rpmio
17  */
18 typedef struct rpmop_s * rpmop;
19
20 /** \ingroup rpmio
21  */
22 struct rpmsw_s {
23     union {
24         struct timeval tv;
25         unsigned long long int ticks;
26         unsigned long int tocks[2];
27     } u;
28 };
29
30 /** \ingroup rpmio
31  * Cumulative statistics for an operation.
32  */
33 struct rpmop_s {
34     struct rpmsw_s      begin;  /*!< Starting time stamp. */
35     int                 count;  /*!< Number of operations. */
36     size_t              bytes;  /*!< Number of bytes transferred. */
37     rpmtime_t           usecs;  /*!< Number of ticks. */
38 };
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 /** Return benchmark time stamp.
45  * @param *sw           time stamp
46  * @return              0 on success
47  */
48 /*@null@*/
49 rpmsw rpmswNow(/*@returned@*/ rpmsw sw)
50         /*@globals internalState @*/
51         /*@modifies sw, internalState @*/;
52
53 /** Return benchmark time stamp difference.
54  * @param *end          end time stamp
55  * @param *begin        begin time stamp
56  * @return              difference in micro-seconds
57  */
58 rpmtime_t rpmswDiff(/*@null@*/ rpmsw end, /*@null@*/ rpmsw begin)
59         /*@*/;
60
61 /** Return benchmark time stamp overhead.
62  * @return              overhead in micro-seconds
63  */
64 /*@-exportlocal@*/
65 rpmtime_t rpmswInit(void)
66         /*@globals internalState @*/
67         /*@modifes internalState @*/;
68 /*@=exportlocal@*/
69
70 /** \ingroup rpmio
71  * Enter timed operation.
72  * @param op                    operation statistics
73  * @return                      0 always
74  */
75 int rpmswEnter(rpmop op)
76         /*@globals internalState @*/
77         /*@modifes op->count, op->begin, internalState @*/;
78
79 /** \ingroup rpmio
80  * Exit timed operation.
81  * @param op                    operation statistics
82  * @param rc                    per-operation data (e.g. bytes transferred)
83  * @return                      0 always
84  */
85 int rpmswExit(rpmop op, ssize_t rc)
86         /*@globals internalState @*/
87         /*@modifes op-bytes, op->usecs, internalState @*/;
88
89 #ifdef __cplusplus
90 }
91 #endif
92
93 #endif  /* H_RPMIO_INTERNAL */