patch-docs_man3_qbutil_h_3 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. --- libqb-0.16.0.orig/docs/man3/qbutil.h.3 2013-07-25 20:16:18.000000000 +0200
  2. +++ libqb-0.16.0/docs/man3/qbutil.h.3 2013-09-09 05:26:31.891805285 +0200
  3. @@ -1,4 +1,4 @@
  4. -.TH "qbutil.h" 3 "Thu Jul 25 2013" "Version 0.16.0" "libqb" \" -*- nroff -*-
  5. +.TH "qbutil.h" 3 "Mon Sep 9 2013" "Version 0.16.0" "libqb" \" -*- nroff -*-
  6. .ad l
  7. .nh
  8. .SH NAME
  9. @@ -15,7 +15,7 @@ qbutil.h \-
  10. \fC#include <qb/qbdefs\&.h>\fP
  11. .br
  12. -.SS "Macros"
  13. +.SS "Defines"
  14. .in +1c
  15. .ti -1c
  16. @@ -138,7 +138,7 @@ qbutil.h \-
  17. .PP
  18. \fBAuthor:\fP
  19. .RS 4
  20. -Angus Salkeld asalkeld@redhat.com
  21. +Angus Salkeld <asalkeld@redhat.com>
  22. .RE
  23. .PP
  24. These are some convience functions used throughout libqb\&.
  25. @@ -180,21 +180,21 @@ These are some convience functions used
  26. .PP
  27. .nf
  28. -uint64_t elapsed1;
  29. -uint64_t elapsed2;
  30. -qb_util_stopwatch_t *sw = qb_util_stopwatch_create();
  31. + uint64_t elapsed1;
  32. + uint64_t elapsed2;
  33. + qb_util_stopwatch_t *sw = qb_util_stopwatch_create();
  34. -qb_util_stopwatch_start(sw);
  35. + qb_util_stopwatch_start(sw);
  36. -usleep(sometime);
  37. -qb_util_stopwatch_stop(sw);
  38. -elapsed1 = qb_util_stopwatch_us_elapsed_get(sw);
  39. + usleep(sometime);
  40. + qb_util_stopwatch_stop(sw);
  41. + elapsed1 = qb_util_stopwatch_us_elapsed_get(sw);
  42. -usleep(somemoretime);
  43. -qb_util_stopwatch_stop(sw);
  44. -elapsed2 = qb_util_stopwatch_us_elapsed_get(sw);
  45. + usleep(somemoretime);
  46. + qb_util_stopwatch_stop(sw);
  47. + elapsed2 = qb_util_stopwatch_us_elapsed_get(sw);
  48. -qb_util_stopwatch_free(sw);
  49. + qb_util_stopwatch_free(sw);
  50. .fi
  51. .PP
  52. @@ -207,72 +207,65 @@ Setup a stopwatch with space for 3 split
  53. .PP
  54. .PP
  55. .nf
  56. -uint64_t split;
  57. -qb_util_stopwatch_t *sw = qb_util_stopwatch_create();
  58. + uint64_t split;
  59. + qb_util_stopwatch_t *sw = qb_util_stopwatch_create();
  60. -qb_util_stopwatch_split_ctl(sw, 3, 0);
  61. -qb_util_stopwatch_start(sw);
  62. + qb_util_stopwatch_split_ctl(sw, 3, 0);
  63. + qb_util_stopwatch_start(sw);
  64. -usleep(sometime);
  65. -qb_util_stopwatch_split(sw);
  66. + usleep(sometime);
  67. + qb_util_stopwatch_split(sw);
  68. -usleep(somemoretime);
  69. -qb_util_stopwatch_split(sw);
  70. + usleep(somemoretime);
  71. + qb_util_stopwatch_split(sw);
  72. -usleep(somemoretime);
  73. -qb_util_stopwatch_split(sw);
  74. + usleep(somemoretime);
  75. + qb_util_stopwatch_split(sw);
  76. -idx = qb_util_stopwatch_split_last(sw);
  77. -do {
  78. - split = qb_util_stopwatch_time_split_get(sw, idx, idx);
  79. - qb_log(LOG_INFO, 'split %d is %'PRIu64'', last, split);
  80. - idx--;
  81. -} while (split > 0);
  82. + idx = qb_util_stopwatch_split_last(sw);
  83. + do {
  84. + split = qb_util_stopwatch_time_split_get(sw, idx, idx);
  85. + qb_log(LOG_INFO, 'split %d is %'PRIu64'', last, split);
  86. + idx--;
  87. + } while (split > 0);
  88. -split = qb_util_stopwatch_time_split_get(sw, 2, 1);
  89. -qb_log(LOG_INFO, 'time between second and third split is %'PRIu64'', split);
  90. + split = qb_util_stopwatch_time_split_get(sw, 2, 1);
  91. + qb_log(LOG_INFO, 'time between second and third split is %'PRIu64'', split);
  92. -qb_util_stopwatch_free(sw);
  93. + qb_util_stopwatch_free(sw);
  94. .fi
  95. .PP
  96. -.SH "Macro Definition Documentation"
  97. +.SH "Define Documentation"
  98. .PP
  99. -.SS "#define QB_UTIL_SW_OVERWRITE 0x01"
  100. -
  101. +.SS "#define \fBQB_UTIL_SW_OVERWRITE\fP 0x01"
  102. .SH "Typedef Documentation"
  103. .PP
  104. .SS "typedef struct qb_thread_lock_s \fBqb_thread_lock_t\fP"
  105. -
  106. -.SS "typedef void(* qb_util_log_fn_t)(const char *file_name, int32_t file_line, int32_t severity, const char *msg)"
  107. -
  108. +.SS "typedef void(* \fBqb_util_log_fn_t\fP)(const char *file_name, int32_t file_line, int32_t severity, const char *msg)"
  109. .SS "typedef struct qb_util_stopwatch \fBqb_util_stopwatch_t\fP"
  110. -
  111. .SH "Enumeration Type Documentation"
  112. .PP
  113. .SS "enum \fBqb_thread_lock_type_t\fP"
  114. -
  115. .PP
  116. QB_THREAD_LOCK_SHORT is a short term lock (spinlock if available on your system) QB_THREAD_LOCK_LONG is a mutex\&.
  117. .PP
  118. -\fBEnumerator\fP
  119. +\fBEnumerator: \fP
  120. .in +1c
  121. .TP
  122. \fB\fIQB_THREAD_LOCK_SHORT \fP\fP
  123. .TP
  124. \fB\fIQB_THREAD_LOCK_LONG \fP\fP
  125. +
  126. .SH "Function Documentation"
  127. .PP
  128. -.SS "char* qb_strerror_r (interrnum, char *buf, size_tbuflen)"
  129. -
  130. +.SS "char* \fBqb_strerror_r\fP (interrnum, char *buf, size_tbuflen)"
  131. .PP
  132. strerror_r replacement\&.
  133. -.SS "int32_t qb_thread_lock (\fBqb_thread_lock_t\fP *tl)"
  134. -
  135. +.SS "int32_t \fBqb_thread_lock\fP (\fBqb_thread_lock_t\fP *tl)"
  136. .PP
  137. Calls either pthread_mutex_lock() or pthread_spin_lock()\&.
  138. -.SS "\fBqb_thread_lock_t\fP* qb_thread_lock_create (\fBqb_thread_lock_type_t\fPtype)"
  139. -
  140. +.SS "\fBqb_thread_lock_t\fP* \fBqb_thread_lock_create\fP (\fBqb_thread_lock_type_t\fPtype)"
  141. .PP
  142. Create a new lock of the given type\&. \fBParameters:\fP
  143. .RS 4
  144. @@ -285,20 +278,16 @@ pointer to qb_thread_lock_type_t or NULL
  145. .RE
  146. .PP
  147. -.SS "int32_t qb_thread_lock_destroy (\fBqb_thread_lock_t\fP *tl)"
  148. -
  149. +.SS "int32_t \fBqb_thread_lock_destroy\fP (\fBqb_thread_lock_t\fP *tl)"
  150. .PP
  151. Calls either pthread_mutex_destro() or pthread_spin_destroy()\&.
  152. -.SS "int32_t qb_thread_trylock (\fBqb_thread_lock_t\fP *tl)"
  153. -
  154. +.SS "int32_t \fBqb_thread_trylock\fP (\fBqb_thread_lock_t\fP *tl)"
  155. .PP
  156. Calls either pthread_mutex_trylock() or pthread_spin_trylock()\&.
  157. -.SS "int32_t qb_thread_unlock (\fBqb_thread_lock_t\fP *tl)"
  158. -
  159. +.SS "int32_t \fBqb_thread_unlock\fP (\fBqb_thread_lock_t\fP *tl)"
  160. .PP
  161. Calls either pthread_mutex_unlock() or pthread_spin_unlock\&.
  162. -.SS "void qb_timespec_add_ms (struct timespec *ts, int32_tms)"
  163. -
  164. +.SS "void \fBqb_timespec_add_ms\fP (struct timespec *ts, int32_tms)"
  165. .PP
  166. Add milliseconds onto the timespec\&. \fBParameters:\fP
  167. .RS 4
  168. @@ -308,36 +297,28 @@ Add milliseconds onto the timespec\&. \f
  169. .RE
  170. .PP
  171. -.SS "uint64_t qb_util_nano_current_get (void)"
  172. -
  173. +.SS "uint64_t \fBqb_util_nano_current_get\fP (void)"
  174. .PP
  175. Get the current number of nano secounds produced by the systems incrementing clock (CLOCK_MONOTOMIC if available)\&.
  176. -.SS "uint64_t qb_util_nano_from_epoch_get (void)"
  177. -
  178. +.SS "uint64_t \fBqb_util_nano_from_epoch_get\fP (void)"
  179. .PP
  180. Get the time in nano seconds since epoch\&.
  181. -.SS "uint64_t qb_util_nano_monotonic_hz (void)"
  182. -
  183. +.SS "uint64_t \fBqb_util_nano_monotonic_hz\fP (void)"
  184. .PP
  185. Get the frequence of the clock used in \fBqb_util_nano_current_get()\fP\&.
  186. -.SS "void qb_util_set_log_function (\fBqb_util_log_fn_t\fPfn)"
  187. -
  188. +.SS "void \fBqb_util_set_log_function\fP (\fBqb_util_log_fn_t\fPfn)"
  189. .PP
  190. Use this function to output libqb internal log message as you wish\&.
  191. -.SS "\fBqb_util_stopwatch_t\fP* qb_util_stopwatch_create (void)"
  192. -
  193. +.SS "\fBqb_util_stopwatch_t\fP* \fBqb_util_stopwatch_create\fP (void)"
  194. .PP
  195. Create a Stopwatch (to time operations)
  196. -.SS "void qb_util_stopwatch_free (\fBqb_util_stopwatch_t\fP *sw)"
  197. -
  198. +.SS "void \fBqb_util_stopwatch_free\fP (\fBqb_util_stopwatch_t\fP *sw)"
  199. .PP
  200. Free the stopwatch\&.
  201. -.SS "float qb_util_stopwatch_sec_elapsed_get (\fBqb_util_stopwatch_t\fP *sw)"
  202. -
  203. +.SS "float \fBqb_util_stopwatch_sec_elapsed_get\fP (\fBqb_util_stopwatch_t\fP *sw)"
  204. .PP
  205. Get the elapsed time in seconds\&. (it must have been started and stopped)\&.
  206. -.SS "uint64_t qb_util_stopwatch_split (\fBqb_util_stopwatch_t\fP *sw)"
  207. -
  208. +.SS "uint64_t \fBqb_util_stopwatch_split\fP (\fBqb_util_stopwatch_t\fP *sw)"
  209. .PP
  210. Create a new time split (or lap time) \fBParameters:\fP
  211. .RS 4
  212. @@ -352,8 +333,7 @@ Create a new time split (or lap time) \f
  213. .RE
  214. .PP
  215. -.SS "int32_t qb_util_stopwatch_split_ctl (\fBqb_util_stopwatch_t\fP *sw, uint32_tmax_splits, uint32_toptions)"
  216. -\fBParameters:\fP
  217. +.SS "int32_t \fBqb_util_stopwatch_split_ctl\fP (\fBqb_util_stopwatch_t\fP *sw, uint32_tmax_splits, uint32_toptions)"\fBParameters:\fP
  218. .RS 4
  219. \fIsw\fP the stopwatch
  220. .br
  221. @@ -370,8 +350,7 @@ Create a new time split (or lap time) \f
  222. .RE
  223. .PP
  224. -.SS "uint32_t qb_util_stopwatch_split_last (\fBqb_util_stopwatch_t\fP *sw)"
  225. -
  226. +.SS "uint32_t \fBqb_util_stopwatch_split_last\fP (\fBqb_util_stopwatch_t\fP *sw)"
  227. .PP
  228. Get the last split index to be used by \fBqb_util_stopwatch_time_split_get()\fP \fBNote:\fP
  229. .RS 4
  230. @@ -389,16 +368,13 @@ the last entry index
  231. .RE
  232. .PP
  233. -.SS "void qb_util_stopwatch_start (\fBqb_util_stopwatch_t\fP *sw)"
  234. -
  235. +.SS "void \fBqb_util_stopwatch_start\fP (\fBqb_util_stopwatch_t\fP *sw)"
  236. .PP
  237. Start the stopwatch\&. This also acts as a reset\&. Essentially it sets the starting time and clears the splits\&.
  238. -.SS "void qb_util_stopwatch_stop (\fBqb_util_stopwatch_t\fP *sw)"
  239. -
  240. +.SS "void \fBqb_util_stopwatch_stop\fP (\fBqb_util_stopwatch_t\fP *sw)"
  241. .PP
  242. Stop the stopwatch\&. This just allows you to get the elapsed time\&. So you can call this multiple times\&. Do not call \fBqb_util_stopwatch_start()\fP unless you want to reset the stopwatch\&.
  243. -.SS "uint64_t qb_util_stopwatch_time_split_get (\fBqb_util_stopwatch_t\fP *sw, uint32_treceint, uint32_tolder)"
  244. -
  245. +.SS "uint64_t \fBqb_util_stopwatch_time_split_get\fP (\fBqb_util_stopwatch_t\fP *sw, uint32_treceint, uint32_tolder)"
  246. .PP
  247. Read the time split (in us) from 'receint' to 'older'\&. If older == receint then the cumulated split will be returned (from the stopwatch start)\&.
  248. .PP
  249. @@ -419,12 +395,10 @@ Read the time split (in us) from 'recein
  250. .RE
  251. .PP
  252. -.SS "uint64_t qb_util_stopwatch_us_elapsed_get (\fBqb_util_stopwatch_t\fP *sw)"
  253. -
  254. +.SS "uint64_t \fBqb_util_stopwatch_us_elapsed_get\fP (\fBqb_util_stopwatch_t\fP *sw)"
  255. .PP
  256. Get the elapsed time in micro seconds\&. (it must have been started and stopped)\&.
  257. -.SS "void qb_util_timespec_from_epoch_get (struct timespec *ts)"
  258. -
  259. +.SS "void \fBqb_util_timespec_from_epoch_get\fP (struct timespec *ts)"
  260. .PP
  261. Get the time in timespec since epoch\&. \fBParameters:\fP
  262. .RS 4