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
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 284
 					ret = _sr_events_list.rcv_nosip(data);
285 285
 					return ret;
286 286
 				} else return 1;
287
+		case SREV_MODULE_PKG_STATS:
288
+				if(unlikely(_sr_events_list.mod_update_pkg_stats!=0))
289
+				{
290
+					ret = _sr_events_list.mod_update_pkg_stats(data);
291
+					return ret;
292
+				} else return 1;
293
+		case SREV_MODULE_SHM_STATS:
294
+				if(unlikely(_sr_events_list.mod_update_shm_stats!=0))
295
+				{
296
+					ret = _sr_events_list.mod_update_shm_stats(data);
297
+					return ret;
298
+				} else return 1;
287 299
 		default:
288 300
 			return -1;
289 301
 	}
... ...
@@ -319,6 +340,10 @@ int sr_event_enabled(int type)
319 319
 				return (_sr_events_list.stun_in!=0)?1:0;
320 320
 		case SREV_RCV_NOSIP:
321 321
 				return (_sr_events_list.rcv_nosip!=0)?1:0;
322
+		case SREV_MODULE_PKG_STATS:
323
+				return (_sr_events_list.mod_update_pkg_stats!=0)?1:0;
324
+		case SREV_MODULE_SHM_STATS:
325
+				return (_sr_events_list.mod_update_shm_stats!=0)?1:0;
322 326
 	}
323 327
 	return 0;
324 328
 }
... ...
@@ -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 52
 	sr_event_cb_f tcp_ws_frame_out;
53 53
 	sr_event_cb_f stun_in;
54 54
 	sr_event_cb_f rcv_nosip;
55
+	sr_event_cb_f mod_update_pkg_stats;
56
+	sr_event_cb_f mod_update_shm_stats;
55 57
 } sr_event_cb_t;
56 58
 
57 59
 void sr_event_cb_init(void);