Blame view
drivers/oprofile/oprofile_stats.c
2.25 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
/** * @file oprofile_stats.c * * @remark Copyright 2002 OProfile authors * @remark Read the file COPYING * * @author John Levon */ #include <linux/oprofile.h> #include <linux/smp.h> #include <linux/cpumask.h> #include <linux/threads.h> |
6a18037d4 oprofile: fixing ... |
14 |
|
1da177e4c Linux-2.6.12-rc2 |
15 16 |
#include "oprofile_stats.h" #include "cpu_buffer.h" |
6a18037d4 oprofile: fixing ... |
17 |
|
1da177e4c Linux-2.6.12-rc2 |
18 |
struct oprofile_stat_struct oprofile_stats; |
6a18037d4 oprofile: fixing ... |
19 |
|
1da177e4c Linux-2.6.12-rc2 |
20 21 |
void oprofile_reset_stats(void) { |
25ad2913c oprofile: more wh... |
22 |
struct oprofile_cpu_buffer *cpu_buf; |
1da177e4c Linux-2.6.12-rc2 |
23 |
int i; |
6a18037d4 oprofile: fixing ... |
24 |
|
fe449f483 [PATCH] for_each_... |
25 |
for_each_possible_cpu(i) { |
b3e9f672b percpu: make perc... |
26 |
cpu_buf = &per_cpu(op_cpu_buffer, i); |
1da177e4c Linux-2.6.12-rc2 |
27 28 |
cpu_buf->sample_received = 0; cpu_buf->sample_lost_overflow = 0; |
df9d177aa oProfile: oops wh... |
29 30 |
cpu_buf->backtrace_aborted = 0; cpu_buf->sample_invalid_eip = 0; |
1da177e4c Linux-2.6.12-rc2 |
31 |
} |
6a18037d4 oprofile: fixing ... |
32 |
|
1da177e4c Linux-2.6.12-rc2 |
33 34 35 |
atomic_set(&oprofile_stats.sample_lost_no_mm, 0); atomic_set(&oprofile_stats.sample_lost_no_mapping, 0); atomic_set(&oprofile_stats.event_lost_overflow, 0); |
2b8777ca0 oprofile: reset b... |
36 |
atomic_set(&oprofile_stats.bt_lost_no_mapping, 0); |
1b294f596 oprofile: Adding ... |
37 |
atomic_set(&oprofile_stats.multiplex_counter, 0); |
1da177e4c Linux-2.6.12-rc2 |
38 |
} |
40437c718 don't bother with... |
39 |
void oprofile_create_stats_files(struct dentry *root) |
1da177e4c Linux-2.6.12-rc2 |
40 |
{ |
25ad2913c oprofile: more wh... |
41 42 43 |
struct oprofile_cpu_buffer *cpu_buf; struct dentry *cpudir; struct dentry *dir; |
1da177e4c Linux-2.6.12-rc2 |
44 45 |
char buf[10]; int i; |
ecde28237 oprofilefs_mkdir(... |
46 |
dir = oprofilefs_mkdir(root, "stats"); |
1da177e4c Linux-2.6.12-rc2 |
47 48 |
if (!dir) return; |
fe449f483 [PATCH] for_each_... |
49 |
for_each_possible_cpu(i) { |
b3e9f672b percpu: make perc... |
50 |
cpu_buf = &per_cpu(op_cpu_buffer, i); |
1da177e4c Linux-2.6.12-rc2 |
51 |
snprintf(buf, 10, "cpu%d", i); |
ecde28237 oprofilefs_mkdir(... |
52 |
cpudir = oprofilefs_mkdir(dir, buf); |
6a18037d4 oprofile: fixing ... |
53 |
|
1da177e4c Linux-2.6.12-rc2 |
54 55 56 57 |
/* Strictly speaking access to these ulongs is racy, * but we can't simply lock them, and they are * informational only. */ |
6af4ea0ba oprofilefs_create... |
58 |
oprofilefs_create_ro_ulong(cpudir, "sample_received", |
1da177e4c Linux-2.6.12-rc2 |
59 |
&cpu_buf->sample_received); |
6af4ea0ba oprofilefs_create... |
60 |
oprofilefs_create_ro_ulong(cpudir, "sample_lost_overflow", |
1da177e4c Linux-2.6.12-rc2 |
61 |
&cpu_buf->sample_lost_overflow); |
6af4ea0ba oprofilefs_create... |
62 |
oprofilefs_create_ro_ulong(cpudir, "backtrace_aborted", |
1da177e4c Linux-2.6.12-rc2 |
63 |
&cpu_buf->backtrace_aborted); |
6af4ea0ba oprofilefs_create... |
64 |
oprofilefs_create_ro_ulong(cpudir, "sample_invalid_eip", |
df9d177aa oProfile: oops wh... |
65 |
&cpu_buf->sample_invalid_eip); |
1da177e4c Linux-2.6.12-rc2 |
66 |
} |
6a18037d4 oprofile: fixing ... |
67 |
|
6af4ea0ba oprofilefs_create... |
68 |
oprofilefs_create_ro_atomic(dir, "sample_lost_no_mm", |
1da177e4c Linux-2.6.12-rc2 |
69 |
&oprofile_stats.sample_lost_no_mm); |
6af4ea0ba oprofilefs_create... |
70 |
oprofilefs_create_ro_atomic(dir, "sample_lost_no_mapping", |
1da177e4c Linux-2.6.12-rc2 |
71 |
&oprofile_stats.sample_lost_no_mapping); |
6af4ea0ba oprofilefs_create... |
72 |
oprofilefs_create_ro_atomic(dir, "event_lost_overflow", |
1da177e4c Linux-2.6.12-rc2 |
73 |
&oprofile_stats.event_lost_overflow); |
6af4ea0ba oprofilefs_create... |
74 |
oprofilefs_create_ro_atomic(dir, "bt_lost_no_mapping", |
1da177e4c Linux-2.6.12-rc2 |
75 |
&oprofile_stats.bt_lost_no_mapping); |
4d4036e0e oprofile: Impleme... |
76 |
#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX |
6af4ea0ba oprofilefs_create... |
77 |
oprofilefs_create_ro_atomic(dir, "multiplex_counter", |
1b294f596 oprofile: Adding ... |
78 |
&oprofile_stats.multiplex_counter); |
4d4036e0e oprofile: Impleme... |
79 |
#endif |
1da177e4c Linux-2.6.12-rc2 |
80 |
} |