[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r4978 - in gnuradio/branches/developers/eb/ibu: . mblo
From: |
eb |
Subject: |
[Commit-gnuradio] r4978 - in gnuradio/branches/developers/eb/ibu: . mblock/src/lib |
Date: |
Fri, 13 Apr 2007 00:24:10 -0600 (MDT) |
Author: eb
Date: 2007-04-13 00:24:09 -0600 (Fri, 13 Apr 2007)
New Revision: 4978
Added:
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_gettid.cc
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_gettid.h
Modified:
gnuradio/branches/developers/eb/ibu/configure.ac
gnuradio/branches/developers/eb/ibu/mblock/src/lib/Makefile.am
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_worker.cc
Log:
work-in-progress on mblocks. Hooks for sched_setaffinity
Modified: gnuradio/branches/developers/eb/ibu/configure.ac
===================================================================
--- gnuradio/branches/developers/eb/ibu/configure.ac 2007-04-13 04:53:48 UTC
(rev 4977)
+++ gnuradio/branches/developers/eb/ibu/configure.ac 2007-04-13 06:24:09 UTC
(rev 4978)
@@ -114,7 +114,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 sched.h signal.h)
+AC_CHECK_HEADERS(sys/resource.h stdint.h sched.h signal.h sys/syscall.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
@@ -131,6 +131,7 @@
AC_CHECK_FUNCS([mmap select socket strcspn strerror strspn getpagesize
sysconf])
AC_CHECK_FUNCS([snprintf gettimeofday nanosleep sched_setscheduler])
AC_CHECK_FUNCS([modf sqrt sigaction sigprocmask])
+AC_CHECK_FUNCS([sched_setaffinity])
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'.])])
Modified: gnuradio/branches/developers/eb/ibu/mblock/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/ibu/mblock/src/lib/Makefile.am
2007-04-13 04:53:48 UTC (rev 4977)
+++ gnuradio/branches/developers/eb/ibu/mblock/src/lib/Makefile.am
2007-04-13 06:24:09 UTC (rev 4978)
@@ -43,6 +43,7 @@
mb_connection.cc \
mb_endpoint.cc \
mb_exception.cc \
+ mb_gettid.cc \
mb_mblock.cc \
mb_mblock_impl.cc \
mb_message.cc \
@@ -72,6 +73,7 @@
mb_class_registry.h \
mb_common.h \
mb_exception.h \
+ mb_gettid.h \
mb_mblock.h \
mb_message.h \
mb_msg_accepter.h \
Added: gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_gettid.cc
===================================================================
--- gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_gettid.cc
(rev 0)
+++ gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_gettid.cc
2007-04-13 06:24:09 UTC (rev 4978)
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <mb_gettid.h>
+
+#define NEED_STUB
+
+#if defined(HAVE_SYS_SYSCALL_H) && defined(HAVE_UNISTD_H)
+
+#include <sys/syscall.h>
+#include <unistd.h>
+
+#if defined(SYS_gettid)
+#undef NEED_STUB
+
+int mb_gettid()
+{
+ return syscall(SYS_gettid);
+}
+
+#endif
+#endif
+
+#if defined(NEED_STUB)
+
+int
+mb_gettid()
+{
+ return 0;
+}
+
+#endif
Added: gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_gettid.h
===================================================================
--- gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_gettid.h
(rev 0)
+++ gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_gettid.h
2007-04-13 06:24:09 UTC (rev 4978)
@@ -0,0 +1,26 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/*!
+ * \brief Return Linux taskid, or 0 if not available
+ */
+int mb_gettid();
+
Modified: gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_worker.cc
===================================================================
--- gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_worker.cc
2007-04-13 04:53:48 UTC (rev 4977)
+++ gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_worker.cc
2007-04-13 06:24:09 UTC (rev 4978)
@@ -26,26 +26,14 @@
#include <mb_runtime_thread_per_block.h>
#include <mb_exception.h>
#include <mb_mblock.h>
+#include <mb_gettid.h>
#include <iostream>
+#ifdef HAVE_SCHED_H
+#include <sched.h>
+#endif
#define VERBOSE 0 // define to 0 or 1
-#include <sys/syscall.h> // Move this somewhere else and autoconf
-#include <unistd.h>
-
-#ifdef SYS_gettid
-int mb_gettid()
-{
- return syscall(SYS_gettid);
-}
-#else
-int mb_gettid()
-{
- return -1;
-}
-#endif
-
-
mb_worker::mb_worker(mb_runtime_thread_per_block *runtime,
mb_mblock_maker_t maker,
const std::string &instance_name,
@@ -64,6 +52,32 @@
}
#endif
+#ifdef HAVE_SCHED_SETAFFINITY
+static void
+set_affinity(const std::string &instance_name, const std::string &class_name)
+{
+ static int counter = 0;
+ cpu_set_t mask;
+ CPU_ZERO(&mask);
+
+ if (0){
+
+ //CPU_SET(counter & 0x1, &mask);
+ //counter++;
+ CPU_SET(0, &mask);
+
+ int r = sched_setaffinity(mb_gettid(), sizeof(mask), &mask);
+ if (r == -1)
+ perror("sched_setaffinity");
+ }
+}
+#else
+static void
+set_affinity(const std::string &instance_name, const std::string &class_name)
+{
+}
+#endif
+
void
mb_worker::set_state(worker_state_t state)
{
@@ -80,6 +94,9 @@
{
// FIXME add pthread_sigmask stuff
+ //set_affinity(d_instance_name, d_class_name);
+ set_affinity(d_instance_name, "");
+
try {
worker_thread_top_level();
d_why_dead = RIP_EXIT;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r4978 - in gnuradio/branches/developers/eb/ibu: . mblock/src/lib,
eb <=