[commit: ghc] master: LibdwPool: Use poolTryTake (1712a9e)
git at git.haskell.org
git at git.haskell.org
Thu Nov 26 14:11:42 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/1712a9ed333dfa2fc9ce7d55acab08a8d278fb5b/ghc
>---------------------------------------------------------------
commit 1712a9ed333dfa2fc9ce7d55acab08a8d278fb5b
Author: Ben Gamari <ben at smart-cactus.org>
Date: Thu Nov 26 12:02:47 2015 +0100
LibdwPool: Use poolTryTake
>---------------------------------------------------------------
1712a9ed333dfa2fc9ce7d55acab08a8d278fb5b
rts/LibdwPool.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/rts/LibdwPool.c b/rts/LibdwPool.c
index f625c0f..b0de8ac 100644
--- a/rts/LibdwPool.c
+++ b/rts/LibdwPool.c
@@ -16,6 +16,23 @@
#include "Pool.h"
+/*
+ * Note [libdw session pool]
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * Building a libdw session requires a number of rather expensive steps,
+ *
+ * - Examine the object files mapped into the address space
+ * - Find them on disk
+ * - Open them and map their debugging information
+ * - Build various index structures necessary for quick lookup
+ *
+ * The time to setup a session can be several milliseconds. In order to avoid
+ * incurring this cost too often, we keep a pool of warm sessions around which
+ * can be shared between capabilities.
+ *
+ */
+
static Pool *pool = NULL;
static nat pool_size = 10; // TODO
@@ -26,7 +43,7 @@ void libdwPoolInit(void) {
}
LibdwSession *libdwPoolTake(void) {
- return poolTake(pool);
+ return poolTryTake(pool);
}
void libdwPoolRelease(LibdwSession *sess) {
More information about the ghc-commits
mailing list