From: Robert Richter <robert.richter@amd.com>
To: oprofile-list <oprofile-list@lists.sourceforge.net>
Cc: LKML <linux-kernel@vger.kernel.org>,
Robert Richter <robert.richter@amd.com>
Subject: [PATCH 08/10] oprofile: set values to default when creating oprofilefs
Date: Thu, 11 Dec 2008 16:04:44 +0100 [thread overview]
Message-ID: <1229007886-14362-9-git-send-email-robert.richter@amd.com> (raw)
In-Reply-To: <1229007886-14362-1-git-send-email-robert.richter@amd.com>
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>
---
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 cc106d5..d820199 100644
--- a/drivers/oprofile/oprofile_files.c
+++ b/drivers/oprofile/oprofile_files.c
@@ -14,9 +14,13 @@
#include "oprofile_stats.h"
#include "oprof.h"
-unsigned long fs_buffer_size = 131072;
-unsigned long fs_cpu_buffer_size = 8192;
-unsigned long fs_buffer_watershed = 32768; /* FIXME: tune */
+#define FS_BUFFER_SIZE_DEFAULT 131072
+#define FS_CPU_BUFFER_SIZE_DEFAULT 8192
+#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)
{
@@ -120,6 +124,11 @@ static const struct file_operations dump_fops = {
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_perm(sb, root, "dump", &dump_fops, 0666);
oprofilefs_create_file(sb, root, "buffer", &event_buffer_fops);
--
1.6.0.1
next prev parent reply other threads:[~2008-12-11 16:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-11 15:04 [PATCH 0/10] oprofile and ftrace: some trivial patches Robert Richter
2008-12-11 15:04 ` [PATCH 01/10] oprofile: comment cleanup Robert Richter
2008-12-11 15:04 ` [PATCH 02/10] oprofile: update comment for oprofile_add_sample() Robert Richter
2008-12-11 15:04 ` [PATCH 03/10] oprofile: whitspace changes only Robert Richter
2008-12-11 15:04 ` [PATCH 04/10] oprofile: fix typo Robert Richter
2008-12-11 15:04 ` [PATCH 05/10] x86/oprofile: reordering IBS code in op_model_amd.c Robert Richter
2008-12-11 15:04 ` [PATCH 06/10] x86/oprofile: cleanup IBS init/exit functions " Robert Richter
2008-12-11 15:04 ` [PATCH 07/10] oprofile: implement switch/case in buffer_sync.c Robert Richter
2008-12-11 15:04 ` Robert Richter [this message]
2008-12-16 9:32 ` [PATCH 08/10] oprofile: set values to default when creating oprofilefs Andrew Morton
2008-12-16 11:56 ` Robert Richter
2008-12-11 15:04 ` [PATCH 09/10] ring_buffer: update description for ring_buffer_alloc() Robert Richter
2008-12-11 15:04 ` [PATCH 10/10] ftrace: remove unused function arg in trace_iterator_increment() Robert Richter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1229007886-14362-9-git-send-email-robert.richter@amd.com \
--to=robert.richter@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oprofile-list@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox