[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6417 - in gnuradio/branches/developers/michaelld/mc_a
From: |
michaelld |
Subject: |
[Commit-gnuradio] r6417 - in gnuradio/branches/developers/michaelld/mc_and_rt: config gnuradio-core/src/lib/runtime gr-usrp/src |
Date: |
Thu, 13 Sep 2007 08:25:18 -0600 (MDT) |
Author: michaelld
Date: 2007-09-13 08:25:18 -0600 (Thu, 13 Sep 2007)
New Revision: 6417
Modified:
gnuradio/branches/developers/michaelld/mc_and_rt/config/grc_usrp.m4
gnuradio/branches/developers/michaelld/mc_and_rt/gnuradio-core/src/lib/runtime/gr_realtime.cc
gnuradio/branches/developers/michaelld/mc_and_rt/gr-usrp/src/run_tests.in
Log:
Made changes, such that:
* trunk now passes "make distcheck" on OSX
* verified that 'realtime' scheduling now works on systems with
'pthread_setschedparam' but not 'sched_setscheduler' (e.g. darwin);
the latter has priority if both are installed.
Modified: gnuradio/branches/developers/michaelld/mc_and_rt/config/grc_usrp.m4
===================================================================
--- gnuradio/branches/developers/michaelld/mc_and_rt/config/grc_usrp.m4
2007-09-13 13:10:39 UTC (rev 6416)
+++ gnuradio/branches/developers/michaelld/mc_and_rt/config/grc_usrp.m4
2007-09-13 14:25:18 UTC (rev 6417)
@@ -1,4 +1,4 @@
-dnl Copyright 2001,2002,2003,2004,2005,2006 Free Software Foundation, Inc.
+dnl Copyright 2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Radio
dnl
@@ -54,7 +54,7 @@
# These checks don't fail
AC_C_BIGENDIAN
AC_CHECK_HEADERS([byteswap.h linux/compiler.h])
- AC_CHECK_FUNCS([getrusage sched_setscheduler])
+ AC_CHECK_FUNCS([getrusage sched_setscheduler pthread_setschedparam])
AC_CHECK_FUNCS([sigaction snprintf])
passed=yes
Modified:
gnuradio/branches/developers/michaelld/mc_and_rt/gnuradio-core/src/lib/runtime/gr_realtime.cc
===================================================================
---
gnuradio/branches/developers/michaelld/mc_and_rt/gnuradio-core/src/lib/runtime/gr_realtime.cc
2007-09-13 13:10:39 UTC (rev 6416)
+++
gnuradio/branches/developers/michaelld/mc_and_rt/gnuradio-core/src/lib/runtime/gr_realtime.cc
2007-09-13 14:25:18 UTC (rev 6417)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006 Free Software Foundation, Inc.
+ * Copyright 2006,2007 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -58,6 +58,42 @@
return RT_OK;
}
+#elif defined(HAVE_PTHREAD_SETSCHEDPARAM)
+
+#include <pthread.h>
+
+gr_rt_status_t
+gr_enable_realtime_scheduling()
+{
+ int policy = 0;
+ int pri = 0;
+ pthread_t this_thread = pthread_self (); // this process
+ struct sched_param param;
+ memset (¶m, 0, sizeof (param));
+ param.sched_priority = pri;
+ int result = pthread_getschedparam (this_thread, &policy, ¶m);
+ if (result == 0) { // good results
+ // set the priority half-way between the default and maximum
+ pri = (sched_get_priority_max (policy) + param.sched_priority) / 2;
+
+ int policy = SCHED_FIFO; // desired policy
+ struct sched_param param;
+ memset (¶m, 0, sizeof (struct sched_param));
+ param.sched_priority = pri;
+ result = pthread_setschedparam (this_thread, policy, ¶m);
+ }
+ if (result != 0) {
+ if (errno == EPERM)
+ return RT_NO_PRIVS;
+ else {
+ perror ("pthread_setschedparam: failed to set real time priority");
+ return RT_OTHER_ERROR;
+ }
+ }
+ // printf ("SCHED_FIFO enabled with priority = %d\n", pri);
+ return RT_OK;
+}
+
// #elif // could try negative niceness
#else
Modified:
gnuradio/branches/developers/michaelld/mc_and_rt/gr-usrp/src/run_tests.in
===================================================================
--- gnuradio/branches/developers/michaelld/mc_and_rt/gr-usrp/src/run_tests.in
2007-09-13 13:10:39 UTC (rev 6416)
+++ gnuradio/branches/developers/michaelld/mc_and_rt/gr-usrp/src/run_tests.in
2007-09-13 14:25:18 UTC (rev 6417)
@@ -5,11 +5,11 @@
# 3rd parameter is path to Python QA directory
# For OS/X
address@hidden@/usrp/host/lib/:@abs_top_builddir@/usrp/host/lib/.libs:$DYLD_LIBRARY_PATH
address@hidden@/usrp/host/lib/legacy/:@abs_top_builddir@/usrp/host/lib/legacy/.libs:$DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH
# For Win32
address@hidden@/usrp/host/lib/.libs:$PATH
address@hidden@/usrp/host/lib/legacy/.libs:$PATH
@top_builddir@/run_tests.sh \
@abs_top_srcdir@/gr-usrp \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6417 - in gnuradio/branches/developers/michaelld/mc_and_rt: config gnuradio-core/src/lib/runtime gr-usrp/src,
michaelld <=