aboutsummaryrefslogtreecommitdiffstats
path: root/litmus
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2012-05-06 14:45:29 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2012-05-06 14:45:29 -0400
commit8acf04cf81854a05d933a8236c2019b7b6d18bae (patch)
tree5c84ac89a7417de5cc82783bc595c5204c5bd321 /litmus
parent10bc618f3663fd34d6ffaf8adcaa369db8668eda (diff)
Add proc entry to display cache info
Diffstat (limited to 'litmus')
-rw-r--r--litmus/color_proc.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/litmus/color_proc.c b/litmus/color_proc.c
index adf38a80f93a..1d46496542c9 100644
--- a/litmus/color_proc.c
+++ b/litmus/color_proc.c
@@ -28,6 +28,9 @@ static struct color_cpu_server color_cpu_servers[NR_CPUS];
28/* the + 1 is for the sentinel element */ 28/* the + 1 is for the sentinel element */
29static struct ctl_table color_cpu_tables[NR_CPUS + 1]; 29static struct ctl_table color_cpu_tables[NR_CPUS + 1];
30 30
31#define INFO_BUFFER_SIZE 100
32static char info_buffer[100];
33
31#define NR_PAGES_INDEX 0 /* location of nr_pages in the table below */ 34#define NR_PAGES_INDEX 0 /* location of nr_pages in the table below */
32static struct ctl_table color_table[] = 35static struct ctl_table color_table[] =
33{ 36{
@@ -53,6 +56,13 @@ static struct ctl_table color_table[] =
53 .extra1 = &zero, 56 .extra1 = &zero,
54 .extra2 = &one, 57 .extra2 = &one,
55 }, 58 },
59 {
60 .procname = "cache_info",
61 .mode = 0444,
62 .proc_handler = proc_dostring,
63 .data = info_buffer,
64 .maxlen = INFO_BUFFER_SIZE,
65 },
56 { } 66 { }
57}; 67};
58 68
@@ -69,7 +79,7 @@ static struct ctl_table litmus_table[] =
69static struct ctl_table litmus_dir_table[] = { 79static struct ctl_table litmus_dir_table[] = {
70 { 80 {
71 .procname = "litmus", 81 .procname = "litmus",
72 .mode = 0555, 82 .mode = 0555,
73 .child = litmus_table, 83 .child = litmus_table,
74 }, 84 },
75 { } 85 { }
@@ -182,6 +192,17 @@ static int __init litmus_sysctl_init(void)
182 ret = init_server_entries(); 192 ret = init_server_entries();
183 if (ret) 193 if (ret)
184 goto out; 194 goto out;
195
196 snprintf(info_buffer, INFO_BUFFER_SIZE,
197 "Cache size\t: %lu B\n"
198 "Line size\t: %lu B\n"
199 "Ways\t\t: %lu\n"
200 "Sets\t\t: %lu\n"
201 "Colors\t\t: %lu",
202 color_cache_info.size, color_cache_info.line_size,
203 color_cache_info.ways, color_cache_info.sets,
204 color_cache_info.nr_colors);
205
185out: 206out:
186 return ret; 207 return ret;
187} 208}