add peak sps to stats and a command to reset it

This commit is contained in:
Anthony Minessale
2013-07-19 15:16:42 -05:00
parent 75bdc43d82
commit c510f3f52e
7 changed files with 27 additions and 4 deletions

View File

@@ -88,6 +88,7 @@ static void send_heartbeat(void)
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Count", "%u", switch_core_session_count());
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Max-Sessions", "%u", switch_core_session_limit(0));
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Per-Sec", "%u", runtime.sps);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Per-Sec-Max", "%u", runtime.sps_peak);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Since-Startup", "%" SWITCH_SIZE_T_FMT, switch_core_session_id() - 1);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Idle-CPU", "%f", switch_core_idle_cpu());
switch_event_fire(&event);
@@ -2477,6 +2478,12 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
case SCSC_LAST_SPS:
newintval = runtime.sps_last;
break;
case SCSC_SPS_PEAK:
if (oldintval == -1) {
runtime.sps_peak = 0;
}
newintval = runtime.sps_peak;
break;
case SCSC_MAX_DTMF_DURATION:
newintval = switch_core_max_dtmf_duration(oldintval);
break;