From 961660eb20fbf0d82d13a1bda82435b7f5756760 Mon Sep 17 00:00:00 2001 From: Alexander Aksenov Date: Mon, 7 Jul 2014 14:33:40 +0400 Subject: [PATCH] [STYLE] Sampler: doxygen comments Change-Id: I9463827b6cc73fe05d6d860bf32bba19cea3ede3 Signed-off-by: Alexander Aksenov --- sampler/kernel_operations.h | 19 ++++++++++++---- sampler/sampler_hrtimer.c | 52 ++++++++++++++++++++++++++++++++++-------- sampler/sampler_timer.c | 53 +++++++++++++++++++++++++++++++++++-------- sampler/swap_sampler_errors.h | 22 ++++++++++++------ sampler/swap_sampler_module.c | 28 +++++++++++++++++++---- sampler/swap_sampler_module.h | 14 ++++++++---- 6 files changed, 147 insertions(+), 41 deletions(-) diff --git a/sampler/kernel_operations.h b/sampler/kernel_operations.h index 859e893..04d8fa9 100644 --- a/sampler/kernel_operations.h +++ b/sampler/kernel_operations.h @@ -1,6 +1,8 @@ -/* - * SWAP sampler - * modules/sampler/kernel_operations.h +/** + * @file sampler/kernel_operations.h + * @author Alexander Aksenov + * + * @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 @@ -16,11 +18,13 @@ * 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 : SWAP samler kernel - * operations implement + * @section DESCRIPTION * + * Parser definitions. */ #ifndef __KERNEL_OPERATIONS_H__ @@ -28,14 +32,19 @@ #include +/** 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) diff --git a/sampler/sampler_hrtimer.c b/sampler/sampler_hrtimer.c index 31b6987..e7a1b45 100644 --- a/sampler/sampler_hrtimer.c +++ b/sampler/sampler_hrtimer.c @@ -1,6 +1,8 @@ -/* - * SWAP sampler - * modules/sampler/sampler_hrtimer.c +/** + * sampler/sampler_hrtimer.c + * @author Alexander Aksenov + * + * @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 @@ -16,10 +18,13 @@ * 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 : SWAP sampler porting + * @section DESCRIPTION * + * Sampler for high resolution timers. */ @@ -32,6 +37,12 @@ static u64 sampler_timer_quantum = 0; 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; @@ -42,19 +53,32 @@ restart_ret sampler_timers_restart(swap_timer *timer) 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); @@ -68,7 +92,12 @@ void sampler_timers_start(void *restart_func) 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); @@ -79,7 +108,12 @@ void sampler_timers_stop(int 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; diff --git a/sampler/sampler_timer.c b/sampler/sampler_timer.c index 025cedb..754d3f1 100644 --- a/sampler/sampler_timer.c +++ b/sampler/sampler_timer.c @@ -1,6 +1,8 @@ -/* - * SWAP sampler - * modules/sampler/sampler_timer.c +/** + * sampler/sampler_timer.c + * @author Alexander Aksenov + * + * @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 @@ -16,10 +18,13 @@ * 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 : SWAP sampler porting + * @section DESCRIPTION * + * Sampler based on common timers. */ @@ -32,7 +37,12 @@ static unsigned long sampler_timer_quantum = 0; 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; @@ -44,19 +54,32 @@ restart_ret sampler_timers_restart(swap_timer *timer) 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); @@ -71,7 +94,12 @@ void sampler_timers_start(void *restart_func) 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); @@ -81,7 +109,12 @@ void sampler_timers_stop(int 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; diff --git a/sampler/swap_sampler_errors.h b/sampler/swap_sampler_errors.h index a68905e..d673b4d 100644 --- a/sampler/swap_sampler_errors.h +++ b/sampler/swap_sampler_errors.h @@ -1,6 +1,8 @@ -/* - * SWAP Sampler - * modules/sampler/swap_sampler_errors.h +/** + * @file sampler/swap_sampler_errors.h + * @author Alexander Aksenov + * + * @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 @@ -16,15 +18,21 @@ * 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 : 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. */ }; diff --git a/sampler/swap_sampler_module.c b/sampler/swap_sampler_module.c index 1407f28..4528743 100644 --- a/sampler/swap_sampler_module.c +++ b/sampler/swap_sampler_module.c @@ -1,6 +1,9 @@ -/* - * SWAP sampler - * modules/sampler/swap_sampler_module.c +/** + * sampler/swap_sampler_module.c + * @author Andreev S.V.: SWAP Sampler implementation + * @author Alexander Aksenov : 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 @@ -16,11 +19,13 @@ * 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 : SWAP sampler porting + * @section DESCRIPTION * + * Timer-based sampling module. */ #include @@ -114,6 +119,13 @@ static void do_swap_sampler_stop(void) 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; @@ -135,6 +147,12 @@ unlock: } 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; diff --git a/sampler/swap_sampler_module.h b/sampler/swap_sampler_module.h index bc1accf..e3663df 100644 --- a/sampler/swap_sampler_module.h +++ b/sampler/swap_sampler_module.h @@ -1,6 +1,8 @@ -/* - * SWAP Sampler - * modules/sampler/swap_sampler_module.h +/** + * @file sampler/swap_sampler_module.h + * @author Alexander Aksenov + * + * @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 @@ -16,11 +18,13 @@ * 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 : Implement SWAP Sampler - * interface + * @section DESCRIPTION * + * Sampling module interface declaration. */ -- 2.7.4