Revision
16679
Author
anthm
Date
2010-02-17 13:50:25 -0600 (Wed, 17 Feb 2010)

Log Message

disable cpu timer affinity by default but make it still possible via config and fix stray constant in tipping_point

Modified Paths

Diff

Modified: freeswitch/trunk/src/include/private/switch_core_pvt.h (16678 => 16679)


--- freeswitch/trunk/src/include/private/switch_core_pvt.h	2010-02-17 18:01:05 UTC (rev 16678)
+++ freeswitch/trunk/src/include/private/switch_core_pvt.h	2010-02-17 19:50:25 UTC (rev 16679)
@@ -217,6 +217,7 @@
 	uint32_t debug_level;
 	uint32_t runlevel;
 	uint32_t tipping_point;
+	uint32_t timer_affinity;
 };
 
 extern struct switch_runtime runtime;

Modified: freeswitch/trunk/src/switch_core.c (16678 => 16679)


--- freeswitch/trunk/src/switch_core.c	2010-02-17 18:01:05 UTC (rev 16678)
+++ freeswitch/trunk/src/switch_core.c	2010-02-17 19:50:25 UTC (rev 16679)
@@ -1301,8 +1301,9 @@
 
 	runtime.running = 1;
 	runtime.tipping_point = 1000000;
+	runtime.timer_affinity = -1;
 	runtime.initiated = switch_time_now();
-
+	
 	switch_scheduler_add_task(switch_epoch_time_now(NULL), heartbeat_callback, "heartbeat", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL);
 
 	switch_uuid_get(&uuid);
@@ -1443,6 +1444,12 @@
 					switch_core_session_limit(atoi(val));
 				} else if (!strcasecmp(var, "tipping-point") && !zstr(val)) {
 					runtime.tipping_point = atoi(val);
+				} else if (!strcasecmp(var, "timer-affinity") && !zstr(val)) {
+					if (!strcasecmp(val, "disabled")) {
+						runtime.timer_affinity = -1;
+					} else {
+						runtime.timer_affinity = atoi(val);
+					}
 				} else if (!strcasecmp(var, "rtp-start-port") && !zstr(val)) {
 					switch_rtp_set_start_port((switch_port_t) atoi(val));
 				} else if (!strcasecmp(var, "rtp-end-port") && !zstr(val)) {

Modified: freeswitch/trunk/src/switch_time.c (16678 => 16679)


--- freeswitch/trunk/src/switch_time.c	2010-02-17 18:01:05 UTC (rev 16678)
+++ freeswitch/trunk/src/switch_time.c	2010-02-17 19:50:25 UTC (rev 16679)
@@ -363,7 +363,7 @@
 
 SWITCH_DECLARE(void) switch_cond_next(void)
 {
-	if (session_manager.session_count > 1000) {
+	if (session_manager.session_count > runtime.tipping_point) {
 		os_yield();
 		return;
 	}
@@ -594,10 +594,12 @@
 	int fwd_errs = 0, rev_errs = 0;
 
 #ifdef HAVE_CPU_SET_MACROS
-	cpu_set_t set;
-	CPU_ZERO(&set);
-	CPU_SET(0, &set);
-	sched_setaffinity(0, sizeof(set), &set);
+	if (runtime.timer_affinity > -1) {
+		cpu_set_t set;
+		CPU_ZERO(&set);
+		CPU_SET(0, &set);
+		sched_setaffinity(runtime.timer_affinity, sizeof(set), &set);
+	}
 #endif
 
 	switch_time_sync();