-/*
- * SWAP sampler
- * modules/sampler/kernel_operations.h
+/**
+ * @file sampler/kernel_operations.h
+ * @author Alexander Aksenov <a.aksenov@samsung.com>
+ *
+ * @section LICENSE
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Alexander Aksenov <a.aksenov@samsung.com>: SWAP samler kernel
- * operations implement
+ * @section DESCRIPTION
*
+ * Parser definitions.
*/
#ifndef __KERNEL_OPERATIONS_H__
#include <linux/kernel.h>
+/** Prints debug message.*/
#define print_debug(msg, args...) \
printk(KERN_DEBUG "SWAP_SAMPLER DEBUG : " msg, ##args)
+/** Prints info message.*/
#define print_msg(msg, args...) \
printk(KERN_INFO "SWAP_SAMPLER : " msg, ##args)
+/** Prints warning message.*/
#define print_warn(msg, args...) \
printk(KERN_WARNING "SWAP_SAMPLER WARNING : " msg, ##args)
+/** Prints error message.*/
#define print_err(msg, args...) \
printk(KERN_ERR "SWAP_SAMPLER ERROR : " msg, ##args)
+/** Prints critical error message.*/
#define print_crit(msg, args...) \
printk(KERN_CRIT "SWAP_SAMPLER CRITICAL : " msg, ##args)
-/*
- * SWAP sampler
- * modules/sampler/sampler_hrtimer.c
+/**
+ * sampler/sampler_hrtimer.c
+ * @author Alexander Aksenov <a.aksenov@samsung.com>
+ *
+ * @section LICENSE
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Alexander Aksenov <a.aksenov@samsung.com>: SWAP sampler porting
+ * @section DESCRIPTION
*
+ * Sampler for high resolution timers.
*/
static DEFINE_PER_CPU(struct hrtimer, swap_hrtimer);
static int swap_hrtimer_running;
+/**
+ * @brief Restarts sampling.
+ *
+ * @param timer Pointer to hrtimer struct.
+ * @return hrtimer_restart flag.
+ */
restart_ret sampler_timers_restart(swap_timer *timer)
{
restart_ret ret;
return ret;
}
-
+/**
+ * @brief Sets running flag true.
+ *
+ * @return Void.
+ */
void sampler_timers_set_run(void)
{
swap_hrtimer_running = 1;
}
-
+/**
+ * @brief Sets running flag false.
+ *
+ * @return Void.
+ */
void sampler_timers_set_stop(void)
{
swap_hrtimer_running = 0;
}
-
+/**
+ * @brief Starts timer sampling.
+ *
+ * @param restart_func Pointer to restart function.
+ * @return Void.
+ */
void sampler_timers_start(void *restart_func)
{
struct hrtimer *hrtimer = &__get_cpu_var(swap_hrtimer);
HRTIMER_MODE_REL_PINNED);
}
-
+/**
+ * @brief Stops timer sampling.
+ *
+ * @param cpu Online CPUs.
+ * @return Void.
+ */
void sampler_timers_stop(int cpu)
{
struct hrtimer *hrtimer = &per_cpu(swap_hrtimer, cpu);
hrtimer_cancel(hrtimer);
}
-
+/**
+ * @brief Sets timer quantum.
+ *
+ * @param timer_quantum Timer quantum.
+ * @return Void.
+ */
void sampler_timers_set_quantum(unsigned int timer_quantum)
{
sampler_timer_quantum = timer_quantum * 1000 * 1000;
-/*
- * SWAP sampler
- * modules/sampler/sampler_timer.c
+/**
+ * sampler/sampler_timer.c
+ * @author Alexander Aksenov <a.aksenov@samsung.com>
+ *
+ * @section LICENSE
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Alexander Aksenov <a.aksenov@samsung.com>: SWAP sampler porting
+ * @section DESCRIPTION
*
+ * Sampler based on common timers.
*/
static DEFINE_PER_CPU(struct timer_list, swap_timer);
static int swap_timer_running;
-
+/**
+ * @brief Restarts sampling.
+ *
+ * @param timer Pointer to timer_list struct.
+ * @return 0.
+ */
restart_ret sampler_timers_restart(swap_timer *timer)
{
restart_ret ret;
return ret;
}
-
+/**
+ * @brief Sets running flag true.
+ *
+ * @return Void.
+ */
void sampler_timers_set_run(void)
{
swap_timer_running = 1;
}
-
+/**
+ * @brief Sets running flag false.
+ *
+ * @return Void.
+ */
void sampler_timers_set_stop(void)
{
swap_timer_running = 0;
}
-
+/**
+ * @brief Starts timer sampling.
+ *
+ * @param restart_func Pointer to restart function.
+ * @return Void.
+ */
void sampler_timers_start(void *restart_func)
{
struct timer_list *timer = &__get_cpu_var(swap_timer);
mod_timer_pinned(timer, jiffies + sampler_timer_quantum);
}
-
+/**
+ * @brief Stops timer sampling.
+ *
+ * @param cpu Online CPUs.
+ * @return Void.
+ */
void sampler_timers_stop(int cpu)
{
struct timer_list *timer = &per_cpu(swap_timer, cpu);
del_timer_sync(timer);
}
-
+/**
+ * @brief Sets timer quantum.
+ *
+ * @param timer_quantum Timer quantum.
+ * @return Void.
+ */
void sampler_timers_set_quantum(unsigned int timer_quantum)
{
sampler_timer_quantum = timer_quantum;
-/*
- * SWAP Sampler
- * modules/sampler/swap_sampler_errors.h
+/**
+ * @file sampler/swap_sampler_errors.h
+ * @author Alexander Aksenov <a.aksenov@samsung.com>
+ *
+ * @section LICENSE
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Alexander Aksenov <a.aksenov@samsung.com>: Implement SWAP sampler
- * errors file
+ * @section DESCRIPTION
*
+ * Sampler error codes.
*/
+/**
+ * @enum _swap_sampler_errors
+ * @brief Sampler errors.
+ */
enum _swap_sampler_errors {
- E_SS_SUCCESS = 0, /* Success */
- E_SS_WRONG_QUANTUM = 1 /* Wrong timer quantum set */
+ E_SS_SUCCESS = 0, /**< Success. */
+ E_SS_WRONG_QUANTUM = 1 /**< Wrong timer quantum set. */
};
-/*
- * SWAP sampler
- * modules/sampler/swap_sampler_module.c
+/**
+ * sampler/swap_sampler_module.c
+ * @author Andreev S.V.: SWAP Sampler implementation
+ * @author Alexander Aksenov <a.aksenov@samsung.com>: SWAP sampler porting
+ *
+ * @section LICENSE
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2012 Andreev S.V.: SWAP Sampler implementation
- * 2013 Alexander Aksenov <a.aksenov@samsung.com>: SWAP sampler porting
+ * @section DESCRIPTION
*
+ * Timer-based sampling module.
*/
#include <asm/ptrace.h>
static DEFINE_MUTEX(mutex_run);
static int sampler_run = 0;
+
+/**
+ * @brief Starts sampling with specified timer quantum.
+ *
+ * @param timer_quantum Timer quantum for sampling.
+ * @return 0 on success, error code on error.
+ */
int swap_sampler_start(unsigned int timer_quantum)
{
int ret = -EINVAL;
}
EXPORT_SYMBOL_GPL(swap_sampler_start);
+
+/**
+ * @brief Stops sampling.
+ *
+ * @return 0 on success, error code on error.
+ */
int swap_sampler_stop(void)
{
int ret = 0;
-/*
- * SWAP Sampler
- * modules/sampler/swap_sampler_module.h
+/**
+ * @file sampler/swap_sampler_module.h
+ * @author Alexander Aksenov <a.aksenov@samsung.com>
+ *
+ * @section LICENSE
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+ * @section COPYRIGHT
+ *
* Copyright (C) Samsung Electronics, 2013
*
- * 2013 Alexander Aksenov <a.aksenov@samsung.com>: Implement SWAP Sampler
- * interface
+ * @section DESCRIPTION
*
+ * Sampling module interface declaration.
*/