Module: xenomai-forge
Branch: master
Commit: 391a15fec32d632129a9cd7b23d694e6b6d5c0d9
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=391a15fec32d632129a9cd7b23d694e6b6d5c0d9

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Nov 29 13:34:41 2011 +0100

copperplate/init: warn about debug mode

The impact of debug mode on latencies is so massive that we really
want to let the user know about it, before it freaks out badly.

This patch issues such warning for debug builds when
copperplate_init() is invoked, unless the new --silent option was
mentioned.

---

 lib/alchemy/testsuite/Makefile |    2 +-
 lib/copperplate/init.c         |   22 ++++++++++++++++++++++
 lib/copperplate/internal.c     |    1 +
 lib/copperplate/internal.h     |    1 +
 lib/psos/testsuite/Makefile    |    2 +-
 lib/vxworks/testsuite/Makefile |    2 +-
 6 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/lib/alchemy/testsuite/Makefile b/lib/alchemy/testsuite/Makefile
index d490350..ef08a45 100644
--- a/lib/alchemy/testsuite/Makefile
+++ b/lib/alchemy/testsuite/Makefile
@@ -47,7 +47,7 @@ clean:
 test: all
        @for t in $(TESTS); do \
                echo -n $$t...; \
-               sudo LD_LIBRARY_PATH=$(solibs) ./$$t --cpu-affinity=0 && echo 
ok || echo BAD; \
+               sudo LD_LIBRARY_PATH=$(solibs) ./$$t --cpu-affinity=0 --silent 
&& echo ok || echo BAD; \
        done
 
 .PHONY: clean test
diff --git a/lib/copperplate/init.c b/lib/copperplate/init.c
index 1b35674..57bcfe1 100644
--- a/lib/copperplate/init.c
+++ b/lib/copperplate/init.c
@@ -101,6 +101,13 @@ static const struct option base_options[] = {
                .val = 0
        },
        {
+#define silent_opt     8
+               .name = "silent",
+               .has_arg = 0,
+               .flag = &__this_node.silent_mode,
+               .val = 1
+       },
+       {
                .name = NULL,
                .has_arg = 0,
                .flag = NULL,
@@ -118,6 +125,7 @@ static void usage(void)
        fprintf(stderr, "--session=<label>              label of shared 
multi-processing session\n");
        fprintf(stderr, "--reset                        remove any older 
session\n");
        fprintf(stderr, "--cpu-affinity=<cpu[,cpu]...>  set CPU affinity of 
threads\n");
+       fprintf(stderr, "--silent                       tame down verbosity\n");
 }
 
 static void do_cleanup(void)
@@ -220,6 +228,7 @@ void copperplate_init(int argc, char *const argv[])
                case no_mlock_opt:
                case no_registry_opt:
                case reset_session_opt:
+               case silent_opt:
                        break;
                case help_opt:
                        usage();
@@ -283,6 +292,19 @@ void copperplate_init(int argc, char *const argv[])
                }
        }
 
+#ifdef __XENO_DEBUG__
+       if (!__this_node.silent_mode) {
+               warning("Xenomai compiled with %s debug enabled,\n"
+                       "                                     "
+                       "%shigh latencies expected [--enable-debug=%s]",
+#ifdef __XENO_DEBUG_FULL__
+                       "full", "very ", "full"
+#else
+                       "partial", "", "partial"
+#endif
+                       );
+       }
+#endif
        optind = 0;
 
        return;
diff --git a/lib/copperplate/internal.c b/lib/copperplate/internal.c
index 4596457..141853c 100644
--- a/lib/copperplate/internal.c
+++ b/lib/copperplate/internal.c
@@ -36,6 +36,7 @@ struct coppernode __this_node = {
        .no_mlock = 0,
        .no_registry = 0,
        .reset_session = 0,
+       .silent_mode = 0,
 };
 
 pthread_mutex_t __printlock;
diff --git a/lib/copperplate/internal.h b/lib/copperplate/internal.h
index ee9d905..0ac2182 100644
--- a/lib/copperplate/internal.h
+++ b/lib/copperplate/internal.h
@@ -36,6 +36,7 @@ struct coppernode {
        int no_mlock;
        int no_registry;
        int reset_session;
+       int silent_mode;
 };
 
 extern struct coppernode __this_node;
diff --git a/lib/psos/testsuite/Makefile b/lib/psos/testsuite/Makefile
index ee3e1ee..9ff054f 100644
--- a/lib/psos/testsuite/Makefile
+++ b/lib/psos/testsuite/Makefile
@@ -36,7 +36,7 @@ clean:
 test: all
        @for t in $(TESTS); do \
                echo -n $$t...; \
-               sudo LD_LIBRARY_PATH=$(solibs) ./$$t --cpu-affinity=0 && echo 
ok || echo BAD; \
+               sudo LD_LIBRARY_PATH=$(solibs) ./$$t --cpu-affinity=0 --silent 
&& echo ok || echo BAD; \
        done
 
 .PHONY: clean test
diff --git a/lib/vxworks/testsuite/Makefile b/lib/vxworks/testsuite/Makefile
index 45a9045..5e62d7c 100644
--- a/lib/vxworks/testsuite/Makefile
+++ b/lib/vxworks/testsuite/Makefile
@@ -30,7 +30,7 @@ clean:
 test: all
        @for t in $(TESTS); do \
                echo -n $$t...; \
-               sudo LD_LIBRARY_PATH=$(solibs) ./$$t --cpu-affinity=0 && echo 
ok || echo BAD; \
+               sudo LD_LIBRARY_PATH=$(solibs) ./$$t --cpu-affinity=0 --silent 
&& echo ok || echo BAD; \
        done
 
 .PHONY: clean test


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to