summaryrefslogtreecommitdiff
path: root/sampler
diff options
context:
space:
mode:
authorAlexander Aksenov <a.aksenov@samsung.com>2014-06-18 16:40:01 +0400
committerDmitry Kovalenko <d.kovalenko@samsung.com>2014-06-25 05:10:41 -0700
commit5fc10ca228ed7376a50269357853180e719cb271 (patch)
tree5137b7925d49b9bf297eadcef9ece74254387d53 /sampler
parent309bb87b7360dfa4937b036b08cb3dbffaa9f633 (diff)
downloadswap-modules-5fc10ca228ed7376a50269357853180e719cb271.tar.gz
swap-modules-5fc10ca228ed7376a50269357853180e719cb271.tar.bz2
swap-modules-5fc10ca228ed7376a50269357853180e719cb271.zip
[REFACTOR] Sampler: remove garbage
Change-Id: I0d976639257596027d716fda02b1fb6ac3ca0f1f Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
Diffstat (limited to 'sampler')
-rw-r--r--sampler/swap_sampler_module.c.orig247
1 files changed, 0 insertions, 247 deletions
diff --git a/sampler/swap_sampler_module.c.orig b/sampler/swap_sampler_module.c.orig
deleted file mode 100644
index 3c34f1de..00000000
--- a/sampler/swap_sampler_module.c.orig
+++ /dev/null
@@ -1,247 +0,0 @@
-#include <linux/timer.h>
-#include <asm/ptrace.h>
-#include <asm/processor.h>
-#include <asm/types.h>
-#include <linux/jiffies.h>
-#include <linux/cpumask.h>
-#include <linux/sched.h>
-#include <linux/hrtimer.h>
-#include <linux/notifier.h>
-#include <linux/kernel.h>
-#include <linux/smp.h>
-#include <linux/init.h>
-#include <linux/cpu.h>
-#include <linux/hash.h>
-#include <linux/list.h>
-#include <linux/module.h>
-
-#include <writer/swap_writer_module.h>
-
-#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
-static DEFINE_PER_CPU(struct hrtimer, dbi_hrtimer);
-static int dbi_hrtimer_running;
-#else
-//struct timer_list dbi_timer;
-static DEFINE_PER_CPU(struct timer_list, dbi_timer);
-static int dbi_timer_running;
-#endif
-
-static BLOCKING_NOTIFIER_HEAD(swap_sampler_notifier_list);
-
-
-#ifdef CONFIG_HIGH_RES_TIMERS
-static enum hrtimer_restart dbi_hrtimer_notify(struct hrtimer *hrtimer)
-{
- if (current)
- sample_msg(task_pt_regs(current));
-
- hrtimer_forward_now(hrtimer, ns_to_ktime(dbi_timer_quantum));
- return HRTIMER_RESTART;
-}
-
-static void __dbi_hrtimer_start(void *unused)
-{
- struct hrtimer *hrtimer = &__get_cpu_var(dbi_hrtimer);
-
- if (!dbi_hrtimer_running)
- return;
- hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
- hrtimer->function = dbi_hrtimer_notify;
- hrtimer_start(hrtimer, ns_to_ktime(dbi_timer_quantum), HRTIMER_MODE_REL_PINNED);
-}
-
-static int dbi_hrtimer_start(void)
-{
- get_online_cpus();
- dbi_hrtimer_running = 1;
- on_each_cpu(__dbi_hrtimer_start, NULL, 1);
- put_online_cpus();
-
- return E_SS_SUCCESS;
-}
-
-static void __dbi_hrtimer_stop(int cpu)
-{
- struct hrtimer *hrtimer = &per_cpu(dbi_hrtimer, cpu);
-
- if (!dbi_hrtimer_running)
- return;
- hrtimer_cancel(hrtimer);
-}
-
-static void dbi_hrtimer_stop(void)
-{
- int cpu;
-
- get_online_cpus();
- for_each_online_cpu(cpu)
- __dbi_hrtimer_stop(cpu);
- dbi_hrtimer_running = 0;
- put_online_cpus();
-}
-
-#else
-
-void dbi_write_sample_data(unsigned long data)
-{
- struct timer_list *timer = (struct timer_list *)data;
-
- if (current)
- sample_msg(task_pt_regs(current));
-
- // TODO: test pinning
- mod_timer_pinned(timer, jiffies + dbi_timer_quantum);
-}
-
-static void __dbi_timer_start(void *unused)
-{
- struct timer_list *timer = &__get_cpu_var(dbi_timer);
-
- if (!dbi_timer_running)
- return;
- init_timer(timer);
- timer->data = timer;
- timer->function = dbi_write_sample_data;
- // TODO: test pinning
- mod_timer_pinned(timer, jiffies + dbi_timer_quantum);
-}
-
-static int dbi_timer_start(void)
-{
- get_online_cpus();
- dbi_timer_running = 1;
- on_each_cpu(__dbi_timer_start, NULL, 1);
- put_online_cpus();
- return E_SS_SUCCESS;
-}
-
-static void __dbi_timer_stop(int cpu)
-{
- struct timer_list *timer = &per_cpu(dbi_timer, cpu);
-
- if (!dbi_timer_running)
- return;
- del_timer_sync(timer);
-}
-
-static void dbi_timer_stop(void)
-{
- int cpu;
-
- get_online_cpus();
- for_each_online_cpu(cpu)
- __dbi_timer_stop(cpu);
- dbi_timer_running = 0;
- put_online_cpus();
-}
-
-#endif
-
-static int __cpuinit dbi_cpu_notify(struct notifier_block *self,
- unsigned long action, void *hcpu)
-{
- long cpu = (long) hcpu;
-
- switch (action) {
- case CPU_ONLINE:
- case CPU_ONLINE_FROZEN:
-#ifdef CONFIG_HIGH_RES_TIMERS
- smp_call_function_single(cpu, __dbi_hrtimer_start, NULL, 1);
-#else
- smp_call_function_single(cpu, __dbi_timer_start, NULL, 1);
-#endif
- break;
- case CPU_DEAD:
- case CPU_DEAD_FROZEN:
-#ifdef CONFIG_HIGH_RES_TIMERS
- __dbi_hrtimer_stop(cpu);
-#else
- __dbi_timer_stop(cpu);
-#endif
- break;
- }
- return NOTIFY_OK;
-}
-
-static struct notifier_block __refdata dbi_cpu_notifier = {
- .notifier_call = dbi_cpu_notify,
-};
-
-int swap_sampler_start(unsigned int timer_quantum)
-{
- if (timer_quantum <= 0)
- return -E_SS_WRONG_QUANTUM;
-
- dbi_timer_quantum = timer_quantum;
-
- if (!try_module_get(THIS_MODULE))
- print_err("Error of try_module_get() for sampling module\n");
-
-#ifdef CONFIG_HIGH_RES_TIMERS
- dbi_hrtimer_start();
-#else
- dbi_timer_start();
-#endif
-
- return E_SS_SUCCESS;
-}
-<<<<<<< Updated upstream
-EXPORT_SYMBOL_GPL(swap_sampler_start);
-=======
-EXPORT_SYMBOL_GPL(swap_sampler_start)
->>>>>>> Stashed changes
-
-int swap_sampler_stop(void)
-{
-#ifdef CONFIG_HIGH_RES_TIMERS
- dbi_hrtimer_stop();
-#else
- dbi_timer_stop();
-#endif
- module_put(THIS_MODULE);
-
- return E_SS_SUCCESS;
-}
-<<<<<<< Updated upstream
-EXPORT_SYMBOL_GPL(swap_sampler_stop);
-=======
-EXPORT_SYMBOL_GPL(swap_sampler_stop)
->>>>>>> Stashed changes
-
-static int __init sampler_init(void)
-{
- int retval;
-
- retval = register_hotcpu_notifier(&dbi_cpu_notifier);
- if (retval) {
- print_err("Error of register_hotcpu_notifier()\n");
- return retval;
- }
-
- print_msg("Sample ininitialization success\n");
-
- return E_SS_SUCCESS;
-}
-
-static void __exit sampler_exit(void)
-{
- unregister_hotcpu_notifier(&dbi_cpu_notifier);
-
- swap_sampler_stop();
-
- print_msg("Sampler uninitialized\n");
-}
-
-module_init(sampler_init);
-module_exit(sampler_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("SWAP sampling module");
-MODULE_AUTHOR("Andreev S.V., Aksenov A.S.");