projects
/
pazpar2-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
eac375e
)
Add total connections. Enable connection count for now.
author
Dennis Schafroth
<dennis@indexdata.com>
Mon, 28 Mar 2011 11:34:00 +0000
(13:34 +0200)
committer
Dennis Schafroth
<dennis@indexdata.com>
Mon, 28 Mar 2011 11:34:00 +0000
(13:34 +0200)
src/connection.c
patch
|
blob
|
history
diff --git
a/src/connection.c
b/src/connection.c
index
012d994
..
c4dfe72
100644
(file)
--- a/
src/connection.c
+++ b/
src/connection.c
@@
-48,22
+48,37
@@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "settings.h"
/* connection counting (1) , disable connection counting (0) */
#include "settings.h"
/* connection counting (1) , disable connection counting (0) */
-#if 0
+#if 1
static YAZ_MUTEX g_mutex = 0;
static int no_connections = 0;
static YAZ_MUTEX g_mutex = 0;
static int no_connections = 0;
-
+static int total_no_connections = 0;
static void connection_use(int delta)
{
static void connection_use(int delta)
{
+ int result;
if (!g_mutex)
yaz_mutex_create(&g_mutex);
yaz_mutex_enter(g_mutex);
no_connections += delta;
if (!g_mutex)
yaz_mutex_create(&g_mutex);
yaz_mutex_enter(g_mutex);
no_connections += delta;
+ result = no_connection;
+ if (delta > 0)
+ total_no_connections += delta;
yaz_mutex_leave(g_mutex);
yaz_mutex_leave(g_mutex);
+ if (delta == 0)
+ return result;
yaz_log(YLOG_LOG, "%s connections=%d", delta > 0 ? "INC" : "DEC",
no_connections);
yaz_log(YLOG_LOG, "%s connections=%d", delta > 0 ? "INC" : "DEC",
no_connections);
+ return result;
+}
+
+int connections_count() {
+ return connection_use(0);
}
}
+
+
#else
#define connection_use(x)
#else
#define connection_use(x)
+#define connections_count(x) 0
+#define connections_count_total(x) 0
#endif
#endif