Add background thread related stats.

This commit is contained in:
Qi Wang 2017-05-12 12:30:33 -07:00 committed by Qi Wang
parent b693c7868e
commit 2bee0c6251
9 changed files with 214 additions and 21 deletions

View file

@ -55,6 +55,13 @@ nstime_add(nstime_t *time, const nstime_t *addend) {
time->ns += addend->ns;
}
void
nstime_iadd(nstime_t *time, uint64_t addend) {
assert(UINT64_MAX - time->ns >= addend);
time->ns += addend;
}
void
nstime_subtract(nstime_t *time, const nstime_t *subtrahend) {
assert(nstime_compare(time, subtrahend) >= 0);
@ -62,6 +69,13 @@ nstime_subtract(nstime_t *time, const nstime_t *subtrahend) {
time->ns -= subtrahend->ns;
}
void
nstime_isubtract(nstime_t *time, uint64_t subtrahend) {
assert(time->ns >= subtrahend);
time->ns -= subtrahend;
}
void
nstime_imultiply(nstime_t *time, uint64_t multiplier) {
assert((((time->ns | multiplier) & (UINT64_MAX << (sizeof(uint64_t) <<