Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
0bbf5c7
Documentation
arch
block
crypto
drivers
accessibility
acpi
amba
ata
atm
auxdisplay
base
bcma
block
bluetooth
cdrom
char
clk
clocksource
connector
cpufreq
cpuidle
crypto
dca
dio
dma
edac
eisa
firewire
firmware
gpio
gpu
hid
hwmon
hwspinlock
i2c
ide
idle
ieee802154
infiniband
input
isdn
leds
lguest
macintosh
mca
md
media
memstick
message
mfd
misc
mmc
mtd
net
nfc
nubus
of
oprofile
buffer_sync.c
buffer_sync.h
cpu_buffer.c
cpu_buffer.h
event_buffer.c
event_buffer.h
oprof.c
oprof.h
oprofile_files.c
oprofile_perf.c
oprofile_stats.c
oprofile_stats.h
oprofilefs.c
timer_int.c
parisc
parport
pci
pcmcia
platform
pnp
power
pps
ps3
ptp
rapidio
regulator
rtc
s390
sbus
scsi
sfi
sh
sn
spi
ssb
staging
target
tc
telephony
thermal
tty
uio
usb
uwb
vhost
video
virtio
vlynq
w1
watchdog
xen
zorro
Kconfig
Makefile
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
drivers
/
oprofile
/
timer_int.c
Blame
Blame
Latest commit
History
History
120 lines (100 loc) · 2.47 KB
Breadcrumbs
linux
/
drivers
/
oprofile
/
timer_int.c
Top
File metadata and controls
Code
Blame
120 lines (100 loc) · 2.47 KB
Raw
/** * @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; } static void __oprofile_hrtimer_start(void *unused) { struct hrtimer *hrtimer = &__get_cpu_var(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); } 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; } static void __oprofile_hrtimer_stop(int cpu) { struct hrtimer *hrtimer = &per_cpu(oprofile_hrtimer, cpu); if (!ctr_running) return; hrtimer_cancel(hrtimer); } 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(); } static int __cpuinit 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; } static struct notifier_block __refdata oprofile_cpu_notifier = { .notifier_call = oprofile_cpu_notify, }; int oprofile_timer_init(struct oprofile_operations *ops) { int rc; rc = register_hotcpu_notifier(&oprofile_cpu_notifier); if (rc) return rc; ops->create_files = NULL; ops->setup = NULL; ops->shutdown = NULL; ops->start = oprofile_hrtimer_start; ops->stop = oprofile_hrtimer_stop; ops->cpu_type = "timer"; printk(KERN_INFO "oprofile: using timer interrupt.\n"); return 0; } void oprofile_timer_exit(void) { unregister_hotcpu_notifier(&oprofile_cpu_notifier); }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
You can’t perform that action at this time.