libqb  1.0.3
Common Utilities

These are some convience functions used throughout libqb.

Author
Angus Salkeld asalk.nosp@m.eld@.nosp@m.redha.nosp@m.t.co.nosp@m.m
Locking
Time functions
Basic Stopwatch
uint64_t elapsed1;
uint64_t elapsed2;
usleep(sometime);
usleep(somemoretime);
void qb_util_stopwatch_start(qb_util_stopwatch_t *sw)
Start the stopwatch.
uint64_t qb_util_stopwatch_us_elapsed_get(qb_util_stopwatch_t *sw)
Get the elapsed time in micro seconds.
void qb_util_stopwatch_stop(qb_util_stopwatch_t *sw)
Stop the stopwatch.
struct qb_util_stopwatch qb_util_stopwatch_t
Definition: qbutil.h:198
qb_util_stopwatch_t * qb_util_stopwatch_create(void)
Create a Stopwatch (to time operations)
void qb_util_stopwatch_free(qb_util_stopwatch_t *sw)
Free the stopwatch.
Stopwatch with splits
Setup a stopwatch with space for 3 splits.
uint64_t split;
usleep(sometime);
usleep(somemoretime);
usleep(somemoretime);
do {
split = qb_util_stopwatch_time_split_get(sw, idx, idx);
qb_log(LOG_INFO, "split %d is %"PRIu64"", last, split);
idx--;
} while (split > 0);
qb_log(LOG_INFO, "time between second and third split is %"PRIu64"", split);
#define qb_log(priority, fmt, args...)
This is the main function to generate a log message.
Definition: qblog.h:501
uint32_t qb_util_stopwatch_split_last(qb_util_stopwatch_t *sw)
Get the last split index to be used by qb_util_stopwatch_time_split_get()
uint64_t qb_util_stopwatch_split(qb_util_stopwatch_t *sw)
Create a new time split (or lap time)
uint64_t qb_util_stopwatch_time_split_get(qb_util_stopwatch_t *sw, uint32_t receint, uint32_t older)
Read the time split (in us) from "receint" to "older".
int32_t qb_util_stopwatch_split_ctl(qb_util_stopwatch_t *sw, uint32_t max_splits, uint32_t options)
See also
qbutil.h