diff options
author | Alan Conway <aconway@apache.org> | 2009-04-15 17:45:45 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2009-04-15 17:45:45 +0000 |
commit | 1320f098a6d6560a848df15fde6caa9c4eec9c10 (patch) | |
tree | 4331fa0488bb4d48b14e4ea6679d4412787954d0 /qpid/cpp | |
parent | 001766f4732ec8ab46b5b8550070e59e550daa97 (diff) | |
download | qpid-python-1320f098a6d6560a848df15fde6caa9c4eec9c10.tar.gz |
Cleaned up some un-necessary #include dependencies.
Removed un-used LatencyMetric hack.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@765285 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
23 files changed, 22 insertions, 186 deletions
diff --git a/qpid/cpp/src/qpid/client/Completion.h b/qpid/cpp/src/qpid/client/Completion.h index c4979d7934..5c5a0bb512 100644 --- a/qpid/cpp/src/qpid/client/Completion.h +++ b/qpid/cpp/src/qpid/client/Completion.h @@ -24,11 +24,12 @@ #include <boost/shared_ptr.hpp> #include "Future.h" -#include "SessionImpl.h" namespace qpid { namespace client { +class SessionImpl; + /** * Asynchronous commands that do not return a result will return a * Completion. You can use the completion to wait for that specific diff --git a/qpid/cpp/src/qpid/client/Connection.cpp b/qpid/cpp/src/qpid/client/Connection.cpp index cc62d724cb..e8415403ca 100644 --- a/qpid/cpp/src/qpid/client/Connection.cpp +++ b/qpid/cpp/src/qpid/client/Connection.cpp @@ -19,6 +19,7 @@ * */ #include "Connection.h" +#include "ConnectionImpl.h" #include "ConnectionSettings.h" #include "Message.h" #include "SessionImpl.h" diff --git a/qpid/cpp/src/qpid/client/Connection.h b/qpid/cpp/src/qpid/client/Connection.h index 846ac33790..d898ea70d9 100644 --- a/qpid/cpp/src/qpid/client/Connection.h +++ b/qpid/cpp/src/qpid/client/Connection.h @@ -25,6 +25,7 @@ #include <string> #include "qpid/client/Session.h" #include "qpid/client/ClientImportExport.h" +#include "qpid/client/ConnectionSettings.h" namespace qpid { @@ -32,7 +33,6 @@ struct Url; namespace client { -struct ConnectionSettings; class ConnectionImpl; /** diff --git a/qpid/cpp/src/qpid/client/Dispatcher.cpp b/qpid/cpp/src/qpid/client/Dispatcher.cpp index 8d8574520a..8ae763b4f3 100644 --- a/qpid/cpp/src/qpid/client/Dispatcher.cpp +++ b/qpid/cpp/src/qpid/client/Dispatcher.cpp @@ -49,6 +49,9 @@ Dispatcher::Dispatcher(const Session& s, const std::string& q) session.getExecution().getDemux().get(q); } +Dispatcher::~Dispatcher() {} + + void Dispatcher::start() { worker = Thread(this); diff --git a/qpid/cpp/src/qpid/client/Dispatcher.h b/qpid/cpp/src/qpid/client/Dispatcher.h index e84f8f303d..4dbb75dcf2 100644 --- a/qpid/cpp/src/qpid/client/Dispatcher.h +++ b/qpid/cpp/src/qpid/client/Dispatcher.h @@ -30,7 +30,6 @@ #include "qpid/sys/Runnable.h" #include "qpid/sys/Thread.h" #include "MessageListener.h" -#include "SubscriptionImpl.h" namespace qpid { namespace client { @@ -61,6 +60,7 @@ class Dispatcher : public sys::Runnable public: Dispatcher(const Session& session, const std::string& queue = ""); + ~Dispatcher(); void start(); void wait(); diff --git a/qpid/cpp/src/qpid/client/FailoverListener.cpp b/qpid/cpp/src/qpid/client/FailoverListener.cpp index 16370f8912..ed9354d528 100644 --- a/qpid/cpp/src/qpid/client/FailoverListener.cpp +++ b/qpid/cpp/src/qpid/client/FailoverListener.cpp @@ -20,6 +20,9 @@ */ #include "FailoverListener.h" #include "SessionBase_0_10Access.h" +#include "qpid/client/SessionImpl.h" +#include "qpid/client/ConnectionImpl.h" +#include "qpid/client/SubscriptionImpl.h" #include "qpid/client/SubscriptionManager.h" #include "qpid/framing/Uuid.h" #include "qpid/log/Statement.h" diff --git a/qpid/cpp/src/qpid/client/FailoverListener.h b/qpid/cpp/src/qpid/client/FailoverListener.h index fe73a26611..7afee736ac 100644 --- a/qpid/cpp/src/qpid/client/FailoverListener.h +++ b/qpid/cpp/src/qpid/client/FailoverListener.h @@ -33,6 +33,7 @@ namespace qpid { namespace client { class SubscriptionManager; +class ConnectionImpl; /** * @internal Listen for failover updates from the amq.failover exchange. diff --git a/qpid/cpp/src/qpid/client/Future.cpp b/qpid/cpp/src/qpid/client/Future.cpp index 6a0c78ae4b..fda40219ba 100644 --- a/qpid/cpp/src/qpid/client/Future.cpp +++ b/qpid/cpp/src/qpid/client/Future.cpp @@ -20,6 +20,7 @@ */ #include "Future.h" +#include "SessionImpl.h" namespace qpid { namespace client { diff --git a/qpid/cpp/src/qpid/client/Future.h b/qpid/cpp/src/qpid/client/Future.h index ea01522fe8..b26af06348 100644 --- a/qpid/cpp/src/qpid/client/Future.h +++ b/qpid/cpp/src/qpid/client/Future.h @@ -29,7 +29,6 @@ #include "qpid/framing/StructHelper.h" #include "FutureCompletion.h" #include "FutureResult.h" -#include "SessionImpl.h" #include "ClientImportExport.h" namespace qpid { diff --git a/qpid/cpp/src/qpid/client/LocalQueue.cpp b/qpid/cpp/src/qpid/client/LocalQueue.cpp index e449c9f795..481dc0f946 100644 --- a/qpid/cpp/src/qpid/client/LocalQueue.cpp +++ b/qpid/cpp/src/qpid/client/LocalQueue.cpp @@ -21,6 +21,7 @@ #include "LocalQueue.h" #include "qpid/Exception.h" #include "qpid/framing/FrameSet.h" +#include "qpid/framing/MessageTransferBody.h" #include "qpid/framing/reply_exceptions.h" #include "HandlePrivate.h" #include "SubscriptionImpl.h" diff --git a/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp b/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp index e81b78ecd3..66878c7672 100644 --- a/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp +++ b/qpid/cpp/src/qpid/client/SessionBase_0_10.cpp @@ -20,6 +20,7 @@ */ #include "SessionBase_0_10.h" #include "Connection.h" +#include "qpid/client/SessionImpl.h" #include "qpid/framing/all_method_bodies.h" namespace qpid { diff --git a/qpid/cpp/src/qpid/client/SessionBase_0_10.h b/qpid/cpp/src/qpid/client/SessionBase_0_10.h index 3ae21936f6..afea0cea59 100644 --- a/qpid/cpp/src/qpid/client/SessionBase_0_10.h +++ b/qpid/cpp/src/qpid/client/SessionBase_0_10.h @@ -28,9 +28,7 @@ #include "qpid/framing/MethodContent.h" #include "qpid/framing/TransferContent.h" #include "qpid/client/Completion.h" -#include "qpid/client/ConnectionImpl.h" #include "qpid/client/Execution.h" -#include "qpid/client/SessionImpl.h" #include "qpid/client/TypedResult.h" #include "qpid/shared_ptr.h" #include "qpid/client/ClientImportExport.h" @@ -62,7 +60,7 @@ enum CreditUnit { MESSAGE_CREDIT=0, BYTE_CREDIT=1, UNLIMITED_CREDIT=0xFFFFFFFF } */ class SessionBase_0_10 { public: - + typedef framing::TransferContent DefaultContent; ///@internal diff --git a/qpid/cpp/src/qpid/cluster/Cluster.cpp b/qpid/cpp/src/qpid/cluster/Cluster.cpp index ff72c6032e..a17f54078c 100644 --- a/qpid/cpp/src/qpid/cluster/Cluster.cpp +++ b/qpid/cpp/src/qpid/cluster/Cluster.cpp @@ -47,7 +47,6 @@ #include "qpid/management/ManagementBroker.h" #include "qpid/memory.h" #include "qpid/shared_ptr.h" -#include "qpid/sys/LatencyMetric.h" #include "qpid/sys/Thread.h" #include <boost/bind.hpp> @@ -227,8 +226,6 @@ void Cluster::deliver( MemberId from(nodeid, pid); framing::Buffer buf(static_cast<char*>(msg), msg_len); Event e(Event::decodeCopy(from, buf)); - if (from == self) // Record self-deliveries for flow control. - mcast.selfDeliver(e); deliverEvent(e); } diff --git a/qpid/cpp/src/qpid/cluster/Connection.cpp b/qpid/cpp/src/qpid/cluster/Connection.cpp index 4cb3dec970..97cafbabaa 100644 --- a/qpid/cpp/src/qpid/cluster/Connection.cpp +++ b/qpid/cpp/src/qpid/cluster/Connection.cpp @@ -39,8 +39,6 @@ #include "qpid/framing/ConnectionCloseBody.h" #include "qpid/framing/ConnectionCloseOkBody.h" #include "qpid/log/Statement.h" -#include "qpid/sys/LatencyMetric.h" -#include "qpid/sys/AtomicValue.h" #include <boost/current_function.hpp> diff --git a/qpid/cpp/src/qpid/cluster/Event.h b/qpid/cpp/src/qpid/cluster/Event.h index e05ad60bcf..f0e445a08c 100644 --- a/qpid/cpp/src/qpid/cluster/Event.h +++ b/qpid/cpp/src/qpid/cluster/Event.h @@ -25,7 +25,6 @@ #include "types.h" #include "qpid/RefCountedBuffer.h" #include "qpid/framing/AMQFrame.h" -#include "qpid/sys/LatencyMetric.h" #include <sys/uio.h> // For iovec #include <iosfwd> @@ -42,7 +41,7 @@ class Buffer; namespace cluster { /** Header data for a multicast event */ -class EventHeader : public ::qpid::sys::LatencyMetricTimestamp { +class EventHeader { public: EventHeader(EventType t=DATA, const ConnectionId& c=ConnectionId(), size_t size=0); void decode(const MemberId& m, framing::Buffer&); diff --git a/qpid/cpp/src/qpid/cluster/EventFrame.h b/qpid/cpp/src/qpid/cluster/EventFrame.h index aada4c2628..e275aac7aa 100644 --- a/qpid/cpp/src/qpid/cluster/EventFrame.h +++ b/qpid/cpp/src/qpid/cluster/EventFrame.h @@ -25,7 +25,6 @@ #include "types.h" #include "Event.h" #include "qpid/framing/AMQFrame.h" -#include "qpid/sys/LatencyMetric.h" #include <boost/intrusive_ptr.hpp> #include <iosfwd> diff --git a/qpid/cpp/src/qpid/cluster/Multicaster.cpp b/qpid/cpp/src/qpid/cluster/Multicaster.cpp index f0738ab08f..3b9d3ac990 100644 --- a/qpid/cpp/src/qpid/cluster/Multicaster.cpp +++ b/qpid/cpp/src/qpid/cluster/Multicaster.cpp @@ -22,7 +22,6 @@ #include "Multicaster.h" #include "Cpg.h" #include "qpid/log/Statement.h" -#include "qpid/sys/LatencyMetric.h" #include "qpid/framing/AMQBody.h" #include "qpid/framing/AMQFrame.h" @@ -64,7 +63,6 @@ void Multicaster::mcast(const Event& e) { return; } } - QPID_LATENCY_INIT(e); queue.push(e); } @@ -73,7 +71,6 @@ void Multicaster::sendMcast(PollableEventQueue::Queue& values) { try { PollableEventQueue::Queue::iterator i = values.begin(); while( i != values.end()) { - QPID_LATENCY_RECORD("mcast send queue", *i); iovec iov = i->toIovec(); if (!cpg.mcast(&iov, 1)) { // cpg didn't send because of CPG flow control. @@ -97,9 +94,4 @@ void Multicaster::release() { holdingQueue.clear(); } -void Multicaster::selfDeliver(const Event& e) { - sys::Mutex::ScopedLock l(lock); - QPID_LATENCY_RECORD("cpg self deliver", e); -} - }} // namespace qpid::cluster diff --git a/qpid/cpp/src/qpid/cluster/OutputInterceptor.h b/qpid/cpp/src/qpid/cluster/OutputInterceptor.h index 5000893727..61e246bb89 100644 --- a/qpid/cpp/src/qpid/cluster/OutputInterceptor.h +++ b/qpid/cpp/src/qpid/cluster/OutputInterceptor.h @@ -26,7 +26,6 @@ #include "NoOpConnectionOutputHandler.h" #include "qpid/sys/ConnectionOutputHandler.h" #include "qpid/broker/ConnectionFactory.h" -#include "qpid/sys/LatencyMetric.h" #include <boost/function.hpp> namespace qpid { @@ -38,7 +37,7 @@ class Connection; /** * Interceptor for connection OutputHandler, manages outgoing message replication. */ -class OutputInterceptor : public sys::ConnectionOutputHandler, sys::LatencyMetricTimestamp { +class OutputInterceptor : public sys::ConnectionOutputHandler { public: OutputInterceptor(cluster::Connection& p, sys::ConnectionOutputHandler& h); diff --git a/qpid/cpp/src/qpid/cluster/UpdateClient.cpp b/qpid/cpp/src/qpid/cluster/UpdateClient.cpp index 2696495cb7..7efe84f2d7 100644 --- a/qpid/cpp/src/qpid/cluster/UpdateClient.cpp +++ b/qpid/cpp/src/qpid/cluster/UpdateClient.cpp @@ -26,6 +26,8 @@ #include "ExpiryPolicy.h" #include "qpid/client/SessionBase_0_10Access.h" #include "qpid/client/ConnectionAccess.h" +#include "qpid/client/SessionImpl.h" +#include "qpid/client/ConnectionImpl.h" #include "qpid/broker/Broker.h" #include "qpid/broker/Queue.h" #include "qpid/broker/QueueRegistry.h" diff --git a/qpid/cpp/src/qpid/cluster/UpdateClient.h b/qpid/cpp/src/qpid/cluster/UpdateClient.h index 23d061b7e4..96e2479955 100644 --- a/qpid/cpp/src/qpid/cluster/UpdateClient.h +++ b/qpid/cpp/src/qpid/cluster/UpdateClient.h @@ -24,6 +24,7 @@ #include "ClusterMap.h" #include "qpid/client/Connection.h" +#include "qpid/client/ConnectionSettings.h" #include "qpid/client/AsyncSession.h" #include "qpid/broker/SemanticState.h" #include "qpid/sys/Runnable.h" diff --git a/qpid/cpp/src/qpid/framing/AMQFrame.h b/qpid/cpp/src/qpid/framing/AMQFrame.h index 34319e7ed4..2f0a01d6ca 100644 --- a/qpid/cpp/src/qpid/framing/AMQFrame.h +++ b/qpid/cpp/src/qpid/framing/AMQFrame.h @@ -26,7 +26,6 @@ #include "AMQContentBody.h" #include "AMQHeartbeatBody.h" #include "ProtocolVersion.h" -#include "qpid/sys/LatencyMetric.h" #include <boost/intrusive_ptr.hpp> #include <boost/cast.hpp> #include "qpid/CommonImportExport.h" @@ -34,7 +33,7 @@ namespace qpid { namespace framing { -class AMQFrame : public AMQDataBlock, public sys::LatencyMetricTimestamp +class AMQFrame : public AMQDataBlock { public: QPID_COMMON_EXTERN AMQFrame(const boost::intrusive_ptr<AMQBody>& b=0); diff --git a/qpid/cpp/src/qpid/sys/LatencyMetric.cpp b/qpid/cpp/src/qpid/sys/LatencyMetric.cpp deleted file mode 100644 index caa221def4..0000000000 --- a/qpid/cpp/src/qpid/sys/LatencyMetric.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * - * 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. - * - */ - -#ifdef QPID_LATENCY_METRIC - -#include "LatencyMetric.h" -#include "Time.h" -#include <iostream> - -namespace qpid { -namespace sys { - -void LatencyMetricTimestamp::initialize(const LatencyMetricTimestamp& ts) { - const_cast<int64_t&>(ts.latency_metric_timestamp) = Duration(now()); -} - -void LatencyMetricTimestamp::clear(const LatencyMetricTimestamp& ts) { - const_cast<int64_t&>(ts.latency_metric_timestamp) = 0; -} - -LatencyMetric::LatencyMetric(const char* msg, int64_t skip_) : - message(msg), count(0), total(0), skipped(0), skip(skip_) -{} - -LatencyMetric::~LatencyMetric() { report(); } - -void LatencyMetric::record(const LatencyMetricTimestamp& start) { - if (!start.latency_metric_timestamp) return; // Ignore 0 timestamps. - if (skip) { - if (++skipped < skip) return; - else skipped = 0; - } - ++count; - int64_t now_ = Duration(now()); - total += now_ - start.latency_metric_timestamp; - // Set start time for next leg of the journey - const_cast<int64_t&>(start.latency_metric_timestamp) = now_; -} - -void LatencyMetric::report() { - using namespace std; - if (count) { - cout << "LATENCY: " << message << ": " - << total / (count * TIME_USEC) << " microseconds" << endl; - } - else { - cout << "LATENCY: " << message << ": no data." << endl; - } - count = 0; - total = 0; -} - - -}} // namespace qpid::sys - -#endif diff --git a/qpid/cpp/src/qpid/sys/LatencyMetric.h b/qpid/cpp/src/qpid/sys/LatencyMetric.h deleted file mode 100644 index 63b5020db4..0000000000 --- a/qpid/cpp/src/qpid/sys/LatencyMetric.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef QPID_SYS_LATENCYMETRIC_H -#define QPID_SYS_LATENCYMETRIC_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. - * - */ - -#ifdef QPID_LATENCY_METRIC - -#include "qpid/sys/IntegerTypes.h" - -namespace qpid { -namespace sys { - -/** Use this base class to add a timestamp for latency to an object */ -struct LatencyMetricTimestamp { - LatencyMetricTimestamp() : latency_metric_timestamp(0) {} - static void initialize(const LatencyMetricTimestamp&); - static void clear(const LatencyMetricTimestamp&); - int64_t latency_metric_timestamp; -}; - -/** - * Record average latencies, report on destruction. - * - * For debugging only, use via macros below so it can be compiled out - * of production code. - */ -class LatencyMetric { - public: - /** msg should be a string literal. */ - LatencyMetric(const char* msg, int64_t skip_=0); - ~LatencyMetric(); - - void record(const LatencyMetricTimestamp& start); - - private: - void report(); - const char* message; - int64_t count, total, skipped, skip; -}; - -}} // namespace qpid::sys - -#define QPID_LATENCY_INIT(x) ::qpid::sys::LatencyMetricTimestamp::initialize(x) -#define QPID_LATENCY_CLEAR(x) ::qpid::sys::LatencyMetricTimestamp::clear(x) -#define QPID_LATENCY_RECORD(msg, x) do { \ - static ::qpid::sys::LatencyMetric metric__(msg); metric__.record(x); \ - } while (false) -#define QPID_LATENCY_RECORD_SKIP(msg, x, skip) do { \ - static ::qpid::sys::LatencyMetric metric__(msg, skip); metric__.record(x); \ - } while (false) - - -#else /* defined QPID_LATENCY_METRIC */ - -namespace qpid { namespace sys { -class LatencyMetricTimestamp {}; -}} - -#define QPID_LATENCY_INIT(x) (void)x -#define QPID_LATENCY_CLEAR(x) (void)x -#define QPID_LATENCY_RECORD(msg, x) (void)x -#define QPID_LATENCY_RECORD_SKIP(msg, x, skip) (void)x - -#endif /* defined QPID_LATENCY_METRIC */ - -#endif /*!QPID_SYS_LATENCYMETRIC_H*/ |