ion: display ion total size in debufs node
after list all ion dma-buffer, cacluate the total size, and display it in the end. Change-Id: I108ebe7aa3560538b1f24033dc219e8215720069 Reviewed-on: https://gerrit.mot.com/1535658 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Shanghui Zhang <zhangsh@motorola.com> Reviewed-by: Dawei Wang <wangdw10@motorola.com> Reviewed-by: Bolei Shang <shangbl1@lenovo.com> Reviewed-by: Zhenxin Xi <xizx@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
1 parent
1dca9978e3
commit
e9daf31317
1 file changed
+10
@@ -1392,6 +1392,7 @@ static int ion_debug_allbufs_show(struct seq_file *s, void *unused)
|
||||
struct ion_device *dev = s->private;
|
||||
struct rb_node *n;
|
||||
int i;
|
||||
unsigned long total_len = 0;
|
||||
|
||||
seq_printf(s, "%16.s %16.s %12.s %12.s %20.s %s\n", "heap",
|
||||
"buffer", "size", "ref cnt", "allocator", "references");
|
||||
@@ -1401,6 +1402,7 @@ static int ion_debug_allbufs_show(struct seq_file *s, void *unused)
|
||||
for (n = rb_first(&dev->buffers); n; n = rb_next(n)) {
|
||||
struct ion_buffer *buf = rb_entry(n, struct ion_buffer, node);
|
||||
int buf_refcount = buf->ref_cnt;
|
||||
total_len += buf->size;
|
||||
seq_printf(s, "%16.s %16pK %12.x %12.d %20.d %s",
|
||||
buf->heap->name, buf, (int)buf->size,
|
||||
buf_refcount, buf->pid, "");
|
||||
@@ -1410,6 +1412,12 @@ static int ion_debug_allbufs_show(struct seq_file *s, void *unused)
|
||||
|
||||
seq_puts(s, "\n");
|
||||
}
|
||||
|
||||
if (s->file && s->file->f_path.dentry
|
||||
&& !strcmp(s->file->f_path.dentry->d_iname, "check_all_bufs_total"))
|
||||
seq_printf(s, "%16.s %s is: %lld(%lld KB)\n",
|
||||
"heap", "total size", total_len, total_len/1024);
|
||||
|
||||
mutex_unlock(&dev->buffer_lock);
|
||||
up_read(&dev->lock);
|
||||
return 0;
|
||||
@@ -1460,6 +1468,8 @@ struct ion_device *ion_device_create(void)
|
||||
internal_dev = idev;
|
||||
debugfs_create_file("check_all_bufs", 0664, idev->debug_root, idev,
|
||||
&debug_allbufs_fops);
|
||||
debugfs_create_file("check_all_bufs_total", 0664, idev->debug_root, idev,
|
||||
&debug_allbufs_fops);
|
||||
return idev;
|
||||
|
||||
err_sysfs:
|
||||
|
||||
Reference in new issue
Block a user