Release 4.11 drivers/oprofile/oprofile_files.c
/**
* @file oprofile_files.c
*
* @remark Copyright 2002 OProfile authors
* @remark Read the file COPYING
*
* @author John Levon <levon@movementarian.org>
*/
#include <linux/fs.h>
#include <linux/oprofile.h>
#include <linux/jiffies.h>
#include "event_buffer.h"
#include "oprofile_stats.h"
#include "oprof.h"
#define BUFFER_SIZE_DEFAULT 131072
#define CPU_BUFFER_SIZE_DEFAULT 8192
#define BUFFER_WATERSHED_DEFAULT 32768
/* FIXME: tune */
#define TIME_SLICE_DEFAULT 1
unsigned long oprofile_buffer_size;
unsigned long oprofile_cpu_buffer_size;
unsigned long oprofile_buffer_watershed;
unsigned long oprofile_time_slice;
#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
static ssize_t timeout_read(struct file *file, char __user *buf,
size_t count, loff_t *offset)
{
return oprofilefs_ulong_to_user(jiffies_to_msecs(oprofile_time_slice),
buf, count, offset);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jason Yeh | 37 | 97.37% | 1 | 50.00% |
Robert Richter | 1 | 2.63% | 1 | 50.00% |
Total | 38 | 100.00% | 2 | 100.00% |
static ssize_t timeout_write(struct file *file, char const __user *buf,
size_t count, loff_t *offset)
{
unsigned long val;
int retval;
if (*offset)
return -EINVAL;
retval = oprofilefs_ulong_from_user(&val, buf, count);
if (retval <= 0)
return retval;
retval = oprofile_set_timeout(val);
if (retval)
return retval;
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jason Yeh | 76 | 97.44% | 1 | 50.00% |
Robert Richter | 2 | 2.56% | 1 | 50.00% |
Total | 78 | 100.00% | 2 | 100.00% |
static const struct file_operations timeout_fops = {
.read = timeout_read,
.write = timeout_write,
.llseek = default_llseek,
};
#endif
static ssize_t depth_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
{
return oprofilefs_ulong_to_user(oprofile_backtrace_depth, buf, count,
offset);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Greg Banks | 33 | 94.29% | 1 | 33.33% |
Al Viro | 1 | 2.86% | 1 | 33.33% |
Robert Richter | 1 | 2.86% | 1 | 33.33% |
Total | 35 | 100.00% | 3 | 100.00% |
static ssize_t depth_write(struct file *file, char const __user *buf, size_t count, loff_t *offset)
{
unsigned long val;
int retval;
if (*offset)
return -EINVAL;
if (!oprofile_ops.backtrace)
return -EINVAL;
retval = oprofilefs_ulong_from_user(&val, buf, count);
if (retval <= 0)
return retval;
retval = oprofile_set_ulong(&oprofile_backtrace_depth, val);
if (retval)
return retval;
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Greg Banks | 74 | 80.43% | 1 | 25.00% |
Robert Richter | 17 | 18.48% | 2 | 50.00% |
Al Viro | 1 | 1.09% | 1 | 25.00% |
Total | 92 | 100.00% | 4 | 100.00% |
static const struct file_operations depth_fops = {
.read = depth_read,
.write = depth_write,
.llseek = default_llseek,
};
static ssize_t pointer_size_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
{
return oprofilefs_ulong_to_user(sizeof(void *), buf, count, offset);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
John Levon | 38 | 97.44% | 1 | 50.00% |
Al Viro | 1 | 2.56% | 1 | 50.00% |
Total | 39 | 100.00% | 2 | 100.00% |
static const struct file_operations pointer_size_fops = {
.read = pointer_size_read,
.llseek = default_llseek,
};
static ssize_t cpu_type_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
{
return oprofilefs_str_to_user(oprofile_ops.cpu_type, buf, count, offset);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
John Levon | 35 | 94.59% | 2 | 50.00% |
Al Viro | 1 | 2.70% | 1 | 25.00% |
Greg Banks | 1 | 2.70% | 1 | 25.00% |
Total | 37 | 100.00% | 4 | 100.00% |
static const struct file_operations cpu_type_fops = {
.read = cpu_type_read,
.llseek = default_llseek,
};
static ssize_t enable_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
{
return oprofilefs_ulong_to_user(oprofile_started, buf, count, offset);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
John Levon | 34 | 97.14% | 1 | 50.00% |
Al Viro | 1 | 2.86% | 1 | 50.00% |
Total | 35 | 100.00% | 2 | 100.00% |
static ssize_t enable_write(struct file *file, char const __user *buf, size_t count, loff_t *offset)
{
unsigned long val;
int retval;
if (*offset)
return -EINVAL;
retval = oprofilefs_ulong_from_user(&val, buf, count);
if (retval <= 0)
return retval;
retval = 0;
if (val)
retval = oprofile_start();
else
oprofile_stop();
if (retval)
return retval;
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
John Levon | 81 | 92.05% | 1 | 33.33% |
Robert Richter | 6 | 6.82% | 1 | 33.33% |
Al Viro | 1 | 1.14% | 1 | 33.33% |
Total | 88 | 100.00% | 3 | 100.00% |
static const struct file_operations enable_fops = {
.read = enable_read,
.write = enable_write,
.llseek = default_llseek,
};
static ssize_t dump_write(struct file *file, char const __user *buf, size_t count, loff_t *offset)
{
wake_up_buffer_waiter();
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
John Levon | 29 | 96.67% | 1 | 50.00% |
Al Viro | 1 | 3.33% | 1 | 50.00% |
Total | 30 | 100.00% | 2 | 100.00% |
static const struct file_operations dump_fops = {
.write = dump_write,
.llseek = noop_llseek,
};
void oprofile_create_files(struct dentry *root)
{
/* reinitialize default values */
oprofile_buffer_size = BUFFER_SIZE_DEFAULT;
oprofile_cpu_buffer_size = CPU_BUFFER_SIZE_DEFAULT;
oprofile_buffer_watershed = BUFFER_WATERSHED_DEFAULT;
oprofile_time_slice = msecs_to_jiffies(TIME_SLICE_DEFAULT);
oprofilefs_create_file(root, "enable", &enable_fops);
oprofilefs_create_file_perm(root, "dump", &dump_fops, 0666);
oprofilefs_create_file(root, "buffer", &event_buffer_fops);
oprofilefs_create_ulong(root, "buffer_size", &oprofile_buffer_size);
oprofilefs_create_ulong(root, "buffer_watershed", &oprofile_buffer_watershed);
oprofilefs_create_ulong(root, "cpu_buffer_size", &oprofile_cpu_buffer_size);
oprofilefs_create_file(root, "cpu_type", &cpu_type_fops);
oprofilefs_create_file(root, "backtrace_depth", &depth_fops);
oprofilefs_create_file(root, "pointer_size", &pointer_size_fops);
#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
oprofilefs_create_file(root, "time_slice", &timeout_fops);
#endif
oprofile_create_stats_files(root);
if (oprofile_ops.create_files)
oprofile_ops.create_files(root);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
John Levon | 92 | 59.35% | 3 | 30.00% |
Robert Richter | 23 | 14.84% | 3 | 30.00% |
Jason Yeh | 14 | 9.03% | 1 | 10.00% |
Al Viro | 12 | 7.74% | 1 | 10.00% |
Greg Banks | 11 | 7.10% | 1 | 10.00% |
Andrew Morton | 3 | 1.94% | 1 | 10.00% |
Total | 155 | 100.00% | 10 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
John Levon | 387 | 47.96% | 4 | 22.22% |
Jason Yeh | 153 | 18.96% | 1 | 5.56% |
Greg Banks | 135 | 16.73% | 1 | 5.56% |
Robert Richter | 74 | 9.17% | 6 | 33.33% |
Arnd Bergmann | 31 | 3.84% | 1 | 5.56% |
Al Viro | 19 | 2.35% | 3 | 16.67% |
Arjan van de Ven | 5 | 0.62% | 1 | 5.56% |
Andrew Morton | 3 | 0.37% | 1 | 5.56% |
Total | 807 | 100.00% | 18 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.