Changeset 4101:42b7ee5d2f76 in roaraudio
- Timestamp:
- 07/25/10 16:56:11 (14 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/clients.c
r4020 r4101 81 81 g_clients[i] = n; 82 82 83 counters_inc(clients, 1); 83 84 ROAR_DBG("clients_new(void) = %i", i); 84 85 return i; … … 128 129 129 130 ROAR_DBG("clients_delete(id=%i) = ?", id); 131 132 counters_inc(clients, -1); 130 133 131 134 _CHECK_CID(id); -
roard/include/roard.h
r3977 r4101 183 183 } * g_config; 184 184 185 struct _counters { 186 size_t clients, streams, 187 samples, 188 sources, outputs, 189 mixers, bridges, 190 listens; 191 }; 192 193 struct { 194 struct _counters cur, sum; 195 } g_counters; 196 197 198 #define counters_init() memset(&g_counters, 0, sizeof(g_counters)) 199 //#define counters_inc(c,i) do { signed long int __i = (i); if ( __i < 0 && __i > (g_counters.cur.c) ) { ROAR_WARN("counters_inc(c=%s, i=%li): Decrement request bigger than current counter value. Counter out of syn!", ) } while (0) 200 #define counters_inc(c,i) do { signed long int __i = (i); g_counters.cur.c += __i; if ( __i > 0 ) g_counters.sum.c += __i; } while (0) 201 202 #define counters_get(g,c) ((g_counters.g.c)) 203 204 void counters_print(int type, int force); 205 185 206 #endif 186 207 -
roard/roard.c
r4058 r4101 236 236 #endif 237 237 238 #define _pmsg(format, args...) roar_debug_msg(type, __LINE__, __FILE__, ROAR_DBG_PREFIX, format, ## args) 239 #define _pmsgc(group, counter, name) _pmsg(" Counter %-10s: %llu", (name), (long long unsigned int)counters_get(group, counter)) 240 void counters_print(int type, int force) { 241 if ( type != ROAR_DEBUG_TYPE_INFO || force || (ROAR_DBG_INFOVAR) >= ROAR_DBG_INFO_INFO ) { 242 _pmsg("--- Counter Listing ---"); 243 _pmsg(" Current:"); 244 _pmsgc(cur, clients, "Clients"); 245 _pmsgc(cur, streams, "Streams"); 246 _pmsg(" Total:"); 247 _pmsgc(sum, clients, "Clients"); 248 _pmsgc(sum, streams, "Streams"); 249 _pmsg("--- End of Counter Listing ---"); 250 } 251 } 252 #undef _pmsgc 253 #undef _pmsg 254 238 255 int restart_server (char * server, int terminate) { 239 256 struct roar_connection con; … … 1239 1256 memcpy(g_max_sa, g_sa, sizeof(max_sa)); 1240 1257 1258 counters_init(); 1259 1241 1260 g_config = &config; 1242 1261 … … 2219 2238 ROAR_INFO("Shuting down", ROAR_DBG_INFO_INFO); 2220 2239 2240 counters_print(ROAR_DEBUG_TYPE_INFO, 0); 2241 2221 2242 clean_quit_prep(); 2222 2243 // driver_close(drvinst, drvid); -
roard/streams.c
r4099 r4101 135 135 136 136 g_streams[i] = s; 137 counters_inc(streams, 1); 137 138 ROAR_DBG("streams_new(void): n->id=%i", n->id); 138 139 ROAR_DBG("streams_new(void) = %i", i); … … 164 165 165 166 s->state = ROAR_STREAMSTATE_CLOSING; 167 168 counters_inc(streams, -1); 166 169 167 170 if ( streams_get_flag(id, ROAR_FLAG_RECSOURCE) == 1 )
Note: See TracChangeset
for help on using the changeset viewer.