Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78752 - trunk/libs/context/performance
From: oliver.kowalke_at_[hidden]
Date: 2012-05-29 14:23:21


Author: olli
Date: 2012-05-29 14:23:19 EDT (Tue, 29 May 2012)
New Revision: 78752
URL: http://svn.boost.org/trac/boost/changeset/78752

Log:
context: remove dependencies to other boost libs in performance test

Text files modified:
   trunk/libs/context/performance/Jamfile.v2 | 6 ++----
   trunk/libs/context/performance/bind_processor_aix.cpp | 12 ++----------
   trunk/libs/context/performance/bind_processor_freebsd.cpp | 12 ++----------
   trunk/libs/context/performance/bind_processor_hpux.cpp | 12 ++----------
   trunk/libs/context/performance/bind_processor_linux.cpp | 13 ++-----------
   trunk/libs/context/performance/bind_processor_solaris.cpp | 12 ++----------
   trunk/libs/context/performance/bind_processor_windows.cpp | 12 ++----------
   trunk/libs/context/performance/performance.cpp | 22 +---------------------
   8 files changed, 15 insertions(+), 86 deletions(-)

Modified: trunk/libs/context/performance/Jamfile.v2
==============================================================================
--- trunk/libs/context/performance/Jamfile.v2 (original)
+++ trunk/libs/context/performance/Jamfile.v2 2012-05-29 14:23:19 EDT (Tue, 29 May 2012)
@@ -15,12 +15,10 @@
 
 project boost/context/performance
     : requirements
- <library>/boost/program_options//boost_program_options
- <library>/boost/thread//boost_thread
- <library>/boost/system//boost_system
       <library>/boost/context//boost_context
       <link>static
- <threading>multi
+ <linkflags>"-lrt"
+ <threading>single
     ;
 
 alias sources

Modified: trunk/libs/context/performance/bind_processor_aix.cpp
==============================================================================
--- trunk/libs/context/performance/bind_processor_aix.cpp (original)
+++ trunk/libs/context/performance/bind_processor_aix.cpp 2012-05-29 14:23:19 EDT (Tue, 29 May 2012)
@@ -12,22 +12,14 @@
 #include <sys/thread.h>
 }
 
-#include <boost/assert.hpp>
-#include <boost/thread.hpp>
-#include <boost/system/system_error.hpp>
+#include <stdexcept>
 
 #include <boost/config/abi_prefix.hpp>
 
 void bind_to_processor( unsigned int n)
 {
- BOOST_ASSERT( n >= 0);
- BOOST_ASSERT( n < boost::thread::hardware_concurrency() );
-
     if ( ::bindprocessor( BINDTHREAD, ::thread_self(), static_cast< cpu_t >( n) ) == -1)
- throw boost::system::system_error(
- boost::system::error_code(
- errno,
- boost::system::system_category() ) );
+ throw std::runtime_error("::bindprocessor() failed");
 }
 
 #include <boost/config/abi_suffix.hpp>

Modified: trunk/libs/context/performance/bind_processor_freebsd.cpp
==============================================================================
--- trunk/libs/context/performance/bind_processor_freebsd.cpp (original)
+++ trunk/libs/context/performance/bind_processor_freebsd.cpp 2012-05-29 14:23:19 EDT (Tue, 29 May 2012)
@@ -12,26 +12,18 @@
 #include <sys/cpuset.h>
 }
 
-#include <boost/assert.hpp>
-#include <boost/thread.hpp>
-#include <boost/system/system_error.hpp>
+#include <stdexcept>
 
 #include <boost/config/abi_prefix.hpp>
 
 void bind_to_processor( unsigned int n)
 {
- BOOST_ASSERT( n >= 0);
- BOOST_ASSERT( n < boost::thread::hardware_concurrency() );
-
     cpuset_t cpuset;
     CPU_ZERO( & cpuset);
     CPU_SET( n, & cpuset);
 
     if ( ::cpuset_setaffinity( CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, sizeof( cpuset), & cpuset) == -1)
- throw boost::system::system_error(
- boost::system::error_code(
- errno,
- boost::system::system_category() ) );
+ throw std::runtime_error("::cpuset_setaffinity() failed");
 }
 
 #include <boost/config/abi_suffix.hpp>

Modified: trunk/libs/context/performance/bind_processor_hpux.cpp
==============================================================================
--- trunk/libs/context/performance/bind_processor_hpux.cpp (original)
+++ trunk/libs/context/performance/bind_processor_hpux.cpp 2012-05-29 14:23:19 EDT (Tue, 29 May 2012)
@@ -11,17 +11,12 @@
 #include <sys/pthread.h>
 }
 
-#include <boost/assert.hpp>
-#include <boost/thread.hpp>
-#include <boost/system/system_error.hpp>
+#include <stdexcept>
 
 #include <boost/config/abi_prefix.hpp>
 
 void bind_to_processor( unsigned int n)
 {
- BOOST_ASSERT( n >= 0);
- BOOST_ASSERT( n < boost::thread::hardware_concurrency() );
-
     ::pthread_spu_t spu;
     int errno_(
         ::pthread_processor_bind_np(
@@ -30,10 +25,7 @@
             static_cast< pthread_spu_t >( n),
             PTHREAD_SELFTID_NP) );
     if ( errno_ != 0)
- throw boost::system::system_error(
- boost::system::error_code(
- errno_,
- boost::system::system_category() ) );
+ throw std::runtime_error("::pthread_processor_bind_np() failed");
 }
 
 #include <boost/config/abi_suffix.hpp>

Modified: trunk/libs/context/performance/bind_processor_linux.cpp
==============================================================================
--- trunk/libs/context/performance/bind_processor_linux.cpp (original)
+++ trunk/libs/context/performance/bind_processor_linux.cpp 2012-05-29 14:23:19 EDT (Tue, 29 May 2012)
@@ -12,28 +12,19 @@
 #include <sched.h>
 }
 
-#include <boost/assert.hpp>
-#include <boost/thread.hpp>
-#include <boost/system/system_error.hpp>
+#include <stdexcept>
 
 #include <boost/config/abi_prefix.hpp>
 
 void bind_to_processor( unsigned int n)
 {
- BOOST_ASSERT( n >= 0);
- BOOST_ASSERT( n < CPU_SETSIZE);
- BOOST_ASSERT( n < boost::thread::hardware_concurrency() );
-
     cpu_set_t cpuset;
     CPU_ZERO( & cpuset);
     CPU_SET( n, & cpuset);
 
     int errno_( ::pthread_setaffinity_np( ::pthread_self(), sizeof( cpuset), & cpuset) );
     if ( errno_ != 0)
- throw boost::system::system_error(
- boost::system::error_code(
- errno_,
- boost::system::system_category() ) );
+ throw std::runtime_error("::pthread_setaffinity_np() failed");
 }
 
 #include <boost/config/abi_suffix.hpp>

Modified: trunk/libs/context/performance/bind_processor_solaris.cpp
==============================================================================
--- trunk/libs/context/performance/bind_processor_solaris.cpp (original)
+++ trunk/libs/context/performance/bind_processor_solaris.cpp 2012-05-29 14:23:19 EDT (Tue, 29 May 2012)
@@ -13,22 +13,14 @@
 #include <sys/procset.h>
 }
 
-#include <boost/assert.hpp>
-#include <boost/thread.hpp>
-#include <boost/system/system_error.hpp>
+#include <stdexcept>
 
 #include <boost/config/abi_prefix.hpp>
 
 void bind_to_processor( unsigned int n)
 {
- BOOST_ASSERT( n >= 0);
- BOOST_ASSERT( n < boost::thread::hardware_concurrency() );
-
     if ( ::processor_bind( P_LWPID, P_MYID, static_cast< processorid_t >( n), 0) == -1)
- throw boost::system::system_error(
- boost::system::error_code(
- errno,
- boost::system::system_category() ) );
+ throw std::runtime_error("::processor_bind() failed");
 }
 
 #include <boost/config/abi_suffix.hpp>

Modified: trunk/libs/context/performance/bind_processor_windows.cpp
==============================================================================
--- trunk/libs/context/performance/bind_processor_windows.cpp (original)
+++ trunk/libs/context/performance/bind_processor_windows.cpp 2012-05-29 14:23:19 EDT (Tue, 29 May 2012)
@@ -11,22 +11,14 @@
 #include <windows.h>
 }
 
-#include <boost/assert.hpp>
-#include <boost/thread.hpp>
-#include <boost/system/system_error.hpp>
+#include <stdexcept>
 
 #include <boost/config/abi_prefix.hpp>
 
 void bind_to_processor( unsigned int n)
 {
- BOOST_ASSERT( n >= 0);
- BOOST_ASSERT( n < boost::thread::hardware_concurrency() );
-
     if ( ::SetThreadAffinityMask( ::GetCurrentThread(), ( DWORD_PTR)1 << n) == 0)
- throw boost::system::system_error(
- boost::system::error_code(
- ::GetLastError(),
- boost::system::system_category() ) );
+ throw std::runtime_error("::SetThreadAffinityMask() failed");
 }
 
 #include <boost/config/abi_suffix.hpp>

Modified: trunk/libs/context/performance/performance.cpp
==============================================================================
--- trunk/libs/context/performance/performance.cpp (original)
+++ trunk/libs/context/performance/performance.cpp 2012-05-29 14:23:19 EDT (Tue, 29 May 2012)
@@ -31,9 +31,8 @@
 #endif
 
 namespace ctx = boost::ctx;
-namespace po = boost::program_options;
 
-bool preserve_fpu = true;
+bool preserve_fpu = false;
 
 #define CALL_FUNCTION(z,n,unused) \
     fn();
@@ -216,25 +215,6 @@
 {
     try
     {
- po::options_description desc("allowed options");
- desc.add_options()
- ("help,h", "help message")
- ("preserve-fpu,p", po::value< bool >( & preserve_fpu), "preserve floating point env");
-
- po::variables_map vm;
- po::store(
- po::parse_command_line(
- argc,
- argv,
- desc),
- vm);
- po::notify( vm);
-
- if ( vm.count("help") )
- {
- std::cout << desc << std::endl;
- return EXIT_SUCCESS;
- }
         bind_to_processor( 0);
 
 #ifdef BOOST_CONTEXT_CYCLE


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk