diff options
author | Tor Brede Vekterli <vekterli@yahoo-inc.com> | 2017-12-04 11:31:29 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@yahoo-inc.com> | 2017-12-04 13:06:46 +0000 |
commit | 952a877611d657cfa0166b14699c8731b18f7587 (patch) | |
tree | c1b4330b9dc512c3ffbf845e626857ddcd801982 /storageframework/src/tests | |
parent | d164fbb93e277ef23ab610320a7cf8556e3c036e (diff) |
Remove memory manager component from content layer
We already have resource utilization tracking in both MessageBus
and the search core. The memory manager has never been auto-scaled
based on the hardware present and adds a _lot_ of complexity without
having any known instances where it has actually saved the day.
Removing it also removes a mutex on the message hot path.
If we need such functionality in the future, should design a lock-free
solution.
Cleanup
Diffstat (limited to 'storageframework/src/tests')
-rw-r--r-- | storageframework/src/tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | storageframework/src/tests/memory/.gitignore | 2 | ||||
-rw-r--r-- | storageframework/src/tests/memory/CMakeLists.txt | 8 | ||||
-rw-r--r-- | storageframework/src/tests/memory/memorymanagertest.cpp | 397 | ||||
-rw-r--r-- | storageframework/src/tests/memory/memorystatetest.cpp | 172 |
5 files changed, 0 insertions, 580 deletions
diff --git a/storageframework/src/tests/CMakeLists.txt b/storageframework/src/tests/CMakeLists.txt index eb6d45330e8..0d604d64f74 100644 --- a/storageframework/src/tests/CMakeLists.txt +++ b/storageframework/src/tests/CMakeLists.txt @@ -5,7 +5,6 @@ vespa_add_executable(storageframework_testrunner_app TEST DEPENDS storageframework_testclock storageframework_teststatus - storageframework_testmemory storageframework_testthread ) diff --git a/storageframework/src/tests/memory/.gitignore b/storageframework/src/tests/memory/.gitignore deleted file mode 100644 index 7e7c0fe7fae..00000000000 --- a/storageframework/src/tests/memory/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/.depend -/Makefile diff --git a/storageframework/src/tests/memory/CMakeLists.txt b/storageframework/src/tests/memory/CMakeLists.txt deleted file mode 100644 index 591a78f1046..00000000000 --- a/storageframework/src/tests/memory/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_library(storageframework_testmemory - SOURCES - memorymanagertest.cpp - memorystatetest.cpp - DEPENDS - storageframework -) diff --git a/storageframework/src/tests/memory/memorymanagertest.cpp b/storageframework/src/tests/memory/memorymanagertest.cpp deleted file mode 100644 index 5424b8dea82..00000000000 --- a/storageframework/src/tests/memory/memorymanagertest.cpp +++ /dev/null @@ -1,397 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include <vespa/storageframework/defaultimplementation/clock/realclock.h> -#include <vespa/storageframework/defaultimplementation/memory/memorymanager.h> -#include <vespa/storageframework/defaultimplementation/memory/simplememorylogic.h> -#include <vespa/storageframework/defaultimplementation/memory/prioritymemorylogic.h> -#include <vespa/vdstestlib/cppunit/macros.h> -#include <vespa/vespalib/util/document_runnable.h> -#include <vespa/vespalib/util/random.h> - -namespace storage { -namespace framework { -namespace defaultimplementation { - -struct MemoryManagerTest : public CppUnit::TestFixture -{ - void testBasics(); - void testCacheAllocation(); - void testStress(); - - CPPUNIT_TEST_SUITE(MemoryManagerTest); - CPPUNIT_TEST(testBasics); - CPPUNIT_TEST(testCacheAllocation); - CPPUNIT_TEST(testStress); - CPPUNIT_TEST_SUITE_END(); -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(MemoryManagerTest); - -void -MemoryManagerTest::testBasics() -{ - uint64_t maxMemory = 1000; - RealClock clock; - SimpleMemoryLogic* logic = new SimpleMemoryLogic(clock, maxMemory); - AllocationLogic::UP allLogic(std::move(logic)); - MemoryManager manager(std::move(allLogic)); - - const MemoryAllocationType& putAlloc(manager.registerAllocationType( - MemoryAllocationType("put", MemoryAllocationType::EXTERNAL_LOAD))); - const MemoryAllocationType& getAlloc(manager.registerAllocationType( - MemoryAllocationType("get", MemoryAllocationType::EXTERNAL_LOAD))); - const MemoryAllocationType& bufAlloc(manager.registerAllocationType( - MemoryAllocationType("buffer"))); - const MemoryAllocationType& cacheAlloc(manager.registerAllocationType( - MemoryAllocationType("cache", MemoryAllocationType::CACHE))); - const MemoryState& state(logic->getState()); - const MemoryState::SnapShot& current(state.getCurrentSnapshot()); - // Basics - { - // * Getting a token, and release it back with correct behavior - framework::MemoryToken::UP put = manager.allocate(putAlloc, - 0, 100, 80); - CPPUNIT_ASSERT(put.get() != 0); - CPPUNIT_ASSERT_EQUAL(uint64_t(100), put->getSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(100), current.getUsedSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(900), state.getFreeSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(1000), state.getTotalSize()); - - // * Do the same while not being empty. Different type. - framework::MemoryToken::UP get = manager.allocate(getAlloc, - 30, 200, 50); - CPPUNIT_ASSERT(get.get() != 0); - CPPUNIT_ASSERT_EQUAL(uint64_t(200), get->getSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(300), current.getUsedSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(700), state.getFreeSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(1000), state.getTotalSize()); - - // * Do the same while not being empty. Same type. - framework::MemoryToken::UP get2 = manager.allocate( - getAlloc, - 70, - 150, - 60); - - CPPUNIT_ASSERT(get2.get() != 0); - CPPUNIT_ASSERT_EQUAL(uint64_t(150), get2->getSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(450), current.getUsedSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(550), state.getFreeSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(1000), state.getTotalSize()); - } - CPPUNIT_ASSERT_EQUAL(uint64_t(0), current.getUsedSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(0), current.getUserCount()); - - // Non-external load - // * Getting minimum when going beyond 80% full - { - framework::MemoryToken::UP filler = manager.allocate(putAlloc, - 795, 795, 90); - framework::MemoryToken::UP resize = manager.allocate( - bufAlloc, 10, 90, 80); - CPPUNIT_ASSERT(resize.get() != 0); - CPPUNIT_ASSERT_EQUAL(uint64_t(10), resize->getSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(805), current.getUsedSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(195), state.getFreeSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(1000), state.getTotalSize()); - } - CPPUNIT_ASSERT_EQUAL(uint64_t(0), current.getUsedSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(0), current.getUserCount()); - - // Non-external load - // * Getting up to threshold if hitting it - { - framework::MemoryToken::UP filler = manager.allocate(putAlloc, - 750, 750, 90); - framework::MemoryToken::UP resize = manager.allocate( - bufAlloc, 10, 90, 80); - CPPUNIT_ASSERT(resize.get() != 0); - CPPUNIT_ASSERT_EQUAL(uint64_t(50), resize->getSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(800), current.getUsedSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(200), state.getFreeSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(1000), state.getTotalSize()); - } - CPPUNIT_ASSERT_EQUAL(uint64_t(0), current.getUsedSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(0), current.getUserCount()); - - // External load - { - // * Stopped when going beyond 80% full - framework::MemoryToken::UP filler = manager.allocate(putAlloc, - 795, 795, 90); - framework::MemoryToken::UP put = manager.allocate(putAlloc, - 10, 100, 80); - CPPUNIT_ASSERT(put.get() == 0); - CPPUNIT_ASSERT_EQUAL(uint64_t(795), current.getUsedSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(205), state.getFreeSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(1000), state.getTotalSize()); - } - CPPUNIT_ASSERT_EQUAL(uint64_t(0), current.getUsedSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(0), current.getUserCount()); - - // External load - { - // * Getting up to threshold if hitting it - framework::MemoryToken::UP filler = manager.allocate(putAlloc, - 750, 750, 90); - framework::MemoryToken::UP put = manager.allocate(putAlloc, - 10, 100, 80); - CPPUNIT_ASSERT(put.get() != 0); - CPPUNIT_ASSERT_EQUAL(uint64_t(50), put->getSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(800), current.getUsedSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(200), state.getFreeSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(1000), state.getTotalSize()); - } - CPPUNIT_ASSERT_EQUAL(uint64_t(0), current.getUsedSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(0), current.getUserCount()); - - // Test caching.. - { - // Cache paradigm: - // Allocate a token taking up no space at all. - // Give it to your ReduceMemoryUsageInterface implementation. - // Run resize on your token in that implementation to get memory and - // return memory. That way locking should be easy when needed. - struct ReduceI : public framework::ReduceMemoryUsageInterface { - framework::MemoryToken::UP _token; - - uint64_t reduceMemoryConsumption(const MemoryToken& token, uint64_t reduceBy) override { - assert(&token == _token.get()); - (void) &token; - assert(_token->getSize() >= reduceBy); - return reduceBy; - } - }; - ReduceI reducer; - framework::MemoryToken::UP cache = manager.allocate(cacheAlloc, - 0, 0, 0, &reducer); - CPPUNIT_ASSERT(cache.get() != 0); - CPPUNIT_ASSERT_EQUAL(uint64_t(0), cache->getSize()); - reducer._token = std::move(cache); - for (uint32_t i=1; i<=50; ++i) { - bool success = reducer._token->resize(i * 10, i * 10); - CPPUNIT_ASSERT_EQUAL(true, success); - } - CPPUNIT_ASSERT_EQUAL(uint64_t(500), reducer._token->getSize()); - - // * Ordered to free space - framework::MemoryToken::UP put = manager.allocate(putAlloc, - 600, 600, 80); - CPPUNIT_ASSERT_EQUAL_MSG(manager.toString(), - uint64_t(400), reducer._token->getSize()); - CPPUNIT_ASSERT_EQUAL_MSG(manager.toString(), - uint64_t(600), put->getSize()); - } - CPPUNIT_ASSERT_EQUAL_MSG(state.toString(true), - uint64_t(0), current.getUsedSize()); - CPPUNIT_ASSERT_EQUAL_MSG(state.toString(true), - uint64_t(0), current.getUserCount()); - - // Test merge and tracking of allocation counts with merge, by doing - // operations with tokens and see that user count and used size - // correctly go back to zero. - { - framework::MemoryToken::UP tok1( - manager.allocate(putAlloc, 5, 5, 40)); - framework::MemoryToken::UP tok2( - manager.allocate(putAlloc, 10, 10, 40)); - framework::MemoryToken::UP tok3( - manager.allocate(putAlloc, 20, 20, 40)); - framework::MemoryToken::UP tok4( - manager.allocate(putAlloc, 40, 40, 40)); - framework::MemoryToken::UP tok5( - manager.allocate(putAlloc, 80, 80, 40)); - framework::MemoryToken::UP tok6( - manager.allocate(putAlloc, 1, 1, 40)); - framework::MemoryToken::UP tok7( - manager.allocate(putAlloc, 3, 3, 40)); - } -} - -void -MemoryManagerTest::testCacheAllocation() -{ - uint64_t maxMemory = 3000; - - RealClock clock; - SimpleMemoryLogic::UP logic(new PriorityMemoryLogic(clock, maxMemory)); - logic->setCacheThreshold(1.0); - - AllocationLogic::UP allLogic(std::move(logic)); - MemoryManager manager(std::move(allLogic)); - - const MemoryAllocationType& putAlloc(manager.registerAllocationType( - MemoryAllocationType("put", MemoryAllocationType::EXTERNAL_LOAD))); - const MemoryAllocationType& cacheAlloc(manager.registerAllocationType( - MemoryAllocationType("cache", MemoryAllocationType::CACHE))); - - framework::MemoryToken::UP token = - manager.allocate(putAlloc, - 50, - 50, - 127); - - CPPUNIT_ASSERT_EQUAL(50, (int)token->getSize()); - - framework::MemoryToken::UP token2 = - manager.allocate(cacheAlloc, - 1000, - 2000, - 127); - - CPPUNIT_ASSERT_EQUAL(2000, (int)token2->getSize()); - - token2->resize(2000, 3000); - - CPPUNIT_ASSERT_EQUAL(2950, (int)token2->getSize()); -} - -namespace { -struct MemoryManagerLoadGiver : public document::Runnable, - public ReduceMemoryUsageInterface -{ - MemoryManager& _manager; - const framework::MemoryAllocationType& _type; - uint8_t _priority; - uint32_t _minMem; - uint32_t _maxMem; - uint32_t _failed; - uint32_t _ok; - uint32_t _reduced; - using MemoryTokenUP = std::unique_ptr<MemoryToken>; - std::vector<MemoryTokenUP> _tokens; - vespalib::Lock _cacheLock; - - MemoryManagerLoadGiver( - MemoryManager& manager, - const framework::MemoryAllocationType& type, - uint8_t priority, - uint32_t minMem, - uint32_t maxMem, - uint32_t tokensToKeep) - : _manager(manager), - _type(type), - _priority(priority), - _minMem(minMem), - _maxMem(maxMem), - _failed(0), - _ok(0), - _reduced(0), - _tokens(tokensToKeep) - { - } - - uint64_t reduceMemoryConsumption(const MemoryToken&, uint64_t reduceBy) override { - ++_reduced; - return reduceBy; - } - - void run() override { - ReduceMemoryUsageInterface* reducer = 0; - if (_type.isCache()) reducer = this; - vespalib::RandomGen randomizer; - while (running()) { - vespalib::Lock lock(_cacheLock); - framework::MemoryToken::UP token = _manager.allocate( - _type, _minMem, _maxMem, _priority, reducer); - if (token.get() == 0) { - ++_failed; - } else { - ++_ok; - } - uint32_t index = randomizer.nextUint32(0, _tokens.size() - 1); - _tokens[index] = MemoryTokenUP(token.release()); - } - } -}; -} - -void -MemoryManagerTest::testStress() -{ - uint64_t stressTimeMS = 1 * 1000; - uint64_t maxMemory = 1 * 1024 * 1024; - RealClock clock; - AllocationLogic::UP logic(new PriorityMemoryLogic(clock, maxMemory)); - MemoryManager manager(std::move(logic)); - - FastOS_ThreadPool pool(128 * 1024); - std::vector<MemoryManagerLoadGiver*> loadGivers; - for (uint32_t type = 0; type < 5; ++type) { - const MemoryAllocationType* allocType = 0; - uint32_t min = 1000, max = 5000; - if (type == 0) { - allocType = &manager.registerAllocationType(MemoryAllocationType( - "default")); - } else if (type == 1) { - allocType = &manager.registerAllocationType(MemoryAllocationType( - "external", MemoryAllocationType::EXTERNAL_LOAD)); - } else if (type == 2) { - allocType = &manager.registerAllocationType(MemoryAllocationType( - "forced", MemoryAllocationType::FORCE_ALLOCATE)); - } else if (type == 3) { - allocType = &manager.registerAllocationType(MemoryAllocationType( - "forcedExternal", MemoryAllocationType::FORCE_ALLOCATE - | MemoryAllocationType::EXTERNAL_LOAD)); - } else if (type == 4) { - allocType = &manager.registerAllocationType(MemoryAllocationType( - "cache", MemoryAllocationType::CACHE)); - max = 30000; - } - for (int priority = 0; priority < 256; priority += 8) { - loadGivers.push_back(new MemoryManagerLoadGiver( - manager, *allocType, priority, min, max, 10)); - loadGivers.back()->start(pool); - } - FastOS_Thread::Sleep(stressTimeMS); - } - FastOS_Thread::Sleep(5 * stressTimeMS); - uint64_t okTotal = 0, failedTotal = 0, reducedTotal = 0; - for (uint32_t i = 0; i < loadGivers.size(); i++) { - /* - fprintf(stderr, "%d %s-%u: Failed %d, ok %d, reduced %d\n", - i, loadGivers[i]->_type.getName().c_str(), - uint32_t(loadGivers[i]->_priority), - loadGivers[i]->_failed, loadGivers[i]->_ok, - loadGivers[i]->_reduced); // */ - okTotal += loadGivers[i]->_ok; - failedTotal += loadGivers[i]->_failed; - reducedTotal += loadGivers[i]->_reduced; - } - for (uint32_t i = 0; i < loadGivers.size(); i++) loadGivers[i]->stop(); - for (uint32_t i = 0; i < loadGivers.size(); i++) loadGivers[i]->join(); - pool.Close(); - - /* - bool verbose = false; - std::cerr << "\n\nMemory allocations at end of load:\n"; - manager.print(std::cerr, verbose, ""); // */ - - for (uint32_t i = 0; i < loadGivers.size(); i++) { - loadGivers[i]->_tokens.clear(); - } - for (uint32_t i = 0; i < loadGivers.size(); i++) { - delete loadGivers[i]; - } - loadGivers.clear(); - - //std::cerr << "\n\nMemory allocations at end of testl:\n"; - //manager.print(std::cerr, verbose, ""); - - std::cerr << "\n Managed " << std::fixed - << (okTotal / (stressTimeMS / 1000)) - << " ok, " << (failedTotal / (stressTimeMS / 1000)) - << " failed and " << (reducedTotal / (stressTimeMS / 1000)) - << " reduced allocations/s.\n "; - - MemoryState state(clock, 1); - manager.getState(state); - const MemoryState::SnapShot& current(state.getCurrentSnapshot()); - CPPUNIT_ASSERT_EQUAL(uint64_t(0), current.getUserCount()); - CPPUNIT_ASSERT_EQUAL(uint64_t(0), current.getUsedSize()); - CPPUNIT_ASSERT_EQUAL(uint64_t(0), current.getUsedSizeIgnoringCache()); -} - -} // defaultimplementation -} // framework -} // storage diff --git a/storageframework/src/tests/memory/memorystatetest.cpp b/storageframework/src/tests/memory/memorystatetest.cpp deleted file mode 100644 index cd565718632..00000000000 --- a/storageframework/src/tests/memory/memorystatetest.cpp +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include <vespa/storageframework/defaultimplementation/clock/realclock.h> -#include <vespa/storageframework/defaultimplementation/memory/memorystate.h> -#include <vespa/vdstestlib/cppunit/macros.h> -#include <vespa/vespalib/util/exceptions.h> - -namespace storage { -namespace framework { -namespace defaultimplementation { - -struct MemoryStateTest : public CppUnit::TestFixture -{ - - void testBasics(); - - CPPUNIT_TEST_SUITE(MemoryStateTest); - CPPUNIT_TEST(testBasics); // Fails sometimes, test needs rewrite. - CPPUNIT_TEST_SUITE_END(); -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(MemoryStateTest); - -class SimpleMemoryManager : public framework::MemoryManagerInterface -{ -private: - std::map<std::string, framework::MemoryAllocationType> _types; - -public: - void setMaximumMemoryUsage(uint64_t max) override { (void) max; } - - const framework::MemoryAllocationType& - registerAllocationType(const framework::MemoryAllocationType& type) override { - _types[type.getName()] = type; - return _types[type.getName()]; - } - - const framework::MemoryAllocationType& - getAllocationType(const std::string& name) const override { - std::map<std::string, framework::MemoryAllocationType>::const_iterator iter = - _types.find(name); - - if (iter == _types.end()) { - throw vespalib::IllegalArgumentException("Allocation type not found: " + name); - } - - return iter->second; - } - - std::vector<const MemoryAllocationType*> getAllocationTypes() const override { - std::vector<const MemoryAllocationType*> types; - for(std::map<std::string, framework::MemoryAllocationType> - ::const_iterator it = _types.begin(); it != _types.end(); ++it) - { - types.push_back(&it->second); - } - return types; - } - - framework::MemoryToken::UP allocate(const framework::MemoryAllocationType&, - uint64_t, - uint64_t, - uint8_t, - framework::ReduceMemoryUsageInterface*) override - { - return framework::MemoryToken::UP(); - } - - uint64_t getMemorySizeFreeForPriority(uint8_t priority) const override { - (void) priority; - return 0; - } -}; - -void -MemoryStateTest::testBasics() -{ - SimpleMemoryManager manager; - - const MemoryAllocationType& putAlloc(manager.registerAllocationType( - MemoryAllocationType("MESSAGE_PUT", MemoryAllocationType::EXTERNAL_LOAD))); - const MemoryAllocationType& getAlloc(manager.registerAllocationType( - MemoryAllocationType("MESSAGE_GET", MemoryAllocationType::EXTERNAL_LOAD))); - const MemoryAllocationType& blockAlloc(manager.registerAllocationType( - MemoryAllocationType("MESSAGE_DOCBLOCK"))); - const MemoryAllocationType& databaseAlloc(manager.registerAllocationType( - MemoryAllocationType("DATABASE"))); - const MemoryAllocationType& cacheAlloc(manager.registerAllocationType( - MemoryAllocationType("SLOTFILE_CACHE", MemoryAllocationType::CACHE))); - - uint32_t maxMemory = 1024; - - RealClock clock; - MemoryState state1(clock, maxMemory); - MemoryState state2(clock, maxMemory); - - state1.setMinJumpToUpdateMax(50); - - state1.addToEntry(putAlloc, 100, 10, - MemoryState::GOT_MAX, false); - state1.addToEntry(putAlloc, 100, 60, - MemoryState::GOT_MAX, false); - state1.addToEntry(blockAlloc, - 200, 20, - MemoryState::GOT_MIN, false); - state1.addToEntry(getAlloc, 0, 15, - MemoryState::DENIED, false, 0); - state1.addToEntry(databaseAlloc, 150, 0, - MemoryState::DENIED, true, 1); - state1.addToEntry(cacheAlloc, 45, 0, - MemoryState::GOT_MAX, true, 1); - - state2.addToEntry(putAlloc, 50, 10, - MemoryState::GOT_MIN, false); - state2.addToEntry(putAlloc, 20, 40, - MemoryState::GOT_MIN, false); - - state1.removeFromEntry(databaseAlloc, 25, 0, 0); - state1.removeFromEntry(putAlloc, 100, 60); - - MemoryState::SnapShot state3; - state3 = state1.getMaxSnapshot(); - state3 += state2.getMaxSnapshot(); - - std::string expected; - expected = - "\n" - "MemoryState(Max memory: 1024) {\n" - " Current: SnapShot(Used 470, w/o cache 425) {\n" - " Type(Pri): Used(Size/Allocs) Stats(Allocs, Wanted, Min, Denied, Forced)\n" - " DATABASE(0): Used(125 B / 1) Stats(1, 0, 0, 1, 1)\n" - " MESSAGE_DOCBLOCK(20): Used(200 B / 1) Stats(1, 0, 1, 0, 0)\n" - " MESSAGE_GET(15): Used(0 B / 0) Stats(1, 0, 0, 1, 0)\n" - " MESSAGE_PUT(10): Used(100 B / 1) Stats(1, 1, 0, 0, 0)\n" - " MESSAGE_PUT(60): Used(0 B / 0) Stats(1, 1, 0, 0, 0)\n" - " SLOTFILE_CACHE(0): Used(45 B / 1) Stats(1, 1, 0, 0, 1)\n" - " }\n" - " Max: SnapShot(Used 550, w/o cache 550) {\n" - " Type(Pri): Used(Size/Allocs) Stats(Allocs, Wanted, Min, Denied, Forced)\n" - " DATABASE(0): Used(150 B / 1) Stats(1, 0, 0, 1, 1)\n" - " MESSAGE_DOCBLOCK(20): Used(200 B / 1) Stats(1, 0, 1, 0, 0)\n" - " MESSAGE_GET(15): Used(0 B / 0) Stats(1, 0, 0, 1, 0)\n" - " MESSAGE_PUT(10): Used(100 B / 1) Stats(1, 1, 0, 0, 0)\n" - " MESSAGE_PUT(60): Used(100 B / 1) Stats(1, 1, 0, 0, 0)\n" - " }\n" - "}"; - - CPPUNIT_ASSERT_EQUAL(expected, "\n" + state1.toString(true)); - expected = "\n" -"MemoryState(Max memory: 1024) {\n" -" Current: SnapShot(Used 70, w/o cache 70) {\n" -" Type(Pri): Used(Size/Allocs) Stats(Allocs, Wanted, Min, Denied, Forced)\n" -" MESSAGE_PUT(10): Used(50 B / 1) Stats(1, 0, 1, 0, 0)\n" -" MESSAGE_PUT(40): Used(20 B / 1) Stats(1, 0, 1, 0, 0)\n" -" }\n" -"}"; - CPPUNIT_ASSERT_EQUAL(expected, "\n" + state2.toString(true)); - expected = "\n" -"SnapShot(Used 550, w/o cache 550) {\n" -" Type(Pri): Used(Size/Allocs) Stats(Allocs, Wanted, Min, Denied, Forced)\n" -" DATABASE(0): Used(150 B / 1) Stats(1, 0, 0, 1, 1)\n" -" MESSAGE_DOCBLOCK(20): Used(200 B / 1) Stats(1, 0, 1, 0, 0)\n" -" MESSAGE_GET(15): Used(0 B / 0) Stats(1, 0, 0, 1, 0)\n" -" MESSAGE_PUT(10): Used(100 B / 1) Stats(1, 1, 0, 0, 0)\n" -" MESSAGE_PUT(60): Used(100 B / 1) Stats(1, 1, 0, 0, 0)\n" -"}"; - CPPUNIT_ASSERT_EQUAL(expected, "\n" + state3.toString(true)); -} - -} // defaultimplementation -} // framework -} // storage |