void SystemSettings::allocationTest() { auto module = InviwoApplication::getPtr()->getModuleByType<InviwoCore>(); if (!module) return; auto sysInfo = getTypeFromVector<SystemCapabilities>(module->getCapabilities()); if (sysInfo) { IntProperty* useRAMPercent = dynamic_cast<IntProperty*>(getPropertyByIdentifier("useRAMPercent")); glm::u64 memBytesAlloc = sysInfo->getAvailableMemory(); // In Bytes LogInfo("Maximum Available Memory is " << formatBytesToString(memBytesAlloc)); memBytesAlloc /= 100; // 1% of total available memory memBytesAlloc *= useRAMPercent->get(); //?% of total available memory try { allocTest_ = new glm::u32[static_cast<glm::u32>(memBytesAlloc / 4)]; LogInfo("Allocated " << formatBytesToString(memBytesAlloc) << ", which is " << useRAMPercent->get() << "% of available memory"); delete allocTest_; } catch (std::bad_alloc&) { LogError("Failed allocation of " << formatBytesToString(memBytesAlloc) << ", which is " << useRAMPercent->get() << "% of available memory"); } } }
void MPVMVolumeReader::printPVMMeta(Volume* volume, std::string filePath) { size3_t dim = volume->getDimensions(); size_t bytes = dim.x * dim.y * dim.z * (volume->getDataFormat()->getSize()); std::string size = formatBytesToString(bytes); LogInfo("Loaded volume: " << filePath << " size: " << size); printMetaInfo(volume, "description"); printMetaInfo(volume, "courtesy"); printMetaInfo(volume, "parameter"); printMetaInfo(volume, "comment"); }