Browse code

core: added events for per module pkg/shm summary

- used by kex for per module memory stats

Stefan Mititelu authored on 02/11/2015 12:38:40 • Daniel-Constantin Mierla committed on 02/11/2015 12:38:40
Showing 2 changed files
... ...
@@ -165,6 +165,15 @@ int sr_event_register_cb(int type, sr_event_cb_f f)
165 165
 					_sr_events_list.rcv_nosip = f;
166 166
 				else return -1;
167 167
 			break;
168
+		case SREV_MODULE_PKG_STATS:
169
+				if(_sr_events_list.mod_update_pkg_stats==0)
170
+					_sr_events_list.mod_update_pkg_stats = f;
171
+				else return -1;
172
+		case SREV_MODULE_SHM_STATS:
173
+				if(_sr_events_list.mod_update_shm_stats==0)
174
+					_sr_events_list.mod_update_shm_stats = f;
175
+				else return -1;
176
+			break;
168 177
 		default:
169 178
 			return -1;
170 179
 	}
... ...
@@ -284,6 +293,18 @@ int sr_event_exec(int type, void *data)
284 293
 					ret = _sr_events_list.rcv_nosip(data);
285 294
 					return ret;
286 295
 				} else return 1;
296
+		case SREV_MODULE_PKG_STATS:
297
+				if(unlikely(_sr_events_list.mod_update_pkg_stats!=0))
298
+				{
299
+					ret = _sr_events_list.mod_update_pkg_stats(data);
300
+					return ret;
301
+				} else return 1;
302
+		case SREV_MODULE_SHM_STATS:
303
+				if(unlikely(_sr_events_list.mod_update_shm_stats!=0))
304
+				{
305
+					ret = _sr_events_list.mod_update_shm_stats(data);
306
+					return ret;
307
+				} else return 1;
287 308
 		default:
288 309
 			return -1;
289 310
 	}
... ...
@@ -319,6 +340,10 @@ int sr_event_enabled(int type)
319 340
 				return (_sr_events_list.stun_in!=0)?1:0;
320 341
 		case SREV_RCV_NOSIP:
321 342
 				return (_sr_events_list.rcv_nosip!=0)?1:0;
343
+		case SREV_MODULE_PKG_STATS:
344
+				return (_sr_events_list.mod_update_pkg_stats!=0)?1:0;
345
+		case SREV_MODULE_SHM_STATS:
346
+				return (_sr_events_list.mod_update_shm_stats!=0)?1:0;
322 347
 	}
323 348
 	return 0;
324 349
 }
... ...
@@ -34,6 +34,8 @@
34 34
 #define SREV_TCP_WS_FRAME_IN		10
35 35
 #define SREV_TCP_WS_FRAME_OUT		11
36 36
 #define SREV_STUN_IN			12
37
+#define SREV_MODULE_PKG_STATS   13
38
+#define SREV_MODULE_SHM_STATS   14
37 39
 
38 40
 #define SREV_CB_LIST_SIZE	3
39 41
 
... ...
@@ -52,6 +54,8 @@ typedef struct sr_event_cb {
52 54
 	sr_event_cb_f tcp_ws_frame_out;
53 55
 	sr_event_cb_f stun_in;
54 56
 	sr_event_cb_f rcv_nosip;
57
+	sr_event_cb_f mod_update_pkg_stats;
58
+	sr_event_cb_f mod_update_shm_stats;
55 59
 } sr_event_cb_t;
56 60
 
57 61
 void sr_event_cb_init(void);