Module: xenomai-gch Branch: for-forge Commit: 15b8b1201623911156c57997325a2340a54d69a9 URL: http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=15b8b1201623911156c57997325a2340a54d69a9
Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org> Date: Fri Dec 27 18:42:42 2013 +0100 latency: only ignore SIGDEBUG if reason is mode switch and various cleanups --- testsuite/latency/latency.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/testsuite/latency/latency.c b/testsuite/latency/latency.c index 2cb874e..02669a1 100644 --- a/testsuite/latency/latency.c +++ b/testsuite/latency/latency.c @@ -117,7 +117,7 @@ static void *latency(void *cookie) err = clock_gettime(CLOCK_MONOTONIC, &expected); if (err) { - fprintf(stderr, "latency: clock_gettime %m\n"); + fprintf(stderr, "latency: clock_gettime: %m\n"); return NULL; } @@ -125,8 +125,8 @@ static void *latency(void *cookie) nsamples = ONE_BILLION / period_ns; /* start time: one millisecond from now. */ expected.tv_nsec += 1000000; - if (expected.tv_nsec > 1000000000) { - expected.tv_nsec -= 1000000000; + if (expected.tv_nsec > ONE_BILLION) { + expected.tv_nsec -= ONE_BILLION; expected.tv_sec++; } timer_conf.it_value = expected; @@ -507,7 +507,7 @@ static void cleanup(void) if (max_relaxed > 0) printf( "Warning! some latency maxima may have been due to involuntary mode switches.\n" -"Please contact xenomai-h...@gna.org\n"); +"Please contact xeno...@xenomai.org\n"); if (histogram_avg) free(histogram_avg); @@ -550,11 +550,6 @@ static void sigdebug(int sig, siginfo_t *si, void *context) int n __attribute__ ((unused)); static char buffer[256]; - if (!stop_upon_switch) { - ++sampling_relaxed; - return; - } - if (reason > SIGDEBUG_WATCHDOG) reason = SIGDEBUG_UNDEFINED; @@ -568,6 +563,11 @@ static void sigdebug(int sig, siginfo_t *si, void *context) exit(EXIT_FAILURE); } + if (!stop_upon_switch) { + ++sampling_relaxed; + return; + } + n = snprintf(buffer, sizeof(buffer), fmt, reason_str[reason]); n = write(STDERR_FILENO, buffer, n); signal(sig, SIG_DFL); @@ -815,6 +815,7 @@ int main(int argc, char *const *argv) } err = pthread_create(&latency_task, &tattr, &latency, NULL); + pthread_attr_destroy(&tattr); if (err) { fprintf(stderr, _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git