diff --git a/common/include/villas/memory.hpp b/common/include/villas/memory.hpp index 7bdd0d9a0..ef4b970c7 100644 --- a/common/include/villas/memory.hpp +++ b/common/include/villas/memory.hpp @@ -54,8 +54,8 @@ public: { return offset; } protected: - size_t offset; ///< Offset (or address) inside address space - size_t size; ///< Size in bytes of this block + size_t offset; ///< Offset (or address) inside address space + size_t size; ///< Size in bytes of this block MemoryManager::AddressSpaceId addrSpaceId; ///< Identifier in memory graph }; @@ -79,14 +79,17 @@ public: // take ownership of the MemoryBlock MemoryAccessor(std::unique_ptr mem) : translation(MemoryManager::get().getTranslationFromProcess(mem->getAddrSpaceId())), - memoryBlock(std::move(mem)) {} + memoryBlock(std::move(mem)) + {} // just act as an accessor, do not take ownership of MemoryBlock MemoryAccessor(const MemoryBlock& mem) : - translation(MemoryManager::get().getTranslationFromProcess(mem.getAddrSpaceId())) {} + translation(MemoryManager::get().getTranslationFromProcess(mem.getAddrSpaceId())) + {} MemoryAccessor(const MemoryTranslation& translation) : - translation(translation) {} + translation(translation) + {} T& operator*() const { return *reinterpret_cast(translation.getLocalAddr(0)); @@ -205,7 +208,6 @@ protected: MemoryManager::AddressSpaceId getAddrSpaceId() const { return memoryAddrSpaceId; } -protected: MemoryBlock::deallocator_fn free; Logger logger; @@ -257,7 +259,6 @@ private: size_t getAlignmentPadding(uintptr_t addr) const { return (alignBytes - (addr & alignMask)) & alignMask; } -private: size_t nextFreeAddress; ///< next chunk will be allocated here size_t memorySize; ///< total size of managed memory size_t internalOffset; ///< offset in address space (usually 0) @@ -294,20 +295,6 @@ private: class HostDmaRam { -private: - - static std::string - getUdmaBufName(int num); - - static std::string - getUdmaBufBasePath(int num); - - static size_t - getUdmaBufBufSize(int num); - - static uintptr_t - getUdmaBufPhysAddr(int num); - public: class HostDmaRamAllocator : public LinearAllocator { public: @@ -327,6 +314,18 @@ public: private: static std::map> allocators; + + static std::string + getUdmaBufName(int num); + + static std::string + getUdmaBufBasePath(int num); + + static size_t + getUdmaBufBufSize(int num); + + static uintptr_t + getUdmaBufPhysAddr(int num); }; } /* namespace villas */ diff --git a/common/include/villas/memory_manager.hpp b/common/include/villas/memory_manager.hpp index bb64a8095..520e1461f 100644 --- a/common/include/villas/memory_manager.hpp +++ b/common/include/villas/memory_manager.hpp @@ -179,7 +179,7 @@ public: static MemoryManager& get(); - MemoryGraph & getMemoryGraph() + MemoryGraph & getGraph() { return memoryGraph; } AddressSpaceId @@ -240,14 +240,6 @@ public: getMasterAddrSpaceName(const std::string& ipInstance, const std::string& busInterface) { return ipInstance + ":" + busInterface; } - void - dump() - { memoryGraph.dump(); } - - void - dumpToFile(const std::string& fileName) - { memoryGraph.dump(fileName); } - private: /// Convert a Mapping to MemoryTranslation for calculations static MemoryTranslation @@ -257,7 +249,6 @@ private: bool pathCheck(const MemoryGraph::Path& path); -private: /// Directed graph that stores address spaces and memory mappings MemoryGraph memoryGraph;