projects
/
bluesky.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix up reference counting for cloud log items.
[bluesky.git]
/
bluesky
/
store.c
diff --git
a/bluesky/store.c
b/bluesky/store.c
index
ae6bdb6
..
23e7047
100644
(file)
--- a/
bluesky/store.c
+++ b/
bluesky/store.c
@@
-24,6
+24,8
@@
struct _BlueSkyStore {
GMutex *lock;
GCond *cond_idle;
int pending; /* Count of operations not yet complete. */
GMutex *lock;
GCond *cond_idle;
int pending; /* Count of operations not yet complete. */
+
+ struct bluesky_stats *stats_get, *stats_put;
};
GHashTable *store_implementations;
};
GHashTable *store_implementations;
@@
-71,6
+73,10
@@
BlueSkyStore *bluesky_store_new(const gchar *type)
store->lock = g_mutex_new();
store->cond_idle = g_cond_new();
store->pending = 0;
store->lock = g_mutex_new();
store->cond_idle = g_cond_new();
store->pending = 0;
+ store->stats_get = bluesky_stats_new(g_strdup_printf("Store[%s]: GETS",
+ type));
+ store->stats_put = bluesky_stats_new(g_strdup_printf("Store[%s]: PUTS",
+ type));
g_free(scheme);
return store;
}
g_free(scheme);
return store;
}
@@
-224,6
+230,14
@@
void bluesky_store_async_mark_complete(BlueSkyStoreAsync *async)
"[%p] complete: elapsed = %"PRIi64" ns, latency = %"PRIi64" ns",
async, elapsed, latency);
}
"[%p] complete: elapsed = %"PRIi64" ns, latency = %"PRIi64" ns",
async, elapsed, latency);
}
+
+ if (async->data) {
+ if (async->op == STORE_OP_GET) {
+ bluesky_stats_add(async->store->stats_get, async->data->len);
+ } else if (async->op == STORE_OP_PUT) {
+ bluesky_stats_add(async->store->stats_put, async->data->len);
+ }
+ }
}
void bluesky_store_async_submit(BlueSkyStoreAsync *async)
}
void bluesky_store_async_submit(BlueSkyStoreAsync *async)
@@
-278,13
+292,15
@@
void bluesky_store_add_barrier(BlueSkyStoreAsync *barrier,
g_mutex_unlock(barrier->lock);
g_mutex_lock(async->lock);
g_mutex_unlock(barrier->lock);
g_mutex_lock(async->lock);
- if (async->barrier == NULL) {
+ if (async->barrier == NULL
&& async->status != ASYNC_COMPLETE
) {
async->barrier = barrier;
async->barrier = barrier;
+ g_mutex_unlock(async->lock);
} else {
} else {
- g_warning("Adding async to more than one barrier!\n");
+ if (async->barrier != NULL)
+ g_warning("Adding async to more than one barrier!\n");
+ g_mutex_unlock(async->lock);
bluesky_store_async_add_notifier(async, op_complete, barrier);
}
bluesky_store_async_add_notifier(async, op_complete, barrier);
}
- g_mutex_unlock(async->lock);
}
static void notifier_task(gpointer n, gpointer s)
}
static void notifier_task(gpointer n, gpointer s)