2 * drivers/misc/tegra-profiler/hrt.h
4 * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
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.
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
22 #include <linux/hrtimer.h>
23 #include <linux/limits.h>
25 #include "backtrace.h"
27 struct quadd_thread_data {
32 struct quadd_cpu_context {
33 struct hrtimer hrtimer;
35 struct quadd_callchain cc;
36 char mmap_filename[PATH_MAX];
38 struct quadd_thread_data active_thread;
44 struct quadd_hrt_ctx {
45 struct quadd_cpu_context __percpu *cpu_ctx;
48 unsigned long low_addr;
50 struct quadd_ctx *quadd_ctx;
53 atomic_t nr_active_all_core;
55 atomic64_t counter_samples;
56 atomic64_t skipped_samples;
58 struct timer_list ma_timer;
59 unsigned int ma_period;
61 unsigned long vm_size_prev;
62 unsigned long rss_size_prev;
64 struct timecounter *tc;
67 struct quadd_unw_methods um;
71 #define QUADD_HRT_MIN_FREQ 100
73 #define QUADD_U32_MAX (~(__u32)0)
76 struct quadd_record_data;
77 struct quadd_module_state;
80 struct quadd_hrt_ctx *quadd_hrt_init(struct quadd_ctx *ctx);
81 void quadd_hrt_deinit(void);
83 int quadd_hrt_start(void);
84 void quadd_hrt_stop(void);
87 quadd_put_sample_cur_cpu(struct quadd_record_data *data,
88 struct quadd_iovec *vec, int vec_count);
90 quadd_put_sample(struct quadd_record_data *data,
91 struct quadd_iovec *vec, int vec_count);
93 void quadd_hrt_get_state(struct quadd_module_state *state);
94 u64 quadd_get_time(void);
96 #endif /* __KERNEL__ */
98 #endif /* __QUADD_HRT_H */