X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=bluesky%2Fstore.c;h=48a69b478097d2937e199a9d863e45243d81869b;hb=4db23448ce252728f10df967b55b2787d5fb8db5;hp=888bd1b07b490b6ae305377c2a8c8c1809c8ac9e;hpb=e560d8b120a5f2ed5057506f91bc8d9e818229a7;p=bluesky.git diff --git a/bluesky/store.c b/bluesky/store.c index 888bd1b..48a69b4 100644 --- a/bluesky/store.c +++ b/bluesky/store.c @@ -197,12 +197,15 @@ void bluesky_store_async_mark_complete(BlueSkyStoreAsync *async) g_return_if_fail(async->status != ASYNC_COMPLETE); bluesky_time_hires elapsed = bluesky_now_hires() - async->start_time; - - g_mutex_lock(async->store->lock); - async->store->pending--; - if (async->store->pending == 0) - g_cond_broadcast(async->store->cond_idle); - g_mutex_unlock(async->store->lock); + bluesky_time_hires latency = bluesky_now_hires() - async->exec_time; + + if (async->op != STORE_OP_BARRIER) { + g_mutex_lock(async->store->lock); + async->store->pending--; + if (async->store->pending == 0) + g_cond_broadcast(async->store->cond_idle); + g_mutex_unlock(async->store->lock); + } async->status = ASYNC_COMPLETE; g_cond_broadcast(async->completion_cond); @@ -217,8 +220,8 @@ void bluesky_store_async_mark_complete(BlueSkyStoreAsync *async) } g_log("bluesky/store", G_LOG_LEVEL_DEBUG, - "[%p] complete: elapsed = %"PRIi64" ns", - async, elapsed); + "[%p] complete: elapsed = %"PRIi64" ns, latency = %"PRIi64" ns", + async, elapsed, latency); } void bluesky_store_async_submit(BlueSkyStoreAsync *async) @@ -227,6 +230,10 @@ void bluesky_store_async_submit(BlueSkyStoreAsync *async) async->start_time = bluesky_now_hires(); + // Backends should fill this in with a better estimate of the actual time + // processing was started, if there could be a delay from submission time. + async->exec_time = bluesky_now_hires(); + g_log("bluesky/store", G_LOG_LEVEL_DEBUG, "[%p] submit: %s %s", async, async->op == STORE_OP_GET ? "GET" @@ -472,8 +479,8 @@ static BlueSkyStoreImplementation filestore_impl = { void bluesky_store_init() { store_implementations = g_hash_table_new(g_str_hash, g_str_equal); - notifier_thread_pool = g_thread_pool_new(notifier_task, NULL, -1, FALSE, - NULL); + notifier_thread_pool = g_thread_pool_new(notifier_task, NULL, + bluesky_max_threads, FALSE, NULL); bluesky_store_register(&memstore_impl, "mem"); bluesky_store_register(&filestore_impl, "file"); }