]> code.delx.au - pulseaudio/blobdiff - polyp/scache.c
add total sample cache size to statistics
[pulseaudio] / polyp / scache.c
index 311d68a42172a83c43822f614d58e306718ee36c..b7a8ff026185df8180e368330e68bc32dfdb91f1 100644 (file)
@@ -168,3 +168,18 @@ uint32_t pa_scache_get_id_by_name(struct pa_core *c, const char *name) {
 
     return e->index;
 }
+
+uint32_t pa_scache_total_size(struct pa_core *c) {
+    struct pa_scache_entry *e;
+    uint32_t index;
+    uint32_t sum;
+
+    if (!c->scache)
+        return 0;
+    
+    for (e = pa_idxset_first(c->scache, &index); e; e = pa_idxset_next(c->scache, &index))
+        sum += e->memchunk.length;
+
+
+    return sum;
+}