Module: kamailio
Branch: master
Commit: 2e7b5dd2701f7baf0c31a56ae268c94a2da6ae14
URL:
https://github.com/kamailio/kamailio/commit/2e7b5dd2701f7baf0c31a56ae268c94…
Author: Stefan Mititelu <stefan.mititelu(a)1and1.ro>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-11-02T13:38:40+01:00
core: added events for per module pkg/shm summary
- used by kex for per module memory stats
---
Modified: events.c
Modified: events.h
---
Diff:
https://github.com/kamailio/kamailio/commit/2e7b5dd2701f7baf0c31a56ae268c94…
Patch:
https://github.com/kamailio/kamailio/commit/2e7b5dd2701f7baf0c31a56ae268c94…
---
diff --git a/events.c b/events.c
index 5312e7a..3b0d651 100644
--- a/events.c
+++ b/events.c
@@ -165,6 +165,15 @@ int sr_event_register_cb(int type, sr_event_cb_f f)
_sr_events_list.rcv_nosip = f;
else return -1;
break;
+ case SREV_MODULE_PKG_STATS:
+ if(_sr_events_list.mod_update_pkg_stats==0)
+ _sr_events_list.mod_update_pkg_stats = f;
+ else return -1;
+ case SREV_MODULE_SHM_STATS:
+ if(_sr_events_list.mod_update_shm_stats==0)
+ _sr_events_list.mod_update_shm_stats = f;
+ else return -1;
+ break;
default:
return -1;
}
@@ -284,6 +293,18 @@ int sr_event_exec(int type, void *data)
ret = _sr_events_list.rcv_nosip(data);
return ret;
} else return 1;
+ case SREV_MODULE_PKG_STATS:
+ if(unlikely(_sr_events_list.mod_update_pkg_stats!=0))
+ {
+ ret = _sr_events_list.mod_update_pkg_stats(data);
+ return ret;
+ } else return 1;
+ case SREV_MODULE_SHM_STATS:
+ if(unlikely(_sr_events_list.mod_update_shm_stats!=0))
+ {
+ ret = _sr_events_list.mod_update_shm_stats(data);
+ return ret;
+ } else return 1;
default:
return -1;
}
@@ -319,6 +340,10 @@ int sr_event_enabled(int type)
return (_sr_events_list.stun_in!=0)?1:0;
case SREV_RCV_NOSIP:
return (_sr_events_list.rcv_nosip!=0)?1:0;
+ case SREV_MODULE_PKG_STATS:
+ return (_sr_events_list.mod_update_pkg_stats!=0)?1:0;
+ case SREV_MODULE_SHM_STATS:
+ return (_sr_events_list.mod_update_shm_stats!=0)?1:0;
}
return 0;
}
diff --git a/events.h b/events.h
index 8218453..4443a79 100644
--- a/events.h
+++ b/events.h
@@ -34,6 +34,8 @@
#define SREV_TCP_WS_FRAME_IN 10
#define SREV_TCP_WS_FRAME_OUT 11
#define SREV_STUN_IN 12
+#define SREV_MODULE_PKG_STATS 13
+#define SREV_MODULE_SHM_STATS 14
#define SREV_CB_LIST_SIZE 3
@@ -52,6 +54,8 @@ typedef struct sr_event_cb {
sr_event_cb_f tcp_ws_frame_out;
sr_event_cb_f stun_in;
sr_event_cb_f rcv_nosip;
+ sr_event_cb_f mod_update_pkg_stats;
+ sr_event_cb_f mod_update_shm_stats;
} sr_event_cb_t;
void sr_event_cb_init(void);