Module: xenomai-3
Branch: master
Commit: 7510a6ec07ec2a31556d4cff852cfaa709c6c3ba
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7510a6ec07ec2a31556d4cff852cfaa709c6c3ba

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Sat Nov 15 23:27:27 2014 +0100

cobalt/autotune: add options to ease autotuning at boot

--background allows to run autotune in the background and continue booting
--semi-quiet only leaves a few messages informing the user when each tuning
is started and when tuning is finished

---

 kernel/drivers/autotune/autotune.c |    7 +++++--
 utils/autotune/autotune.c          |   25 ++++++++++++++++++++++---
 2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/kernel/drivers/autotune/autotune.c 
b/kernel/drivers/autotune/autotune.c
index 79608b3..fbacb0e 100644
--- a/kernel/drivers/autotune/autotune.c
+++ b/kernel/drivers/autotune/autotune.c
@@ -665,7 +665,7 @@ static int autotune_ioctl_nrt(struct rtdm_fd *fd, unsigned 
int request, void *ar
        context->tuner = tuner;
        context->setup = setup;
 
-       if (!setup.quiet)
+       if (setup.quiet <= 1)
                printk(XENO_INFO "autotune(%s) started\n", tuner->name);
 
        return ret;
@@ -728,8 +728,11 @@ static void autotune_close(struct rtdm_fd *fd)
 
        context = rtdm_fd_to_private(fd);
        tuner = context->tuner;
-       if (tuner)
+       if (tuner) {
+               if (context->setup.quiet <= 1)
+                       printk(XENO_INFO "autotune finished\n");
                tuner->destroy_tuner(tuner);
+       }
 }
 
 static struct rtdm_driver autotune_driver = {
diff --git a/utils/autotune/autotune.c b/utils/autotune/autotune.c
index 1cce8db..99bbb79 100644
--- a/utils/autotune/autotune.c
+++ b/utils/autotune/autotune.c
@@ -29,7 +29,7 @@
 
 static int tune_irqlat, tune_kernlat, tune_userlat;
 
-static int reset, noload, quiet;
+static int reset, noload, quiet, background;
 
 static const struct option base_options[] = {
        {
@@ -73,14 +73,26 @@ static const struct option base_options[] = {
 #define quiet_opt      6
                .name = "quiet",
                .flag = &quiet,
+               .val = 2
+       },
+       {
+#define semiquiet_opt  7
+               .name = "semi-quiet",
+               .flag = &quiet,
                .val = 1
        },
        {
-#define period_opt     7
+#define period_opt     8
                .name = "period",
                .has_arg = 1,
        },
        {
+#define background_opt 9
+               .name = "background",
+               .flag = &background,
+               .val = 1,
+       },
+       {
                .name = NULL,
        }
 };
@@ -198,7 +210,9 @@ static void usage(void)
        fprintf(stderr, "   --period            set the sampling period\n");
        fprintf(stderr, "   --reset             reset core timer gravity to 
factory defaults\n");
        fprintf(stderr, "   --noload            disable load generation\n");
-       fprintf(stderr, "   --quiet             tame down verbosity\n");
+       fprintf(stderr, "   --semi-quiet        tame down verbosity\n");
+       fprintf(stderr, "   --quiet             disable all output\n");
+       fprintf(stderr, "   --background        run in the background\n");
        fprintf(stderr, "   --help              print this help\n\n");
        fprintf(stderr, "if no option is given, tune for all contexts using the 
default period.\n");
 }
@@ -266,6 +280,8 @@ int main(int argc, char *const argv[])
                        break;
                case noload_opt:
                case quiet_opt:
+               case semiquiet_opt:
+               case background_opt:
                        break;
                case irq_opt:
                case kernel_opt:
@@ -278,6 +294,9 @@ int main(int argc, char *const argv[])
                }
        }
 
+       if (background)
+               daemon(0, 0);
+
        fd = open("/dev/rtdm/autotune", O_RDONLY);
        if (fd < 0)
                error(1, errno, "cannot open autotune device");


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to