summaryrefslogtreecommitdiffstats
path: root/src/nstime.c
diff options
context:
space:
mode:
authorQi Wang <interwq@gwu.edu>2017-05-12 19:30:33 (GMT)
committerQi Wang <interwq@gmail.com>2017-05-23 19:26:20 (GMT)
commit2bee0c6251856f48ed6882df2f02a060c0a14829 (patch)
treeabca780861059dadb43e1c74b908e78d6d56d052 /src/nstime.c
parentb693c7868ea965407aca4cb01fdb8fe9af14adce (diff)
downloadjemalloc-2bee0c6251856f48ed6882df2f02a060c0a14829.zip
jemalloc-2bee0c6251856f48ed6882df2f02a060c0a14829.tar.gz
jemalloc-2bee0c6251856f48ed6882df2f02a060c0a14829.tar.bz2
Add background thread related stats.
Diffstat (limited to 'src/nstime.c')
-rw-r--r--src/nstime.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nstime.c b/src/nstime.c
index e541227..71db353 100644
--- a/src/nstime.c
+++ b/src/nstime.c
@@ -56,6 +56,13 @@ nstime_add(nstime_t *time, const nstime_t *addend) {
}
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);
@@ -63,6 +70,13 @@ nstime_subtract(nstime_t *time, const nstime_t *subtrahend) {
}
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) <<
2))) == 0) || ((time->ns * multiplier) / multiplier == time->ns));