]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add cumulative count of sessions from switch startup. Resolves http://jira.freeswitc...
authorMichael Jerris <mike@jerris.com>
Sun, 22 Apr 2007 01:25:02 +0000 (01:25 +0000)
committerMichael Jerris <mike@jerris.com>
Sun, 22 Apr 2007 01:25:02 +0000 (01:25 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4999 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/private/switch_core.h
src/include/switch_core.h
src/mod/applications/mod_commands/mod_commands.c
src/switch_core_session.c

index 162c5297aaa41972ea2f036ade232361557ffd1f..721c4789dd09a9f6ec1c906e28571197d23eebaa 100644 (file)
@@ -83,7 +83,7 @@ typedef enum {
 
 
 struct switch_core_session {
-       uint32_t id;
+       switch_size_t id;
        char name[80];
        switch_session_flag_t flags;
        int thread_running;
index bb3cedaedf090a2f15e3e8917270afa048515f6d..b83adbd9a391e60575226b73679ac1ab2b19f85d 100644 (file)
@@ -441,6 +441,12 @@ SWITCH_DECLARE(void) switch_core_session_destroy(switch_core_session_t **session
 */
 SWITCH_DECLARE(uint32_t) switch_core_session_count(void);
 
+/*! 
+  \brief Provide the current session_id
+  \return the total number of allocated sessions since core startup
+*/
+SWITCH_DECLARE(switch_size_t) switch_core_session_id(void);
+
 /*! 
   \brief Allocate and return a new session from the core based on a given endpoint module name
   \param endpoint_name the name of the endpoint module
index 0e1217288e61cdd2091397e2b6be71bf05a33787..f40d4751bb3110dccef6da814b4860ac84f6bb04 100644 (file)
@@ -84,6 +84,7 @@ static switch_status_t status_function(char *cmd, switch_core_session_t *session
                                                   duration.sec, duration.sec == 1 ? "" : "s", duration.ms, duration.ms == 1 ? "" : "s", duration.mms,
                                                   duration.mms == 1 ? "" : "s");
 
+       stream->write_function(stream, "%"SWITCH_SIZE_T_FMT" sessions since startup\n", switch_core_session_id() - 1 );
        stream->write_function(stream, "%d sessions\n", switch_core_session_count());
 
        if (html) {
index 43226eedc83127ff81bce16a54ad3c83a85c7a51..0e7d62e9c62631afcc3a51623eccb68b49fa1656 100644 (file)
@@ -40,7 +40,7 @@ static struct {
        switch_mutex_t *session_table_mutex;
        uint32_t session_count;
        uint32_t session_limit;
-       uint32_t session_id;
+       switch_size_t session_id;
 } runtime;
 
 
@@ -820,6 +820,12 @@ SWITCH_DECLARE(uint32_t) switch_core_session_count(void)
        return runtime.session_count;
 }
 
+SWITCH_DECLARE(switch_size_t) switch_core_session_id(void)
+{
+       return runtime.session_id;
+}
+
+
 SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(char *endpoint_name, switch_memory_pool_t **pool)
 {
        const switch_endpoint_interface_t *endpoint_interface;