From c441c6f2f5ec31a624c56fd7b64e0b438026e93f Mon Sep 17 00:00:00 2001 From: Kim van der Riet Date: Tue, 19 Dec 2006 20:54:22 +0000 Subject: [For Andrew Stitcher] inlined qpid::sys::check() in APRBase.h; This is called a lot - for every call to an APR call, inlining this seems to give about 8% speed in my tests (even though originally check() only seemed to use 1-2% of the time). I think this must be a 2nd order instruction caching effect. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@488808 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/lib/common/sys/apr/APRBase.cpp | 10 ---------- cpp/lib/common/sys/apr/APRBase.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/cpp/lib/common/sys/apr/APRBase.cpp b/cpp/lib/common/sys/apr/APRBase.cpp index 30c84e8736..861071499f 100644 --- a/cpp/lib/common/sys/apr/APRBase.cpp +++ b/cpp/lib/common/sys/apr/APRBase.cpp @@ -82,16 +82,6 @@ void APRBase::decrement(){ getInstance()->_decrement(); } -void qpid::sys::check(apr_status_t status, const char* file, const int line){ - if (status != APR_SUCCESS){ - const int size = 50; - char tmp[size]; - std::string msg(apr_strerror(status, tmp, size)); - throw QpidError(APR_ERROR + ((int) status), msg, - qpid::SrcLine(file, line)); - } -} - std::string qpid::sys::get_desc(apr_status_t status){ const int size = 50; char tmp[size]; diff --git a/cpp/lib/common/sys/apr/APRBase.h b/cpp/lib/common/sys/apr/APRBase.h index 9beba9fbad..6a866a554a 100644 --- a/cpp/lib/common/sys/apr/APRBase.h +++ b/cpp/lib/common/sys/apr/APRBase.h @@ -24,6 +24,7 @@ #include #include #include +#include namespace qpid { namespace sys { @@ -60,6 +61,17 @@ namespace sys { } } +// Inlined as it is called *a lot* +void inline qpid::sys::check(apr_status_t status, const char* file, const int line){ + if (status != APR_SUCCESS){ + const int size = 50; + char tmp[size]; + std::string msg(apr_strerror(status, tmp, size)); + throw qpid::QpidError(APR_ERROR + ((int) status), msg, + qpid::SrcLine(file, line)); + } +} + -- cgit v1.2.1