cregit-Linux how code gets into the kernel

Release 4.11 drivers/oprofile/timer_int.c

Directory: drivers/oprofile
/**
 * @file timer_int.c
 *
 * @remark Copyright 2002 OProfile authors
 * @remark Read the file COPYING
 *
 * @author John Levon <levon@movementarian.org>
 */

#include <linux/kernel.h>
#include <linux/notifier.h>
#include <linux/smp.h>
#include <linux/oprofile.h>
#include <linux/profile.h>
#include <linux/init.h>
#include <linux/cpu.h>
#include <linux/hrtimer.h>
#include <asm/irq_regs.h>
#include <asm/ptrace.h>

#include "oprof.h"

static DEFINE_PER_CPU(struct hrtimer, oprofile_hrtimer);

static int ctr_running;


static enum hrtimer_restart oprofile_hrtimer_notify(struct hrtimer *hrtimer) { oprofile_add_sample(get_irq_regs(), 0); hrtimer_forward_now(hrtimer, ns_to_ktime(TICK_NSEC)); return HRTIMER_RESTART; }

Contributors

PersonTokensPropCommitsCommitProp
Martin Schwidefsky1854.55%133.33%
John Levon1339.39%133.33%
Jesse Barnes26.06%133.33%
Total33100.00%3100.00%


static void __oprofile_hrtimer_start(void *unused) { struct hrtimer *hrtimer = this_cpu_ptr(&oprofile_hrtimer); if (!ctr_running) return; hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); hrtimer->function = oprofile_hrtimer_notify; hrtimer_start(hrtimer, ns_to_ktime(TICK_NSEC), HRTIMER_MODE_REL_PINNED); }

Contributors

PersonTokensPropCommitsCommitProp
Martin Schwidefsky4685.19%133.33%
Santosh Shilimkar611.11%133.33%
Christoph Lameter23.70%133.33%
Total54100.00%3100.00%


static int oprofile_hrtimer_start(void) { get_online_cpus(); ctr_running = 1; on_each_cpu(__oprofile_hrtimer_start, NULL, 1); put_online_cpus(); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
John Levon1033.33%133.33%
Santosh Shilimkar1033.33%133.33%
Martin Schwidefsky1033.33%133.33%
Total30100.00%3100.00%


static void __oprofile_hrtimer_stop(int cpu) { struct hrtimer *hrtimer = &per_cpu(oprofile_hrtimer, cpu); if (!ctr_running) return; hrtimer_cancel(hrtimer); }

Contributors

PersonTokensPropCommitsCommitProp
Martin Schwidefsky2781.82%150.00%
Santosh Shilimkar618.18%150.00%
Total33100.00%2100.00%


static void oprofile_hrtimer_stop(void) { int cpu; get_online_cpus(); for_each_online_cpu(cpu) __oprofile_hrtimer_stop(cpu); ctr_running = 0; put_online_cpus(); }

Contributors

PersonTokensPropCommitsCommitProp
Santosh Shilimkar1033.33%133.33%
John Levon1033.33%133.33%
Martin Schwidefsky1033.33%133.33%
Total30100.00%3100.00%


static int oprofile_timer_online(unsigned int cpu) { local_irq_disable(); __oprofile_hrtimer_start(NULL); local_irq_enable(); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Sebastian Andrzej Siewior1458.33%150.00%
Martin Schwidefsky1041.67%150.00%
Total24100.00%2100.00%


static int oprofile_timer_prep_down(unsigned int cpu) { __oprofile_hrtimer_stop(cpu); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Sebastian Andrzej Siewior1055.56%150.00%
Martin Schwidefsky844.44%150.00%
Total18100.00%2100.00%

static enum cpuhp_state hp_online;
static int oprofile_hrtimer_setup(void) { int ret; ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "oprofile/timer:online", oprofile_timer_online, oprofile_timer_prep_down); if (ret < 0) return ret; hp_online = ret; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Sebastian Andrzej Siewior2972.50%125.00%
Robert Richter410.00%125.00%
Martin Schwidefsky410.00%125.00%
John Levon37.50%125.00%
Total40100.00%4100.00%


static void oprofile_hrtimer_shutdown(void) { cpuhp_remove_state_nocalls(hp_online); }

Contributors

PersonTokensPropCommitsCommitProp
Robert Richter1184.62%150.00%
Sebastian Andrzej Siewior215.38%150.00%
Total13100.00%2100.00%


int oprofile_timer_init(struct oprofile_operations *ops) { ops->create_files = NULL; ops->setup = oprofile_hrtimer_setup; ops->shutdown = oprofile_hrtimer_shutdown; ops->start = oprofile_hrtimer_start; ops->stop = oprofile_hrtimer_stop; ops->cpu_type = "timer"; printk(KERN_INFO "oprofile: using timer interrupt.\n"); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Robert Richter2341.82%342.86%
Greg Banks2240.00%228.57%
Martin Schwidefsky610.91%114.29%
John Levon47.27%114.29%
Total55100.00%7100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Martin Schwidefsky15941.62%18.33%
Sebastian Andrzej Siewior5815.18%18.33%
John Levon5614.66%18.33%
Robert Richter389.95%325.00%
Santosh Shilimkar369.42%18.33%
Greg Banks256.54%216.67%
David S. Miller61.57%18.33%
Christoph Lameter20.52%18.33%
Jesse Barnes20.52%18.33%
Total382100.00%12100.00%
Directory: drivers/oprofile
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.