[Freeswitch-svn] [commit] r5793 - in freeswitch/trunk/src: . include mod/applications/mod_commands

Freeswitch SVN anthm at freeswitch.org
Thu Oct 4 10:19:51 EDT 2007


Author: anthm
Date: Thu Oct  4 10:19:51 2007
New Revision: 5793

Modified:
   freeswitch/trunk/src/include/switch_types.h
   freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
   freeswitch/trunk/src/switch_core.c

Log:
add adjustable log level and sps via fsctl

Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h	(original)
+++ freeswitch/trunk/src/include/switch_types.h	Thu Oct  4 10:19:51 2007
@@ -1008,7 +1008,8 @@
 	SCSC_HUPALL,
 	SCSC_SHUTDOWN,
 	SCSC_CHECK_RUNNING,
-	SCSC_LOGLEVEL
+	SCSC_LOGLEVEL,
+	SCSC_SPS
 } switch_session_ctl_t;
 
 typedef struct apr_pool_t switch_memory_pool_t;

Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	Thu Oct  4 10:19:51 2007
@@ -127,7 +127,15 @@
 				arg = -1;
 			}
 			switch_core_session_ctl(SCSC_LOGLEVEL, &arg);
-			stream->write_function(stream, "log level %s [%d]\n", switch_log_level2str(arg), arg);
+			stream->write_function(stream, "log level: %s [%d]\n", switch_log_level2str(arg), arg);
+		} else if (!strcasecmp(argv[0], "sps")) {
+			if (argc > 1) {
+				arg = atoi(argv[1]);
+			} else {
+				arg = 0;
+			}
+			switch_core_session_ctl(SCSC_SPS, &arg);
+			stream->write_function(stream, "sessions per second: %d\n", arg);
 		} else {
 			stream->write_function(stream, "INVALID COMMAND\nUSAGE: fsctl [hupall|pause|resume|shutdown]\n");
 			goto end;

Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c	(original)
+++ freeswitch/trunk/src/switch_core.c	Thu Oct  4 10:19:51 2007
@@ -648,16 +648,22 @@
 		break;
 	case SCSC_LOGLEVEL:
 		if (*val > -1) {
-			printf("WTF %d\n", *val);
 			runtime.hard_log_level = *val;
 		}
 
 		if (runtime.hard_log_level > SWITCH_LOG_CONSOLE) {
-			printf("WTF %d\n", *val);
 			runtime.hard_log_level = SWITCH_LOG_CONSOLE;
 		}
 		*val = runtime.hard_log_level;
 		break;
+	case SCSC_SPS:
+		switch_mutex_lock(runtime.throttle_mutex);
+		if (*val > 0) {
+			runtime.sps_total = *val;
+		}
+		*val = runtime.sps_total;
+		switch_mutex_unlock(runtime.throttle_mutex);
+		break;
 	}
 
 	return 0;



More information about the Freeswitch-svn mailing list