aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>2013-03-12 13:26:49 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-03-13 07:13:48 -0400
commita42277c739c29b06cb27502347f557e11fed8b0e (patch)
treee6a8ebb440108a98fe151d9f6ba908eefb01f1f1 /drivers/base
parenteb4cb76ff00e27858e5c80f69dbe8cc15364578c (diff)
regmap: rbtree Expose total memory consumption in the rbtree debugfs entry
Provide a feel of how much overhead the rbtree cache adds to the game. [Slightly reworded output in debugfs -- broonie] Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regcache-rbtree.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index 461cff888bb1..045319615608 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -138,15 +138,20 @@ static int rbtree_show(struct seq_file *s, void *ignored)
138 struct regcache_rbtree_node *n; 138 struct regcache_rbtree_node *n;
139 struct rb_node *node; 139 struct rb_node *node;
140 unsigned int base, top; 140 unsigned int base, top;
141 size_t mem_size;
141 int nodes = 0; 142 int nodes = 0;
142 int registers = 0; 143 int registers = 0;
143 int this_registers, average; 144 int this_registers, average;
144 145
145 map->lock(map); 146 map->lock(map);
146 147
148 mem_size = sizeof(*rbtree_ctx);
149
147 for (node = rb_first(&rbtree_ctx->root); node != NULL; 150 for (node = rb_first(&rbtree_ctx->root); node != NULL;
148 node = rb_next(node)) { 151 node = rb_next(node)) {
149 n = container_of(node, struct regcache_rbtree_node, node); 152 n = container_of(node, struct regcache_rbtree_node, node);
153 mem_size += sizeof(*n);
154 mem_size += (n->blklen * map->cache_word_size);
150 155
151 regcache_rbtree_get_base_top_reg(map, n, &base, &top); 156 regcache_rbtree_get_base_top_reg(map, n, &base, &top);
152 this_registers = ((top - base) / map->reg_stride) + 1; 157 this_registers = ((top - base) / map->reg_stride) + 1;
@@ -161,8 +166,8 @@ static int rbtree_show(struct seq_file *s, void *ignored)
161 else 166 else
162 average = 0; 167 average = 0;
163 168
164 seq_printf(s, "%d nodes, %d registers, average %d registers\n", 169 seq_printf(s, "%d nodes, %d registers, average %d registers, used %zu bytes\n",
165 nodes, registers, average); 170 nodes, registers, average, mem_size);
166 171
167 map->unlock(map); 172 map->unlock(map);
168 173