From 96e9893c318cf06297b290e3c9f21fa5eb7efb7c Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Thu, 24 May 2012 04:14:53 +0000 Subject: NO-JIRA: Rearrange memory status code Currently only Linux has a useful implementation and everyone else uses a null implementation. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1342137 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/CMakeLists.txt | 14 +++++++++++--- qpid/cpp/src/qpid/sys/MemStat.cpp | 31 +++++++++++++++++++++++++++++++ qpid/cpp/src/qpid/sys/posix/MemStat.cpp | 2 +- qpid/cpp/src/qpid/sys/windows/MemStat.cpp | 29 ----------------------------- 4 files changed, 43 insertions(+), 33 deletions(-) create mode 100644 qpid/cpp/src/qpid/sys/MemStat.cpp delete mode 100644 qpid/cpp/src/qpid/sys/windows/MemStat.cpp (limited to 'qpid/cpp/src') diff --git a/qpid/cpp/src/CMakeLists.txt b/qpid/cpp/src/CMakeLists.txt index 21a96fcb14..7e318bce73 100644 --- a/qpid/cpp/src/CMakeLists.txt +++ b/qpid/cpp/src/CMakeLists.txt @@ -676,6 +676,11 @@ include (ssl.cmake) # Check for syslog capabilities not present on all systems check_symbol_exists (LOG_AUTHPRIV "sys/syslog.h" HAVE_LOG_AUTHPRIV) check_symbol_exists (LOG_FTP "sys/syslog.h" HAVE_LOG_FTP) + +# Set default Memory Status module (Null implementation) +set (qpid_memstat_module + qpid/sys/MemStat.cpp +) # Allow MSVC user to select 'WinXP-SP3/Windows Server 2003' as build target version set (win32_winnt_default OFF) @@ -738,7 +743,6 @@ if (CMAKE_SYSTEM_NAME STREQUAL Windows) qpid/sys/windows/SystemInfo.cpp qpid/sys/windows/Thread.cpp qpid/sys/windows/Time.cpp - qpid/sys/windows/MemStat.cpp qpid/client/windows/SaslFactory.cpp ${sslcommon_windows_SOURCES} ) @@ -795,6 +799,10 @@ else (CMAKE_SYSTEM_NAME STREQUAL Windows) if (CMAKE_COMPILER_IS_GNUCXX) set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GCC_CATCH_UNDEFINED} -pthread") endif (CMAKE_COMPILER_IS_GNUCXX) + # On Linux override memory status module + set (qpid_memstat_module + qpid/sys/posix/MemStat.cpp + ) endif (CMAKE_SYSTEM_NAME STREQUAL Linux) if (CMAKE_SYSTEM_NAME STREQUAL SunOS) @@ -802,7 +810,7 @@ else (CMAKE_SYSTEM_NAME STREQUAL Windows) set (qpid_system_module qpid/sys/solaris/SystemInfo.cpp ) -# On Sun we want -lpthread -lthread as the 2nd last and last libs passed to linker + # On Sun we want -lpthread -lthread as the 2nd last and last libs passed to linker set (qpidtypes_platform_LIBS ${qpidtypes_platform_LIBS} pthread thread @@ -821,7 +829,6 @@ else (CMAKE_SYSTEM_NAME STREQUAL Windows) qpid/sys/posix/FileSysDir.cpp qpid/sys/posix/IOHandle.cpp qpid/sys/posix/LockFile.cpp - qpid/sys/posix/MemStat.cpp qpid/sys/posix/Mutex.cpp qpid/sys/posix/PipeHandle.cpp qpid/sys/posix/PollableCondition.cpp @@ -924,6 +931,7 @@ set (qpidcommon_SOURCES qpid/sys/Timer.cpp qpid/sys/TimerWarnings.cpp qpid/amqp_0_10/Codecs.cpp + ${qpid_memstat_module} ) add_msvc_version (qpidcommon library dll) diff --git a/qpid/cpp/src/qpid/sys/MemStat.cpp b/qpid/cpp/src/qpid/sys/MemStat.cpp new file mode 100644 index 0000000000..c71fba785c --- /dev/null +++ b/qpid/cpp/src/qpid/sys/MemStat.cpp @@ -0,0 +1,31 @@ +/* + * + * 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 "qpid/sys/MemStat.h" + +// Null memory stats provider: +// This is for platforms that do not have a way to get allocated +// memory status +void qpid::sys::MemStat::loadMemInfo(qmf::org::apache::qpid::broker::Memory*) +{ +} + + diff --git a/qpid/cpp/src/qpid/sys/posix/MemStat.cpp b/qpid/cpp/src/qpid/sys/posix/MemStat.cpp index 72c53e5886..2fbf119cab 100644 --- a/qpid/cpp/src/qpid/sys/posix/MemStat.cpp +++ b/qpid/cpp/src/qpid/sys/posix/MemStat.cpp @@ -20,6 +20,7 @@ */ #include "qpid/sys/MemStat.h" + #include void qpid::sys::MemStat::loadMemInfo(qmf::org::apache::qpid::broker::Memory* object) @@ -35,4 +36,3 @@ void qpid::sys::MemStat::loadMemInfo(qmf::org::apache::qpid::broker::Memory* obj object->set_malloc_keepcost(info.keepcost); } - diff --git a/qpid/cpp/src/qpid/sys/windows/MemStat.cpp b/qpid/cpp/src/qpid/sys/windows/MemStat.cpp deleted file mode 100644 index b1d25c5fc5..0000000000 --- a/qpid/cpp/src/qpid/sys/windows/MemStat.cpp +++ /dev/null @@ -1,29 +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. - * - */ - -#include "qpid/sys/MemStat.h" - -void qpid::sys::MemStat::loadMemInfo(qmf::org::apache::qpid::broker::Memory*) -{ - // TODO: Add Windows-specific memory stats to the object and load them here. -} - - -- cgit v1.2.1