Module: xenomai-forge Branch: gravity Commit: 6eaf99756ccaa2a3a8893dbfd259aa88116643ab URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=6eaf99756ccaa2a3a8893dbfd259aa88116643ab
Author: Philippe Gerum <r...@xenomai.org> Date: Tue Jul 15 16:14:01 2014 +0200 drivers/autotune: add RTDM device for auto-tuning (WIP) --- configure | 53 +-- configure.ac | 1 + include/cobalt/kernel/assert.h | 6 +- include/cobalt/kernel/rtdm/Makefile.am | 1 + include/cobalt/kernel/rtdm/Makefile.in | 1 + include/cobalt/kernel/rtdm/autotune.h | 24 ++ include/rtdm/Makefile.am | 1 + include/rtdm/Makefile.in | 1 + include/rtdm/autotune.h | 26 ++ include/rtdm/uapi/Makefile.am | 1 + include/rtdm/uapi/Makefile.in | 1 + include/rtdm/uapi/autotune.h | 28 ++ kernel/cobalt/Kconfig | 21 + kernel/cobalt/arch/x86/Kconfig | 3 + kernel/drivers/Kconfig | 1 + kernel/drivers/Makefile | 2 +- kernel/drivers/autotune/Kconfig | 3 + kernel/drivers/autotune/Makefile | 6 + kernel/drivers/autotune/autotune.c | 227 +++++++++++ utils/Makefile.am | 2 +- utils/Makefile.in | 4 +- utils/autotune/Makefile.am | 17 + utils/autotune/Makefile.in | 694 ++++++++++++++++++++++++++++++++ utils/autotune/autotune.c | 39 ++ 24 files changed, 1106 insertions(+), 57 deletions(-) diff --git a/configure b/configure index 4abf72c..f5d8730 100755 --- a/configure +++ b/configure @@ -851,7 +851,6 @@ enable_pshared enable_registry enable_smp enable_x86_vsyscall -enable_arm_tsc enable_arm_quirks enable_doc_build enable_doc_install @@ -1522,15 +1521,6 @@ Optional Features: --enable-registry Export real-time objects to a registry --enable-smp Enable SMP support --enable-x86-vsyscall Assume VSYSCALL enabled for issuing syscalls - --enable-arm-tsc You only need this option if you get the following - message when starting an application: Xenomai: - incompatible feature set (userland requires - "kuser_tsc ...", kernel provides "...", - missing="kuser_tsc"). In that case, this option - allows to select the machine for which a user-space - tsc emulation should be generated. Valid machines - are at91, kuser, imx, ixp4xx, omap, orion, pxa, - s3c24x, sa1100. [default=kuser] --enable-arm-quirks Enable quirks for specific systems. Currently supported quirks are for sa1100 and xscale3. --enable-doc-build Build Xenomai documentation @@ -13314,46 +13304,8 @@ fi if test $XENO_TARGET_ARCH = arm ; then - unset CONFIG_XENO_ARM_SA1100 unset CONFIG_XENO_CPU_XSC3 - CONFIG_XENO_ARM_TSC_TYPE=__XN_TSC_TYPE_KUSER - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ARM tsc type" >&5 -$as_echo_n "checking for ARM tsc type... " >&6; } - # Check whether --enable-arm-tsc was given. -if test "${enable_arm_tsc+set}" = set; then : - enableval=$enable_arm_tsc; case "$enableval" in - at91*) CONFIG_XENO_ARM_TSC_TYPE=__XN_TSC_TYPE_FREERUNNING_FAST_WRAP;; - - integrator) unset tsc_type;; - - ixp4xx) CONFIG_XENO_ARM_TSC_TYPE=__XN_TSC_TYPE_FREERUNNING;; - - imx*|mx*) CONFIG_XENO_ARM_TSC_TYPE=__XN_TSC_TYPE_FREERUNNING;; - - generic|kuser) CONFIG_XENO_ARM_TSC_TYPE=__XN_TSC_TYPE_KUSER;; - - omap*) CONFIG_XENO_ARM_TSC_TYPE=__XN_TSC_TYPE_FREERUNNING;; - - orion) CONFIG_XENO_ARM_TSC_TYPE=__XN_TSC_TYPE_FREERUNNING_COUNTDOWN;; - - pxa*) CONFIG_XENO_CPU_XSC3=y - CONFIG_XENO_ARM_TSC_TYPE=__XN_TSC_TYPE_FREERUNNING;; - - s3c24*) CONFIG_XENO_ARM_TSC_TYPE=__XN_TSC_TYPE_DECREMENTER;; - - sa1100) CONFIG_XENO_ARM_SA1100=y - CONFIG_XENO_ARM_TSC_TYPE=__XN_TSC_TYPE_FREERUNNING;; - - n | no) unset CONFIG_XENO_ARM_TSC_TYPE;; - - *)as_fn_error $? "Invalid SOC selected: \"$enableval\"" "$LINENO" 5;; - esac -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${enable_arm_tsc:-kuser}" >&5 -$as_echo "${enable_arm_tsc:-kuser}" >&6; } # Check whether --enable-arm-quirks was given. if test "${enable_arm_quirks+set}" = set; then : @@ -14180,7 +14132,7 @@ $as_echo_n "checking for fortify support... " >&6; } # Check whether --enable-fortify was given. if test "${enable_fortify+set}" = set; then : enableval=$enable_fortify; case "$enableval" in - y | yes) want_fortify=yes;; + y | yes) want_fortify=yes;; *) want_fortify=no;; esac fi @@ -14230,7 +14182,7 @@ XENO_CONFIG_ARGS="$ac_configure_args" -ac_config_files="$ac_config_files Makefile config/Makefile scripts/Makefile scripts/xeno-config:scripts/xeno-config-$rtcore_type.in scripts/xeno lib/Makefile lib/boilerplate/Makefile lib/cobalt/Makefile lib/cobalt/arch/Makefile lib/cobalt/arch/arm/Makefile lib/cobalt/arch/arm/include/Makefile lib/cobalt/arch/arm/include/asm/Makefile lib/cobalt/arch/arm/include/asm/xenomai/Makefile lib/cobalt/arch/powerpc/Makefile lib/cobalt/arch/powerpc/include/Makefile lib/cobalt/arch/powerpc/include/asm/Makefile lib/cobalt/arch/powerpc/include/asm/xenomai/Makefile lib/cobalt/arch/blackfin/Makefile lib/cobalt/arch/blackfin/include/Makefile lib/cobalt/arch/blackfin/include/asm/Makefile lib/cobalt/arch/blackfin/include/asm/xenomai/Makefile lib/cobalt/arch/x86/Makefile lib/cobalt/arch/x86/include/Makefile lib/cobalt/arch/x86/include/asm/Makefile lib/cobalt/arch/x86/include/asm/xenomai/Makefile lib/cobalt/arch/nios2/Makefile lib/cobalt/arch/nios2/include/Makefile lib/cobalt/arch/nios2/include/asm/Makef ile lib/cobalt/arch/nios2/include/asm/xenomai/Makefile lib/cobalt/arch/sh/Makefile lib/cobalt/arch/sh/include/Makefile lib/cobalt/arch/sh/include/asm/Makefile lib/cobalt/arch/sh/include/asm/xenomai/Makefile lib/copperplate/Makefile lib/copperplate/regd/Makefile lib/alchemy/Makefile lib/vxworks/Makefile lib/psos/Makefile lib/analogy/Makefile lib/smokey/Makefile lib/trank/Makefile testsuite/Makefile testsuite/latency/Makefile testsuite/switchtest/Makefile testsuite/smokey/Makefile testsuite/smokey/arith/Makefile testsuite/smokey/sched-quota/Makefile testsuite/smokey/sched-tp/Makefile testsuite/smokey/rtdm/Makefile testsuite/smokey/vdso-access/Makefile testsuite/smokey/cond-torture/Makefile testsuite/smokey/mutex-torture/Makefile testsuite/clocktest/Makefile testsuite/xeno-test/Makefile testsuite/regression/Makefile testsuite/regression/posix/Makefile utils/Makefile utils/can/Makefile utils/analogy/Makefile utils/ps/Makefile utils/slackspot/Makefile demo/Makefile demo/posix/Makefile de mo/posix/cobalt/Makefile demo/alchemy/Makefile demo/alchemy/cobalt/Makefile include/Makefile include/nocore/Makefile include/cobalt/uapi/Makefile include/cobalt/uapi/asm-generic/Makefile include/cobalt/uapi/kernel/Makefile include/cobalt/uapi/rtdm/Makefile include/cobalt/Makefile include/cobalt/sys/Makefile include/cobalt/kernel/Makefile include/cobalt/kernel/rtdm/Makefile include/cobalt/kernel/rtdm/analogy/Makefile include/cobalt/boilerplate/Makefile include/rtdm/Makefile include/rtdm/uapi/Makefile include/mercury/Makefile include/mercury/boilerplate/Makefile include/boilerplate/Makefile include/copperplate/Makefile include/alchemy/Makefile include/vxworks/Makefile include/psos/Makefile include/smokey/Makefile include/trank/Makefile include/trank/posix/Makefile include/trank/native/Makefile include/trank/rtdm/Makefile doc/Makefile doc/doxygen/Makefile doc/doxygen/xeno3prm-common.conf doc/doxygen/xeno3prm-html.conf doc/doxygen/xeno3prm-latex.conf doc/asciidoc/Makefile" +ac_config_files="$ac_config_files Makefile config/Makefile scripts/Makefile scripts/xeno-config:scripts/xeno-config-$rtcore_type.in scripts/xeno lib/Makefile lib/boilerplate/Makefile lib/cobalt/Makefile lib/cobalt/arch/Makefile lib/cobalt/arch/arm/Makefile lib/cobalt/arch/arm/include/Makefile lib/cobalt/arch/arm/include/asm/Makefile lib/cobalt/arch/arm/include/asm/xenomai/Makefile lib/cobalt/arch/powerpc/Makefile lib/cobalt/arch/powerpc/include/Makefile lib/cobalt/arch/powerpc/include/asm/Makefile lib/cobalt/arch/powerpc/include/asm/xenomai/Makefile lib/cobalt/arch/blackfin/Makefile lib/cobalt/arch/blackfin/include/Makefile lib/cobalt/arch/blackfin/include/asm/Makefile lib/cobalt/arch/blackfin/include/asm/xenomai/Makefile lib/cobalt/arch/x86/Makefile lib/cobalt/arch/x86/include/Makefile lib/cobalt/arch/x86/include/asm/Makefile lib/cobalt/arch/x86/include/asm/xenomai/Makefile lib/cobalt/arch/nios2/Makefile lib/cobalt/arch/nios2/include/Makefile lib/cobalt/arch/nios2/include/asm/Makef ile lib/cobalt/arch/nios2/include/asm/xenomai/Makefile lib/cobalt/arch/sh/Makefile lib/cobalt/arch/sh/include/Makefile lib/cobalt/arch/sh/include/asm/Makefile lib/cobalt/arch/sh/include/asm/xenomai/Makefile lib/copperplate/Makefile lib/copperplate/regd/Makefile lib/alchemy/Makefile lib/vxworks/Makefile lib/psos/Makefile lib/analogy/Makefile lib/smokey/Makefile lib/trank/Makefile testsuite/Makefile testsuite/latency/Makefile testsuite/switchtest/Makefile testsuite/smokey/Makefile testsuite/smokey/arith/Makefile testsuite/smokey/sched-quota/Makefile testsuite/smokey/sched-tp/Makefile testsuite/smokey/rtdm/Makefile testsuite/smokey/vdso-access/Makefile testsuite/smokey/cond-torture/Makefile testsuite/smokey/mutex-torture/Makefile testsuite/clocktest/Makefile testsuite/xeno-test/Makefile testsuite/regression/Makefile testsuite/regression/posix/Makefile utils/Makefile utils/can/Makefile utils/analogy/Makefile utils/ps/Makefile utils/slackspot/Makefile utils/autotune/Makefile demo/Makefil e demo/posix/Makefile demo/posix/cobalt/Makefile demo/alchemy/Makefile demo/alchemy/cobalt/Makefile include/Makefile include/nocore/Makefile include/cobalt/uapi/Makefile include/cobalt/uapi/asm-generic/Makefile include/cobalt/uapi/kernel/Makefile include/cobalt/uapi/rtdm/Makefile include/cobalt/Makefile include/cobalt/sys/Makefile include/cobalt/kernel/Makefile include/cobalt/kernel/rtdm/Makefile include/cobalt/kernel/rtdm/analogy/Makefile include/cobalt/boilerplate/Makefile include/rtdm/Makefile include/rtdm/uapi/Makefile include/mercury/Makefile include/mercury/boilerplate/Makefile include/boilerplate/Makefile include/copperplate/Makefile include/alchemy/Makefile include/vxworks/Makefile include/psos/Makefile include/smokey/Makefile include/trank/Makefile include/trank/posix/Makefile include/trank/native/Makefile include/trank/rtdm/Makefile doc/Makefile doc/doxygen/Makefile doc/doxygen/xeno3prm-common.conf doc/doxygen/xeno3prm-html.conf doc/doxygen/xeno3prm-latex.conf doc/asciidoc /Makefile" cat >confcache <<\_ACEOF @@ -15355,6 +15307,7 @@ do "utils/analogy/Makefile") CONFIG_FILES="$CONFIG_FILES utils/analogy/Makefile" ;; "utils/ps/Makefile") CONFIG_FILES="$CONFIG_FILES utils/ps/Makefile" ;; "utils/slackspot/Makefile") CONFIG_FILES="$CONFIG_FILES utils/slackspot/Makefile" ;; + "utils/autotune/Makefile") CONFIG_FILES="$CONFIG_FILES utils/autotune/Makefile" ;; "demo/Makefile") CONFIG_FILES="$CONFIG_FILES demo/Makefile" ;; "demo/posix/Makefile") CONFIG_FILES="$CONFIG_FILES demo/posix/Makefile" ;; "demo/posix/cobalt/Makefile") CONFIG_FILES="$CONFIG_FILES demo/posix/cobalt/Makefile" ;; diff --git a/configure.ac b/configure.ac index 389931f..cf70c34 100644 --- a/configure.ac +++ b/configure.ac @@ -821,6 +821,7 @@ AC_CONFIG_FILES([ \ utils/analogy/Makefile \ utils/ps/Makefile \ utils/slackspot/Makefile \ + utils/autotune/Makefile \ demo/Makefile \ demo/posix/Makefile \ demo/posix/cobalt/Makefile \ diff --git a/include/cobalt/kernel/assert.h b/include/cobalt/kernel/assert.h index 042ef78..9e3300d 100644 --- a/include/cobalt/kernel/assert.h +++ b/include/cobalt/kernel/assert.h @@ -22,9 +22,9 @@ #include <cobalt/kernel/trace.h> #include <cobalt/kernel/ancillaries.h> -#define XENO_INFO KERN_INFO "[Xenomai] " -#define XENO_WARN KERN_WARNING "[Xenomai] " -#define XENO_ERR KERN_ERR "[Xenomai] " +#define XENO_INFO KERN_INFO "[Xenomai] " +#define XENO_WARN KERN_WARNING "[Xenomai] " +#define XENO_ERR KERN_ERR "[Xenomai] " #define XENO_DEBUG(__subsys) \ (CONFIG_XENO_OPT_DEBUG_##__subsys > 0) diff --git a/include/cobalt/kernel/rtdm/Makefile.am b/include/cobalt/kernel/rtdm/Makefile.am index 1013780..8a4269c 100644 --- a/include/cobalt/kernel/rtdm/Makefile.am +++ b/include/cobalt/kernel/rtdm/Makefile.am @@ -1,5 +1,6 @@ noinst_HEADERS = \ + autotune.h \ can.h \ cobalt.h \ driver.h \ diff --git a/include/cobalt/kernel/rtdm/Makefile.in b/include/cobalt/kernel/rtdm/Makefile.in index 2b46f3c..5404b67 100644 --- a/include/cobalt/kernel/rtdm/Makefile.in +++ b/include/cobalt/kernel/rtdm/Makefile.in @@ -343,6 +343,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_HEADERS = \ + autotune.h \ can.h \ cobalt.h \ driver.h \ diff --git a/include/cobalt/kernel/rtdm/autotune.h b/include/cobalt/kernel/rtdm/autotune.h new file mode 100644 index 0000000..885a237 --- /dev/null +++ b/include/cobalt/kernel/rtdm/autotune.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2014 Philippe Gerum <r...@xenomai.org> + * + * Xenomai is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#ifndef _COBALT_RTDM_AUTOTUNE_H +#define _COBALT_RTDM_AUTOTUNE_H + +#include <rtdm/rtdm.h> +#include <rtdm/uapi/autotune.h> + +#endif /* !_COBALT_RTDM_AUTOTUNE_H */ diff --git a/include/rtdm/Makefile.am b/include/rtdm/Makefile.am index 5008295..2e7a4aa 100644 --- a/include/rtdm/Makefile.am +++ b/include/rtdm/Makefile.am @@ -2,6 +2,7 @@ includesubdir = $(includedir)/rtdm includesub_HEADERS = \ analogy.h \ + autotune.h \ can.h \ ipc.h \ rtdm.h \ diff --git a/include/rtdm/Makefile.in b/include/rtdm/Makefile.in index d95ea8a..07ab5d4 100644 --- a/include/rtdm/Makefile.in +++ b/include/rtdm/Makefile.in @@ -373,6 +373,7 @@ top_srcdir = @top_srcdir@ includesubdir = $(includedir)/rtdm includesub_HEADERS = \ analogy.h \ + autotune.h \ can.h \ ipc.h \ rtdm.h \ diff --git a/include/rtdm/autotune.h b/include/rtdm/autotune.h new file mode 100644 index 0000000..6a73cf7 --- /dev/null +++ b/include/rtdm/autotune.h @@ -0,0 +1,26 @@ +/* + * This file is part of the Xenomai project. + * + * Copyright (C) 2014 Philippe Gerum <r...@xenomai.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +#ifndef _RTDM_AUTOTUNE_H +#define _RTDM_AUTOTUNE_H + +#include <rtdm/rtdm.h> +#include <rtdm/uapi/autotune.h> + +#endif /* !_RTDM_AUTOTUNE_H */ diff --git a/include/rtdm/uapi/Makefile.am b/include/rtdm/uapi/Makefile.am index b56d474..77d4d40 100644 --- a/include/rtdm/uapi/Makefile.am +++ b/include/rtdm/uapi/Makefile.am @@ -2,6 +2,7 @@ includesubdir = $(includedir)/rtdm/uapi includesub_HEADERS = \ analogy.h \ + autotune.h \ can.h \ ipc.h \ rtdm.h \ diff --git a/include/rtdm/uapi/Makefile.in b/include/rtdm/uapi/Makefile.in index 6879c6e..22a9fcb 100644 --- a/include/rtdm/uapi/Makefile.in +++ b/include/rtdm/uapi/Makefile.in @@ -331,6 +331,7 @@ top_srcdir = @top_srcdir@ includesubdir = $(includedir)/rtdm/uapi includesub_HEADERS = \ analogy.h \ + autotune.h \ can.h \ ipc.h \ rtdm.h \ diff --git a/include/rtdm/uapi/autotune.h b/include/rtdm/uapi/autotune.h new file mode 100644 index 0000000..234df70 --- /dev/null +++ b/include/rtdm/uapi/autotune.h @@ -0,0 +1,28 @@ +/* + * This file is part of the Xenomai project. + * + * Copyright (C) 2014 Philippe Gerum <r...@xenomai.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +#ifndef _RTDM_UAPI_AUTOTUNE_H +#define _RTDM_UAPI_AUTOTUNE_H + +#define RTDM_CLASS_AUTOTUNE RTDM_CLASS_TESTING +#define RTDM_SUBCLASS_AUTOTUNE 0 + +#define AUTOTUNE_RTIOC_LATENCY _IOW(RTDM_CLASS_AUTOTUNE, 0, int) + +#endif /* !_RTDM_UAPI_AUTOTUNE_H */ diff --git a/kernel/cobalt/Kconfig b/kernel/cobalt/Kconfig index 2d6a564..107fb0b 100644 --- a/kernel/cobalt/Kconfig +++ b/kernel/cobalt/Kconfig @@ -183,9 +183,30 @@ config XENO_OPT_RR_QUANTUM may be overriden internally by Xenomai services which do provide a round-robin interval. +config XENO_OPT_AUTOTUNE + bool "Auto-tuning" + default y if XENO_HW_AUTOTUNE + select XENO_DRIVERS_AUTOTUNE + help + Enable auto-tuning capabilities. Currently, Xenomai runs an + auto-tuning procedure once at system bootup, for adjusting the + core timing services to the intrinsic latency of the platform. + + The calibration method is conservative, in order to never + cause early shots. You can set your own estimation of the + intrinsic latency with CONFIG_XENO_OPT_TIMING_SCHEDLAT, or use + our pre-calibrated value instead. + +if XENO_OPT_AUTOTUNE +config XENO_OPT_TIMING_SCHEDLAT + int + default 0 +endif + config XENO_OPT_TIMING_SCHEDLAT int "Scheduling latency (ns)" default 0 + depends on !XENO_OPT_AUTOTUNE help Scheduling latency is the time between the termination of an interrupt handler and the execution of the first instruction diff --git a/kernel/cobalt/arch/x86/Kconfig b/kernel/cobalt/arch/x86/Kconfig index 729d137..c6abcf9 100644 --- a/kernel/cobalt/arch/x86/Kconfig +++ b/kernel/cobalt/arch/x86/Kconfig @@ -1,5 +1,8 @@ config XENO_HW_FPU def_bool y +config XENO_HW_AUTOTUNE + def_bool y + source "kernel/xenomai/Kconfig" source "drivers/xenomai/Kconfig" diff --git a/kernel/drivers/Kconfig b/kernel/drivers/Kconfig index aad77c7..304fa3b 100644 --- a/kernel/drivers/Kconfig +++ b/kernel/drivers/Kconfig @@ -1,5 +1,6 @@ menu "Drivers" +source "drivers/xenomai/autotune/Kconfig" source "drivers/xenomai/serial/Kconfig" source "drivers/xenomai/testing/Kconfig" source "drivers/xenomai/can/Kconfig" diff --git a/kernel/drivers/Makefile b/kernel/drivers/Makefile index 84767eb..0043996 100644 --- a/kernel/drivers/Makefile +++ b/kernel/drivers/Makefile @@ -1,2 +1,2 @@ -obj-$(CONFIG_XENOMAI) += serial/ testing/ can/ analogy/ ipc/ +obj-$(CONFIG_XENOMAI) += autotune/ serial/ testing/ can/ analogy/ ipc/ diff --git a/kernel/drivers/autotune/Kconfig b/kernel/drivers/autotune/Kconfig new file mode 100644 index 0000000..5916462 --- /dev/null +++ b/kernel/drivers/autotune/Kconfig @@ -0,0 +1,3 @@ + +config XENO_DRIVERS_AUTOTUNE + bool diff --git a/kernel/drivers/autotune/Makefile b/kernel/drivers/autotune/Makefile new file mode 100644 index 0000000..02da96e --- /dev/null +++ b/kernel/drivers/autotune/Makefile @@ -0,0 +1,6 @@ + +ccflags-y := -Iarch/$(SRCARCH)/xenomai/include -Iinclude/xenomai + +obj-$(CONFIG_XENO_DRIVERS_AUTOTUNE) += xeno_autotune.o + +xeno_autotune-y := autotune.o diff --git a/kernel/drivers/autotune/autotune.c b/kernel/drivers/autotune/autotune.c new file mode 100644 index 0000000..537df0b --- /dev/null +++ b/kernel/drivers/autotune/autotune.c @@ -0,0 +1,227 @@ +/* + * This file is part of the Xenomai project. + * + * Copyright (C) 2014 Philippe Gerum <r...@xenomai.org> + * + * 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 the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#include <linux/module.h> +#include <linux/init.h> +#include <linux/slab.h> +#include <cobalt/kernel/arith.h> +#include <rtdm/driver.h> +#include <rtdm/autotune.h> + +struct autotune_state { + rtdm_timer_t timer; + xnticks_t ideal; + xnticks_t step; + xnsticks_t min_lat; + xnsticks_t max_lat; + xnsticks_t sum_lat; + unsigned long cur_samples; + unsigned long max_samples; + rtdm_event_t done; +}; + +static void timer_handler(rtdm_timer_t *timer) +{ + struct autotune_state *state; + xnsticks_t delta; + xnticks_t now; + + state = container_of(timer, struct autotune_state, timer); + now = xnclock_read_raw(&nkclock); + + delta = (xnsticks_t)(now - state->ideal); + if (delta < state->min_lat) + state->min_lat = delta; + if (delta > state->max_lat) + state->max_lat = delta; + + state->sum_lat += delta; + state->ideal += state->step; + + if (++state->cur_samples >= state->max_samples) { + rtdm_timer_stop(timer); + rtdm_event_signal(&state->done); + } +} + +static int autotune_open(struct rtdm_fd *fd, int oflags) +{ + struct autotune_state *state; + int ret; + + state = rtdm_fd_to_private(fd); + + ret = rtdm_timer_init(&state->timer, timer_handler, "autotune"); + if (ret) + return ret; + + rtdm_event_init(&state->done, 0); + + return 0; +} + +#define ONE_SECOND 1000000000UL + +static int tune_timer_gravity(struct autotune_state *state, int period) +{ + xnsticks_t min_ns, max_ns, avg_ns, grav_ns, prev_min; + unsigned long gravity, prev_gravity; + int ret, step, stable = 0; + long adjust; + + printk(XENO_INFO "auto-tuning core clock gravity\n"); + + state->step = xnclock_ns_to_ticks(&nkclock, period); + state->max_samples = ONE_SECOND / (period ?: 1); + gravity = nkclock.gravity.irq; + nkclock.gravity.irq = prev_gravity = 0; + prev_min = 0; + + for (step = 1; step <= 30; step++) { + state->ideal = xnclock_read_raw(&nkclock) + state->step; + state->min_lat = -1LL >> 1; + state->max_lat = 0; + state->sum_lat = 0; + state->cur_samples = 0; + + ret = rtdm_timer_start(&state->timer, + xnclock_ticks_to_ns(&nkclock, state->ideal), + period, RTDM_TIMERMODE_ABSOLUTE); + if (ret) + goto fail; + + ret = rtdm_event_wait(&state->done); + if (ret) + goto fail; + + min_ns = xnclock_ticks_to_ns(&nkclock, state->min_lat); + max_ns = xnclock_ticks_to_ns(&nkclock, state->max_lat); + avg_ns = xnarch_llimd(xnclock_ticks_to_ns(&nkclock, state->sum_lat), 1, + (state->cur_samples ?: 1)); + grav_ns = xnclock_ticks_to_ns(&nkclock, nkclock.gravity.irq); + + if (step > 1) { + if (state->min_lat < 0 && prev_min > 0) { + nkclock.gravity.irq = prev_gravity; + break; + } + if (state->min_lat > 0 && prev_min < 0) + break; + } + + adjust = (long)state->min_lat / 2; + +#ifdef CONFIG_XENO_OPT_DEBUG_NUCLEUS + printk(XENO_INFO "autotune: min=%Ld | max=%Ld | avg=%Ld\n", + min_ns, max_ns, avg_ns); +#endif + + if (adjust) + stable = 0; + else if (++stable == 3) + break; + + prev_gravity = nkclock.gravity.irq; + prev_min = state->min_lat; + + if (adjust == 0 && state->min_lat < 0) + adjust = (long)state->min_lat; + + if (nkclock.gravity.irq >= -adjust) + nkclock.gravity.irq += adjust; + } + + if (step > 30) { + printk(XENO_INFO "could not auto-tune after 30s\n"); + return -EINVAL; + } + + printk(XENO_INFO "auto-tuning completed: gravity=%Lu [min=%Ld | max=%Ld | avg=%Ld]\n", + xnclock_ticks_to_ns(&nkclock, nkclock.gravity.irq), + min_ns, max_ns, avg_ns); + + return 0; +fail: + nkclock.gravity.irq = gravity; + + return ret; +} + +static int autotune_ioctl(struct rtdm_fd *fd, unsigned int request, void *arg) +{ + struct autotune_state *state; + int ret, period; + + if (request != AUTOTUNE_RTIOC_LATENCY) + return -EINVAL; + + ret = rtdm_safe_copy_from_user(fd, &period, arg, sizeof(period)); + if (ret) + return ret; + + state = rtdm_fd_to_private(fd); + + return tune_timer_gravity(state, period); +} + +static void autotune_close(struct rtdm_fd *fd) +{ + struct autotune_state *state; + + state = rtdm_fd_to_private(fd); + rtdm_timer_destroy(&state->timer); + rtdm_event_destroy(&state->done); +} + +static struct rtdm_device device = { + .struct_version = RTDM_DEVICE_STRUCT_VER, + .device_flags = RTDM_NAMED_DEVICE|RTDM_EXCLUSIVE, + .context_size = sizeof(struct autotune_state), + .open = autotune_open, + .ops = { + .ioctl_rt = autotune_ioctl, + .close = autotune_close, + }, + .device_class = RTDM_CLASS_AUTOTUNE, + .device_sub_class = RTDM_SUBCLASS_AUTOTUNE, + .device_name = "autotune", + .driver_name = "autotune", + .driver_version = RTDM_DRIVER_VER(1, 0, 0), + .peripheral_name = "Auto-tuning services", + .proc_name = device.device_name, + .provider_name = "Philippe Gerum <r...@xenomai.org>", +}; + +static int __init autotune_init(void) +{ + int ret; + + if (!realtime_core_enabled()) + return 0; + + ret = rtdm_dev_register(&device); + if (ret) + return ret; + + return 0; +} + +device_initcall(autotune_init); + +MODULE_LICENSE("GPL"); diff --git a/utils/Makefile.am b/utils/Makefile.am index fc64581..62c5e70 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -1,3 +1,3 @@ if XENO_COBALT -SUBDIRS = can analogy ps slackspot +SUBDIRS = can analogy ps slackspot autotune endif diff --git a/utils/Makefile.in b/utils/Makefile.in index 30e1a18..505e48a 100644 --- a/utils/Makefile.in +++ b/utils/Makefile.in @@ -148,7 +148,7 @@ am__define_uniq_tagged_files = \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = can analogy ps slackspot +DIST_SUBDIRS = can analogy ps slackspot autotune DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ @@ -339,7 +339,7 @@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -@XENO_COBALT_TRUE@SUBDIRS = can analogy ps slackspot +@XENO_COBALT_TRUE@SUBDIRS = can analogy ps slackspot autotune all: all-recursive .SUFFIXES: diff --git a/utils/autotune/Makefile.am b/utils/autotune/Makefile.am new file mode 100644 index 0000000..22a387d --- /dev/null +++ b/utils/autotune/Makefile.am @@ -0,0 +1,17 @@ + +CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC) + +sbin_PROGRAMS = autotune + +autotune_SOURCES = autotune.c + +autotune_CPPFLAGS = \ + $(XENO_USER_CFLAGS) \ + -I$(top_srcdir)/include + +autotune_LDFLAGS = $(XENO_POSIX_WRAPPERS) + +autotune_LDADD = \ + ../../lib/cobalt/libcobalt.la \ + @XENO_USER_LDADD@ \ + -lpthread -lrt diff --git a/utils/autotune/Makefile.in b/utils/autotune/Makefile.in new file mode 100644 index 0000000..8a719ef --- /dev/null +++ b/utils/autotune/Makefile.in @@ -0,0 +1,694 @@ +# Makefile.in generated by automake 1.13.4 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +sbin_PROGRAMS = autotune$(EXEEXT) +subdir = utils/autotune +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/config/depcomp +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/ac_prog_cc_for_build.m4 \ + $(top_srcdir)/config/libtool.m4 \ + $(top_srcdir)/config/ltoptions.m4 \ + $(top_srcdir)/config/ltsugar.m4 \ + $(top_srcdir)/config/ltversion.m4 \ + $(top_srcdir)/config/lt~obsolete.m4 \ + $(top_srcdir)/config/version $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/xeno_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(sbindir)" +PROGRAMS = $(sbin_PROGRAMS) +am_autotune_OBJECTS = autotune-autotune.$(OBJEXT) +autotune_OBJECTS = $(am_autotune_OBJECTS) +autotune_DEPENDENCIES = ../../lib/cobalt/libcobalt.la +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +autotune_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(autotune_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(autotune_SOURCES) +DIST_SOURCES = $(autotune_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +A2X = @A2X@ +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +ASCIIDOC = @ASCIIDOC@ +ASCIIDODC = @ASCIIDODC@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_EXEEXT = @BUILD_EXEEXT@ +BUILD_OBJEXT = @BUILD_OBJEXT@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS@ +CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ +CHECKFLAGS = @CHECKFLAGS@ +CONFIG_STATUS_DEPENDENCIES = @CONFIG_STATUS_DEPENDENCIES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ +CPP_FOR_BUILD = @CPP_FOR_BUILD@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOXYGEN = @DOXYGEN@ +DOXYGEN_HAVE_DOT = @DOXYGEN_HAVE_DOT@ +DOXYGEN_SHOW_INCLUDE_FILES = @DOXYGEN_SHOW_INCLUDE_FILES@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FUSE_CFLAGS = @FUSE_CFLAGS@ +FUSE_LIBS = @FUSE_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LATEX_BATCHMODE = @LATEX_BATCHMODE@ +LATEX_MODE = @LATEX_MODE@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LD_FILE_OPTION = @LD_FILE_OPTION@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +W3M = @W3M@ +XENO_BUILD_STRING = @XENO_BUILD_STRING@ +XENO_COBALT_CFLAGS = @XENO_COBALT_CFLAGS@ +XENO_CONFIG_ARGS = @XENO_CONFIG_ARGS@ +XENO_DEMO_DIR = @XENO_DEMO_DIR@ +XENO_FUSE_CFLAGS = @XENO_FUSE_CFLAGS@ +XENO_HOST_STRING = @XENO_HOST_STRING@ +XENO_LIB_LDFLAGS = @XENO_LIB_LDFLAGS@ +XENO_POSIX_WRAPPERS = @XENO_POSIX_WRAPPERS@ +XENO_TARGET_ARCH = @XENO_TARGET_ARCH@ +XENO_TARGET_CORE = @XENO_TARGET_CORE@ +XENO_TEST_DIR = @XENO_TEST_DIR@ +XENO_USER_APP_CFLAGS = @XENO_USER_APP_CFLAGS@ +XENO_USER_APP_LDFLAGS = @XENO_USER_APP_LDFLAGS@ +XENO_USER_CFLAGS = @XENO_USER_CFLAGS@ +XENO_USER_LDADD = @XENO_USER_LDADD@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CC_FOR_BUILD = @ac_ct_CC_FOR_BUILD@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC) +autotune_SOURCES = autotune.c +autotune_CPPFLAGS = \ + $(XENO_USER_CFLAGS) \ + -I$(top_srcdir)/include + +autotune_LDFLAGS = $(XENO_POSIX_WRAPPERS) +autotune_LDADD = \ + ../../lib/cobalt/libcobalt.la \ + @XENO_USER_LDADD@ \ + -lpthread -lrt + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign utils/autotune/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign utils/autotune/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-sbinPROGRAMS: $(sbin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-sbinPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(sbindir)" && rm -f $$files + +clean-sbinPROGRAMS: + @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +autotune$(EXEEXT): $(autotune_OBJECTS) $(autotune_DEPENDENCIES) $(EXTRA_autotune_DEPENDENCIES) + @rm -f autotune$(EXEEXT) + $(AM_V_CCLD)$(autotune_LINK) $(autotune_OBJECTS) $(autotune_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/autotune-autotune.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +autotune-autotune.o: autotune.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(autotune_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT autotune-autotune.o -MD -MP -MF $(DEPDIR)/autotune-autotune.Tpo -c -o autotune-autotune.o `test -f 'autotune.c' || echo '$(srcdir)/'`autotune.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/autotune-autotune.Tpo $(DEPDIR)/autotune-autotune.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='autotune.c' object='autotune-autotune.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(autotune_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o autotune-autotune.o `test -f 'autotune.c' || echo '$(srcdir)/'`autotune.c + +autotune-autotune.obj: autotune.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(autotune_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT autotune-autotune.obj -MD -MP -MF $(DEPDIR)/autotune-autotune.Tpo -c -o autotune-autotune.obj `if test -f 'autotune.c'; then $(CYGPATH_W) 'autotune.c'; else $(CYGPATH_W) '$(srcdir)/autotune.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/autotune-autotune.Tpo $(DEPDIR)/autotune-autotune.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='autotune.c' object='autotune-autotune.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(autotune_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o autotune-autotune.obj `if test -f 'autotune.c'; then $(CYGPATH_W) 'autotune.c'; else $(CYGPATH_W) '$(srcdir)/autotune.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(sbindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-sbinPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-sbinPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-sbinPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-sbinPROGRAMS cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-sbinPROGRAMS install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-sbinPROGRAMS + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/utils/autotune/autotune.c b/utils/autotune/autotune.c new file mode 100644 index 0000000..0631e20 --- /dev/null +++ b/utils/autotune/autotune.c @@ -0,0 +1,39 @@ +/* + * Xenomai is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Xenomai is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Xenomai; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ +#include <xeno_config.h> +#include <fcntl.h> +#include <unistd.h> +#include <error.h> +#include <rtdm/autotune.h> + +int main(int argc, char const *argv[]) +{ + int fd, period, ret; + + fd = open("/dev/autotune", O_RDONLY); + if (fd < 0) + error(1, errno, "cannot open autotune device"); + + period = CONFIG_XENO_DEFAULT_PERIOD; + ret = ioctl(fd, AUTOTUNE_RTIOC_LATENCY, &period); + if (ret) + error(1, errno, "auto-tuning failed"); + + close(fd); + + return 0; +} _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git