qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r593632 - in /incubator/qpid/trunk/qpid/cpp/src: Makefile.am qpid/broker/Broker.cpp qpid/sys/SystemInfo.cpp qpid/sys/SystemInfo.h tests/perfdist
Date Fri, 09 Nov 2007 19:38:13 GMT
Author: aconway
Date: Fri Nov  9 11:38:12 2007
New Revision: 593632

URL: http://svn.apache.org/viewvc?rev=593632&view=rev
Log:
On Linux, broker defaults --worker-threads to the number of available CPU cores
reported by sysconf(_SC_NPROCESSORS_ONLN)

Added:
    incubator/qpid/trunk/qpid/cpp/src/qpid/sys/SystemInfo.cpp   (with props)
    incubator/qpid/trunk/qpid/cpp/src/qpid/sys/SystemInfo.h   (with props)
Modified:
    incubator/qpid/trunk/qpid/cpp/src/Makefile.am
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp
    incubator/qpid/trunk/qpid/cpp/src/tests/perfdist

Modified: incubator/qpid/trunk/qpid/cpp/src/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/Makefile.am?rev=593632&r1=593631&r2=593632&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/Makefile.am (original)
+++ incubator/qpid/trunk/qpid/cpp/src/Makefile.am Fri Nov  9 11:38:12 2007
@@ -128,7 +128,7 @@
   qpid/sys/AsynchIOAcceptor.cpp \
   qpid/sys/Dispatcher.cpp \
   qpid/sys/Runnable.cpp \
-  qpid/sys/RefCountedMap.h \
+  qpid/sys/SystemInfo.cpp \
   qpid/sys/Serializer.cpp \
   qpid/sys/Shlib.cpp \
   qpid/Options.cpp \
@@ -401,9 +401,11 @@
   qpid/sys/Mutex.h \
   qpid/sys/Poller.h \
   qpid/sys/Runnable.h \
+  qpid/sys/RefCountedMap.h \
   qpid/sys/ScopedIncrement.h \
   qpid/sys/Semaphore.h \
   qpid/sys/Serializer.h \
+  qpid/sys/SystemInfo.h \
   qpid/sys/Shlib.h \
   qpid/sys/ShutdownHandler.h \
   qpid/sys/Socket.h \

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp?rev=593632&r1=593631&r2=593632&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp Fri Nov  9 11:38:12 2007
@@ -39,6 +39,7 @@
 #include "qpid/sys/ConnectionInputHandler.h"
 #include "qpid/sys/ConnectionInputHandlerFactory.h"
 #include "qpid/sys/TimeoutHandler.h"
+#include "qpid/sys/SystemInfo.h"
 
 #include <boost/bind.hpp>
 
@@ -68,6 +69,8 @@
     mgmtPubInterval(10),
     ack(100)
 {
+    int c = sys::SystemInfo::concurrency();
+    if (c > 0) workerThreads=c;
     addOptions()
         ("port,p", optValue(port,"PORT"),
          "Tells the broker to listen on PORT")

Added: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/SystemInfo.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/sys/SystemInfo.cpp?rev=593632&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/sys/SystemInfo.cpp (added)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/sys/SystemInfo.cpp Fri Nov  9 11:38:12 2007
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "SystemInfo.h"
+#include <unistd.h>
+
+namespace qpid {
+namespace sys {
+
+long  SystemInfo::concurrency() {
+#ifdef _SC_NPROCESSORS_ONLN    // Linux specific.
+    return sysconf(_SC_NPROCESSORS_ONLN);
+#else
+    return -1;
+#endif
+}
+
+}} // namespace qpid::sys

Propchange: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/SystemInfo.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/SystemInfo.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/SystemInfo.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/sys/SystemInfo.h?rev=593632&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/sys/SystemInfo.h (added)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/sys/SystemInfo.h Fri Nov  9 11:38:12 2007
@@ -0,0 +1,44 @@
+#ifndef QPID_SYS_SYSTEMINFO_H
+#define QPID_SYS_SYSTEMINFO_H
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+namespace qpid {
+namespace sys {
+
+/**
+ * Retrieve information about the system we are running on.
+ * Results may be dependent on OS/hardware. 
+ */
+class SystemInfo
+{
+  public:
+    /** Estimate available concurrency, e.g. number of CPU cores.
+     * -1 means estimate not available on this platform.
+     */
+    static long concurrency();
+};
+
+}} // namespace qpid::sys
+
+
+
+#endif  /*!QPID_SYS_SYSTEMINFO_H*/

Propchange: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/SystemInfo.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/SystemInfo.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/perfdist
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/perfdist?rev=593632&r1=593631&r2=593632&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/perfdist (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/perfdist Fri Nov  9 11:38:12 2007
@@ -1,6 +1,5 @@
 #!/bin/bash
 #
-echo $_
 usage() {
 cat <<EOF
 Distributed perftest with ssh.



Mime
View raw message