diff options
author | Kim van der Riet <kpvdr@apache.org> | 2006-12-19 20:54:22 +0000 |
---|---|---|
committer | Kim van der Riet <kpvdr@apache.org> | 2006-12-19 20:54:22 +0000 |
commit | c441c6f2f5ec31a624c56fd7b64e0b438026e93f (patch) | |
tree | 4b0936f6c4053406ac18bad0d1397cd68b76b8c7 | |
parent | 956a3ea3f5ea2524e4767ad3b190cacdf5dbb684 (diff) | |
download | qpid-python-c441c6f2f5ec31a624c56fd7b64e0b438026e93f.tar.gz |
[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
-rw-r--r-- | cpp/lib/common/sys/apr/APRBase.cpp | 10 | ||||
-rw-r--r-- | 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 <string> #include <apr_thread_mutex.h> #include <apr_errno.h> +#include <QpidError.h> 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)); + } +} + |