]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/blob - drivers/misc/tegra-profiler/hrt.h
misc: tegra-profiler: add unwind reason codes
[sojka/nv-tegra/linux-3.10.git] / drivers / misc / tegra-profiler / hrt.h
1 /*
2  * drivers/misc/tegra-profiler/hrt.h
3  *
4  * Copyright (c) 2015, NVIDIA CORPORATION.  All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  */
16
17 #ifndef __QUADD_HRT_H
18 #define __QUADD_HRT_H
19
20 #ifdef __KERNEL__
21
22 #include <linux/hrtimer.h>
23 #include <linux/limits.h>
24
25 #include "backtrace.h"
26
27 struct quadd_thread_data {
28         pid_t pid;
29         pid_t tgid;
30 };
31
32 struct quadd_cpu_context {
33         struct hrtimer hrtimer;
34
35         struct quadd_callchain cc;
36         char mmap_filename[PATH_MAX];
37
38         struct quadd_thread_data active_thread;
39         atomic_t nr_active;
40 };
41
42 struct timecounter;
43
44 struct quadd_hrt_ctx {
45         struct quadd_cpu_context __percpu *cpu_ctx;
46
47         u64 sample_period;
48         unsigned long low_addr;
49
50         struct quadd_ctx *quadd_ctx;
51
52         atomic_t active;
53         atomic_t nr_active_all_core;
54
55         atomic64_t counter_samples;
56         atomic64_t skipped_samples;
57
58         struct timer_list ma_timer;
59         unsigned int ma_period;
60
61         unsigned long vm_size_prev;
62         unsigned long rss_size_prev;
63
64         struct timecounter *tc;
65         int use_arch_timer;
66
67         struct quadd_unw_methods um;
68         int get_stack_offset;
69 };
70
71 #define QUADD_HRT_MIN_FREQ      100
72
73 #define QUADD_U32_MAX (~(__u32)0)
74
75 struct quadd_hrt_ctx;
76 struct quadd_record_data;
77 struct quadd_module_state;
78 struct quadd_iovec;
79
80 struct quadd_hrt_ctx *quadd_hrt_init(struct quadd_ctx *ctx);
81 void quadd_hrt_deinit(void);
82
83 int quadd_hrt_start(void);
84 void quadd_hrt_stop(void);
85
86 void
87 quadd_put_sample_cur_cpu(struct quadd_record_data *data,
88                          struct quadd_iovec *vec, int vec_count);
89 void
90 quadd_put_sample(struct quadd_record_data *data,
91                  struct quadd_iovec *vec, int vec_count);
92
93 void quadd_hrt_get_state(struct quadd_module_state *state);
94 u64 quadd_get_time(void);
95
96 #endif  /* __KERNEL__ */
97
98 #endif  /* __QUADD_HRT_H */