Commit 37ca5eb3 authored by Robert Richter's avatar Robert Richter

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: default avatarRobert Richter <robert.richter@amd.com>
parent fd7826d5
...@@ -14,9 +14,13 @@ ...@@ -14,9 +14,13 @@
#include "oprofile_stats.h" #include "oprofile_stats.h"
#include "oprof.h" #include "oprof.h"
unsigned long fs_buffer_size = 131072; #define FS_BUFFER_SIZE_DEFAULT 131072
unsigned long fs_cpu_buffer_size = 8192; #define FS_CPU_BUFFER_SIZE_DEFAULT 8192
unsigned long fs_buffer_watershed = 32768; /* FIXME: tune */ #define FS_BUFFER_WATERSHED_DEFAULT 32768 /* FIXME: tune */
unsigned long fs_buffer_size;
unsigned long fs_cpu_buffer_size;
unsigned long fs_buffer_watershed;
static ssize_t depth_read(struct file *file, char __user *buf, size_t count, loff_t *offset) static ssize_t depth_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
{ {
...@@ -120,6 +124,11 @@ static const struct file_operations dump_fops = { ...@@ -120,6 +124,11 @@ static const struct file_operations dump_fops = {
void oprofile_create_files(struct super_block *sb, struct dentry *root) void oprofile_create_files(struct super_block *sb, struct dentry *root)
{ {
/* reinitialize default values */
fs_buffer_size = FS_BUFFER_SIZE_DEFAULT;
fs_cpu_buffer_size = FS_CPU_BUFFER_SIZE_DEFAULT;
fs_buffer_watershed = FS_BUFFER_WATERSHED_DEFAULT;
oprofilefs_create_file(sb, root, "enable", &enable_fops); oprofilefs_create_file(sb, root, "enable", &enable_fops);
oprofilefs_create_file_perm(sb, root, "dump", &dump_fops, 0666); oprofilefs_create_file_perm(sb, root, "dump", &dump_fops, 0666);
oprofilefs_create_file(sb, root, "buffer", &event_buffer_fops); oprofilefs_create_file(sb, root, "buffer", &event_buffer_fops);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment