]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/blob - drivers/misc/tegra-profiler/hrt.h
ef1f6738baaaa4ee0e0f97b969bc56b0635fb6aa
[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) 2014, 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 quadd_hrt_ctx {
43         struct quadd_cpu_context * __percpu cpu_ctx;
44         u64 sample_period;
45
46         struct quadd_ctx *quadd_ctx;
47
48         int active;
49         atomic64_t counter_samples;
50         atomic_t nr_active_all_core;
51
52         struct timer_list ma_timer;
53         unsigned int ma_period;
54
55         unsigned long vm_size_prev;
56         unsigned long rss_size_prev;
57 };
58
59 #define QUADD_HRT_MIN_FREQ      100
60
61 #define QUADD_U32_MAX (~(__u32)0)
62
63 struct quadd_hrt_ctx;
64 struct quadd_record_data;
65 struct quadd_module_state;
66 struct quadd_iovec;
67
68 struct quadd_hrt_ctx *quadd_hrt_init(struct quadd_ctx *ctx);
69 void quadd_hrt_deinit(void);
70
71 int quadd_hrt_start(void);
72 void quadd_hrt_stop(void);
73
74 void quadd_put_sample(struct quadd_record_data *data,
75                       struct quadd_iovec *vec, int vec_count);
76
77 void quadd_hrt_get_state(struct quadd_module_state *state);
78 u64 quadd_get_time(void);
79
80 #endif  /* __KERNEL__ */
81
82 #endif  /* __QUADD_HRT_H */