From 652a641e51a2693d476c7754b2041783dffc235c Mon Sep 17 00:00:00 2001 From: Alexander Aksenov Date: Sat, 13 Jul 2013 17:28:12 +0400 Subject: [PATCH] [FIX] SWAP sampler now uses writer and is compilible --- sampler/Makefile.am | 2 +- sampler/swap_sampler_module.c | 37 +++++++++---------------------------- sampler/swap_sampler_module.h | 5 +++++ 3 files changed, 15 insertions(+), 29 deletions(-) diff --git a/sampler/Makefile.am b/sampler/Makefile.am index 950f6a5..583dd16 100644 --- a/sampler/Makefile.am +++ b/sampler/Makefile.am @@ -5,7 +5,7 @@ module_dir = $(realpath $(top_srcdir)/src/modules/sampler) module_name = swap_sampler cross_compiler = $(subst gcc,,$(CC)) -#inlude_opt = -I$(realpath $(top_srcdir)/src/modules/) +inlude_opt = -I$(realpath $(top_srcdir)/src/modules/) extra_cflags = "$(inlude_opt) $(board_opt)" all-local: diff --git a/sampler/swap_sampler_module.c b/sampler/swap_sampler_module.c index 3a7d098..d4172b3 100644 --- a/sampler/swap_sampler_module.c +++ b/sampler/swap_sampler_module.c @@ -1,16 +1,3 @@ - -/* - * Sampling implementation for SWAP - * Two approach: timer-based and event-based on counters callbacks - * - * NOTE: -* 1. timer-based approach uses high resolution timers if its available - * 2. event-based approach that uses counters overflow callbacks doesn't work - * on some hardware; it requires PMU functionality for work - * - * Written by Andreev S.V., 2012 - */ - #include #include #include @@ -26,13 +13,15 @@ #include #include #include - #include +#include + #include "swap_sampler_module.h" #include "swap_sampler_errors.h" #include "kernel_operations.h" + unsigned int dbi_timer_quantum = 0; #ifdef CONFIG_HIGH_RES_TIMERS @@ -50,13 +39,8 @@ static BLOCKING_NOTIFIER_HEAD(swap_sampler_notifier_list); #ifdef CONFIG_HIGH_RES_TIMERS static enum hrtimer_restart dbi_hrtimer_notify(struct hrtimer *hrtimer) { -#ifdef CONFIG_ARM - print_debug("lr : 0x%x, pc : 0x%x\n", (task_pt_regs(current))->ARM_lr, - (task_pt_regs(current))->ARM_pc); -#elif CONFIG_X86 - print_debug("lr : 0x%x, pc : 0x%x\n", (task_pt_regs(current))->sp, - (task_pt_regs(current))->bp); -#endif /* CONFIG_arch */ + if (current) + sample_msg(task_pt_regs(current)); hrtimer_forward_now(hrtimer, ns_to_ktime(dbi_timer_quantum)); return HRTIMER_RESTART; @@ -109,13 +93,8 @@ void dbi_write_sample_data(unsigned long data) { struct timer_list *timer = (struct timer_list *)data; -#ifdef CONFIG_ARM - print_debug("lr : 0x%x, pc : 0x%x\n", (task_pt_regs(current))->ARM_lr, - (task_pt_regs(current))->ARM_pc); -#elif CONFIG_X86 - print_debug("lr : 0x%x, pc : 0x%x\n", (task_pt_regs(current))->sp, - (task_pt_regs(current))->bp); -#endif /* CONFIG_arch */ + if (current) + sample_msg(task_pt_regs(current)); // TODO: test pinning mod_timer_pinned(timer, jiffies + dbi_timer_quantum); @@ -213,6 +192,7 @@ int swap_sampler_start(unsigned int timer_quantum) return E_SS_SUCCESS; } +EXPORT_SYMBOL_GPL(swap_sampler_start); int swap_sampler_stop(void) { @@ -225,6 +205,7 @@ int swap_sampler_stop(void) return E_SS_SUCCESS; } +EXPORT_SYMBOL_GPL(swap_sampler_stop); static int __init sampler_init(void) { diff --git a/sampler/swap_sampler_module.h b/sampler/swap_sampler_module.h index c534102..3768ba4 100644 --- a/sampler/swap_sampler_module.h +++ b/sampler/swap_sampler_module.h @@ -1,7 +1,12 @@ /* SWAP Sampler interface */ +#ifndef __SWAP_SAMPLER_MODULE_H__ +#define __SWAP_SAMPLER_MODULE_H__ + /* Starts the SWAP Sampler */ int swap_sampler_start(unsigned int timer_quantum); /* Stops the SWAP Sampler */ int swap_sampler_stop(void); + +#endif /* __SWAP_SAMPLER_MODULE_H__ */ -- 2.7.4