diff options
author | Robert Richter <robert.richter@amd.com> | 2008-12-09 10:56:01 -0500 |
---|---|---|
committer | Robert Richter <robert.richter@amd.com> | 2008-12-10 08:20:10 -0500 |
commit | 37ca5eb341711d7aeb9f296873b9d46eb6af33ec (patch) | |
tree | e8d3a5003a90a7cdbc8da9835f8936c05820e85a /drivers/oprofile | |
parent | fd7826d56bde11ab142d2431093773ad2b3f0a59 (diff) |
oprofile: set values to default when creating oprofilefs
This patch restores default values for:
/dev/oprofile/cpu_buffer_size
/dev/oprofile/buffer_watershed
/dev/oprofile/buffer_size
when creating the oprofilefs:
# opcontrol --deinit
# opcontrol --init
# cat /dev/oprofile/cpu_buffer_size
8192
# echo 5123 > /dev/oprofile/cpu_buffer_size
# cat /dev/oprofile/cpu_buffer_size
5123
# opcontrol --deinit
# opcontrol --init
# cat /dev/oprofile/cpu_buffer_size
8192
# opcontrol --deinit
This sets the values in a defined state. Before, there was no way to
restore the defaults without rebooting the system or reloading the
module.
Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'drivers/oprofile')
-rw-r--r-- | drivers/oprofile/oprofile_files.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/oprofile/oprofile_files.c b/drivers/oprofile/oprofile_files.c index cc106d503ace..d8201998b0b7 100644 --- a/drivers/oprofile/oprofile_files.c +++ b/drivers/oprofile/oprofile_files.c | |||
@@ -14,9 +14,13 @@ | |||
14 | #include "oprofile_stats.h" | 14 | #include "oprofile_stats.h" |
15 | #include "oprof.h" | 15 | #include "oprof.h" |
16 | 16 | ||
17 | unsigned long fs_buffer_size = 131072; | 17 | #define FS_BUFFER_SIZE_DEFAULT 131072 |
18 | unsigned long fs_cpu_buffer_size = 8192; | 18 | #define FS_CPU_BUFFER_SIZE_DEFAULT 8192 |
19 | unsigned long fs_buffer_watershed = 32768; /* FIXME: tune */ | 19 | #define FS_BUFFER_WATERSHED_DEFAULT 32768 /* FIXME: tune */ |
20 | |||
21 | unsigned long fs_buffer_size; | ||
22 | unsigned long fs_cpu_buffer_size; | ||
23 | unsigned long fs_buffer_watershed; | ||
20 | 24 | ||
21 | static ssize_t depth_read(struct file *file, char __user *buf, size_t count, loff_t *offset) | 25 | static ssize_t depth_read(struct file *file, char __user *buf, size_t count, loff_t *offset) |
22 | { | 26 | { |
@@ -120,6 +124,11 @@ static const struct file_operations dump_fops = { | |||
120 | 124 | ||
121 | void oprofile_create_files(struct super_block *sb, struct dentry *root) | 125 | void oprofile_create_files(struct super_block *sb, struct dentry *root) |
122 | { | 126 | { |
127 | /* reinitialize default values */ | ||
128 | fs_buffer_size = FS_BUFFER_SIZE_DEFAULT; | ||
129 | fs_cpu_buffer_size = FS_CPU_BUFFER_SIZE_DEFAULT; | ||
130 | fs_buffer_watershed = FS_BUFFER_WATERSHED_DEFAULT; | ||
131 | |||
123 | oprofilefs_create_file(sb, root, "enable", &enable_fops); | 132 | oprofilefs_create_file(sb, root, "enable", &enable_fops); |
124 | oprofilefs_create_file_perm(sb, root, "dump", &dump_fops, 0666); | 133 | oprofilefs_create_file_perm(sb, root, "dump", &dump_fops, 0666); |
125 | oprofilefs_create_file(sb, root, "buffer", &event_buffer_fops); | 134 | oprofilefs_create_file(sb, root, "buffer", &event_buffer_fops); |