cregit-Linux how code gets into the kernel

Release 4.7 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 schwidefskymartin schwidefsky1854.55%133.33%
john levonjohn levon1339.39%133.33%
jesse barnesjesse 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 schwidefskymartin schwidefsky4685.19%133.33%
santosh shilimkarsantosh shilimkar611.11%133.33%
christoph lameterchristoph 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 levonjohn levon1033.33%133.33%
santosh shilimkarsantosh shilimkar1033.33%133.33%
martin schwidefskymartin 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 schwidefskymartin schwidefsky2781.82%150.00%
santosh shilimkarsantosh 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
martin schwidefskymartin schwidefsky1033.33%133.33%
john levonjohn levon1033.33%133.33%
santosh shilimkarsantosh shilimkar1033.33%133.33%
Total30100.00%3100.00%


static int oprofile_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) { long cpu = (long) hcpu; switch (action) { case CPU_ONLINE: case CPU_ONLINE_FROZEN: smp_call_function_single(cpu, __oprofile_hrtimer_start, NULL, 1); break; case CPU_DEAD: case CPU_DEAD_FROZEN: __oprofile_hrtimer_stop(cpu); break; } return NOTIFY_OK; }

Contributors

PersonTokensPropCommitsCommitProp
martin schwidefskymartin schwidefsky6598.48%150.00%
john levonjohn levon11.52%150.00%
Total66100.00%2100.00%

static struct notifier_block __refdata oprofile_cpu_notifier = { .notifier_call = oprofile_cpu_notify, };
static int oprofile_hrtimer_setup(void) { return register_hotcpu_notifier(&oprofile_cpu_notifier); }

Contributors

PersonTokensPropCommitsCommitProp
martin schwidefskymartin schwidefsky746.67%133.33%
robert richterrobert richter533.33%133.33%
john levonjohn levon320.00%133.33%
Total15100.00%3100.00%


static void oprofile_hrtimer_shutdown(void) { unregister_hotcpu_notifier(&oprofile_cpu_notifier); }

Contributors

PersonTokensPropCommitsCommitProp
robert richterrobert richter14100.00%1100.00%
Total14100.00%1100.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 richterrobert richter2341.82%342.86%
greg banksgreg banks2240.00%228.57%
martin schwidefskymartin schwidefsky610.91%114.29%
john levonjohn levon47.27%114.29%
Total55100.00%7100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
martin schwidefskymartin schwidefsky22056.41%19.09%
john levonjohn levon5714.62%19.09%
robert richterrobert richter4210.77%327.27%
santosh shilimkarsantosh shilimkar369.23%19.09%
greg banksgreg banks256.41%218.18%
david s. millerdavid s. miller61.54%19.09%
christoph lameterchristoph lameter20.51%19.09%
jesse barnesjesse barnes20.51%19.09%
Total390100.00%11100.00%
Directory: drivers/oprofile
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}