Release 4.14 arch/cris/kernel/profile.c
// SPDX-License-Identifier: GPL-2.0
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <asm/ptrace.h>
#include <linux/uaccess.h>
#define SAMPLE_BUFFER_SIZE 8192
static char *sample_buffer;
static char *sample_buffer_pos;
static int prof_running = 0;
void cris_profile_sample(struct pt_regs *regs)
{
if (!prof_running)
return;
if (user_mode(regs))
*(unsigned int*)sample_buffer_pos = current->pid;
else
*(unsigned int*)sample_buffer_pos = 0;
*(unsigned int *)(sample_buffer_pos + 4) = instruction_pointer(regs);
sample_buffer_pos += 8;
if (sample_buffer_pos == sample_buffer + SAMPLE_BUFFER_SIZE)
sample_buffer_pos = sample_buffer;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mikael Starvik | 78 | 98.73% | 1 | 50.00% |
Jesper Nilsson | 1 | 1.27% | 1 | 50.00% |
Total | 79 | 100.00% | 2 | 100.00% |
static ssize_t
read_cris_profile(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
unsigned long p = *ppos;
ssize_t ret;
ret = simple_read_from_buffer(buf, count, ppos, sample_buffer,
SAMPLE_BUFFER_SIZE);
if (ret < 0)
return ret;
memset(sample_buffer + p, 0, ret);
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mikael Starvik | 52 | 73.24% | 1 | 50.00% |
Akinobu Mita | 19 | 26.76% | 1 | 50.00% |
Total | 71 | 100.00% | 2 | 100.00% |
static ssize_t
write_cris_profile(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
sample_buffer_pos = sample_buffer;
memset(sample_buffer, 0, SAMPLE_BUFFER_SIZE);
return count < SAMPLE_BUFFER_SIZE ? count : SAMPLE_BUFFER_SIZE;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mikael Starvik | 37 | 80.43% | 1 | 50.00% |
Jesper Nilsson | 9 | 19.57% | 1 | 50.00% |
Total | 46 | 100.00% | 2 | 100.00% |
static const struct file_operations cris_proc_profile_operations = {
.read = read_cris_profile,
.write = write_cris_profile,
.llseek = default_llseek,
};
static int __init init_cris_profile(void)
{
struct proc_dir_entry *entry;
sample_buffer = kmalloc(SAMPLE_BUFFER_SIZE, GFP_KERNEL);
if (!sample_buffer) {
return -ENOMEM;
}
sample_buffer_pos = sample_buffer;
entry = proc_create("system_profile", S_IWUSR | S_IRUGO, NULL,
&cris_proc_profile_operations);
if (entry) {
proc_set_size(entry, SAMPLE_BUFFER_SIZE);
}
prof_running = 1;
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mikael Starvik | 55 | 74.32% | 1 | 25.00% |
Cyrill V. Gorcunov | 11 | 14.86% | 1 | 25.00% |
Geert Uytterhoeven | 4 | 5.41% | 1 | 25.00% |
Denis V. Lunev | 4 | 5.41% | 1 | 25.00% |
Total | 74 | 100.00% | 4 | 100.00% |
__initcall(init_cris_profile);
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mikael Starvik | 284 | 82.80% | 1 | 9.09% |
Akinobu Mita | 19 | 5.54% | 1 | 9.09% |
Cyrill V. Gorcunov | 11 | 3.21% | 1 | 9.09% |
Jesper Nilsson | 10 | 2.92% | 1 | 9.09% |
Arnd Bergmann | 5 | 1.46% | 1 | 9.09% |
Denis V. Lunev | 4 | 1.17% | 1 | 9.09% |
Geert Uytterhoeven | 4 | 1.17% | 1 | 9.09% |
Tejun Heo | 3 | 0.87% | 1 | 9.09% |
Greg Kroah-Hartman | 1 | 0.29% | 1 | 9.09% |
Arjan van de Ven | 1 | 0.29% | 1 | 9.09% |
Linus Torvalds | 1 | 0.29% | 1 | 9.09% |
Total | 343 | 100.00% | 11 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.