commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] gnuradio-core ChangeLog configure.ac src/lib/ru...


From: Eric Blossom
Subject: [Commit-gnuradio] gnuradio-core ChangeLog configure.ac src/lib/ru...
Date: Sat, 17 Jun 2006 19:28:09 +0000

CVSROOT:        /sources/gnuradio
Module name:    gnuradio-core
Changes by:     Eric Blossom <eb>       06/06/17 19:28:09

Modified files:
        .              : ChangeLog configure.ac 
        src/lib/runtime: Makefile.am runtime.i 
Added files:
        src/lib/runtime: gr_realtime.cc gr_realtime.h gr_realtime.i 

Log message:
        new function to enable real-time scheduling

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnuradio-core/ChangeLog?cvsroot=gnuradio&r1=1.237&r2=1.238
http://cvs.savannah.gnu.org/viewcvs/gnuradio-core/configure.ac?cvsroot=gnuradio&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/gnuradio-core/src/lib/runtime/Makefile.am?cvsroot=gnuradio&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnuradio-core/src/lib/runtime/runtime.i?cvsroot=gnuradio&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnuradio-core/src/lib/runtime/gr_realtime.cc?cvsroot=gnuradio&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnuradio-core/src/lib/runtime/gr_realtime.h?cvsroot=gnuradio&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnuradio-core/src/lib/runtime/gr_realtime.i?cvsroot=gnuradio&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnuradio/gnuradio-core/ChangeLog,v
retrieving revision 1.237
retrieving revision 1.238
diff -u -b -r1.237 -r1.238
--- ChangeLog   16 Jun 2006 06:32:38 -0000      1.237
+++ ChangeLog   17 Jun 2006 19:28:09 -0000      1.238
@@ -1,3 +1,8 @@
+2006-06-17  Eric Blossom  <address@hidden>
+
+       * src/lib/runtime/gr_realtime.{h,cc,i}: new function to enable
+       realtime scheduling.
+
 2006-06-15  Eric Blossom  <address@hidden>
 
        * src/lib/io/gr_oscope_guts.{h,cc,i},

Index: configure.ac
===================================================================
RCS file: /sources/gnuradio/gnuradio-core/configure.ac,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- configure.ac        16 Apr 2006 03:41:58 -0000      1.47
+++ configure.ac        17 Jun 2006 19:28:09 -0000      1.48
@@ -81,7 +81,7 @@
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(fcntl.h limits.h strings.h time.h sys/ioctl.h sys/time.h 
unistd.h)
 AC_CHECK_HEADERS(linux/ppdev.h sys/mman.h sys/select.h sys/types.h)
-AC_CHECK_HEADERS(sys/resource.h stdint.h)
+AC_CHECK_HEADERS(sys/resource.h stdint.h sched.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
@@ -94,7 +94,7 @@
 AC_FUNC_SETVBUF_REVERSED
 AC_FUNC_VPRINTF
 AC_CHECK_FUNCS([mmap select socket strcspn strerror strspn getpagesize 
sysconf])
-AC_CHECK_FUNCS([snprintf gettimeofday nanosleep])
+AC_CHECK_FUNCS([snprintf gettimeofday nanosleep sched_setscheduler])
 
 AC_CHECK_LIB(m, sincos, [AC_DEFINE([HAVE_SINCOS],[1],[Define to 1 if your 
system has `sincos'.])])
 AC_CHECK_LIB(m, sincosf,[AC_DEFINE([HAVE_SINCOSF],[1],[Define to 1 if your 
system has `sincosf'.])])

Index: src/lib/runtime/Makefile.am
===================================================================
RCS file: /sources/gnuradio/gnuradio-core/src/lib/runtime/Makefile.am,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- src/lib/runtime/Makefile.am 13 Oct 2005 03:16:34 -0000      1.12
+++ src/lib/runtime/Makefile.am 17 Jun 2006 19:28:09 -0000      1.13
@@ -42,6 +42,7 @@
        gr_msg_queue.cc                         \
        gr_pagesize.cc                          \
        gr_preferences.cc                       \
+       gr_realtime.cc                          \
        gr_single_threaded_scheduler.cc         \
        gr_tmp_path.cc                          \
        gr_vmcircbuf.cc                         \
@@ -72,6 +73,7 @@
        gr_msg_queue.h                          \
        gr_pagesize.h                           \
        gr_preferences.h                        \
+       gr_realtime.h                           \
        gr_runtime.h                            \
        gr_select_handler.h                     \
        gr_single_threaded_scheduler.h          \
@@ -101,6 +103,7 @@
        gr_message.i                    \
        gr_msg_handler.i                \
        gr_msg_queue.i                  \
+       gr_realtime.i                   \
        gr_single_threaded_scheduler.i  \
        gr_swig_block_magic.i           \
        runtime.i

Index: src/lib/runtime/runtime.i
===================================================================
RCS file: /sources/gnuradio/gnuradio-core/src/lib/runtime/runtime.i,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- src/lib/runtime/runtime.i   29 Mar 2005 00:34:20 -0000      1.3
+++ src/lib/runtime/runtime.i   17 Jun 2006 19:28:09 -0000      1.4
@@ -32,6 +32,7 @@
 #include <gr_msg_queue.h>
 #include <gr_dispatcher.h>
 #include <gr_error_handler.h>
+#include <gr_realtime.h>
 %}
 
 %include <gr_io_signature.i>
@@ -45,3 +46,4 @@
 %include <gr_msg_queue.i>
 %include <gr_dispatcher.i>
 %include <gr_error_handler.i>
+%include <gr_realtime.i>

Index: src/lib/runtime/gr_realtime.cc
===================================================================
RCS file: src/lib/runtime/gr_realtime.cc
diff -N src/lib/runtime/gr_realtime.cc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ src/lib/runtime/gr_realtime.cc      17 Jun 2006 19:28:09 -0000      1.1
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio 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, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio 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 GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gr_realtime.h>
+
+#ifdef HAVE_SCHED_H
+#include <sched.h>
+#endif
+
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+#if defined(HAVE_SCHED_SETSCHEDULER)
+
+gr_rt_status_t
+gr_enable_realtime_scheduling()
+{
+  int policy = SCHED_FIFO;
+  int pri = (sched_get_priority_max (policy) - sched_get_priority_min 
(policy)) / 2;
+  int pid = 0;  // this process
+
+  struct sched_param param;
+  memset(&param, 0, sizeof(param));
+  param.sched_priority = pri;
+  int result = sched_setscheduler(pid, policy, &param);
+  if (result != 0){
+    if (errno == EPERM)
+      return RT_NO_PRIVS;
+    else {
+      perror ("sched_setscheduler: 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
+
+gr_rt_status_t
+gr_enable_realtime_scheduling()
+{
+  return RT_NOT_IMPLEMENTED;
+}
+
+#endif

Index: src/lib/runtime/gr_realtime.h
===================================================================
RCS file: src/lib/runtime/gr_realtime.h
diff -N src/lib/runtime/gr_realtime.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ src/lib/runtime/gr_realtime.h       17 Jun 2006 19:28:09 -0000      1.1
@@ -0,0 +1,39 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio 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, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio 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 GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INCLUDED_GR_REALTIME_H
+#define INCLUDED_GR_REALTIME_H
+
+typedef enum {
+  RT_OK = 0,
+  RT_NOT_IMPLEMENTED,
+  RT_NO_PRIVS,
+  RT_OTHER_ERROR
+} gr_rt_status_t;
+
+/*!
+ * \brief If possible, enable high-priority "real time" scheduling.
+ */
+gr_rt_status_t
+gr_enable_realtime_scheduling();
+
+#endif /* INCLUDED_GR_REALTIME_H */

Index: src/lib/runtime/gr_realtime.i
===================================================================
RCS file: src/lib/runtime/gr_realtime.i
diff -N src/lib/runtime/gr_realtime.i
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ src/lib/runtime/gr_realtime.i       17 Jun 2006 19:28:09 -0000      1.1
@@ -0,0 +1,4 @@
+%rename(enable_realtime_scheduling) gr_enable_realtime_scheduling;
+
+%include <gr_realtime.h>
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]