bool CSeqConversionDefault::ToValue(std::string_view sv) { m_bReady = false; if (sv == "$$") { m_bHex = true; return true; } if (auto nextTerm = GetNextTerm(sv)) { m_iTargetValue = m_iCurrentValue = *nextTerm; m_iRepeat = m_iValueDiv = 1; if (!sv.empty() && sv.front() == ':') { if (sv.remove_prefix(1), !sv.empty()) { if (auto divTerm = GetNextInteger(sv)) { m_iValueDiv = *divTerm; if (m_iValueDiv <= 0) return false; if (!sv.empty() && sv.front() == ':') { if (sv.remove_prefix(1), sv.empty()) return false; if (auto target = GetNextTerm(sv)) m_iTargetValue = *target; else return false; } } else return false; } else return false; } if (!sv.empty() && sv.front() == '\'') { if (sv.remove_prefix(1), !sv.empty()) { if (auto repTerm = GetNextInteger(sv)) { m_iRepeat = *repTerm; if (m_iRepeat <= 0) return false; } } else return false; } if (sv.empty()) { m_iValueInc = m_iTargetValue - m_iCurrentValue; m_iRepeatCounter = m_iCounter = m_iValueMod = 0; return m_bReady = true; } } return false; }
BOOL StringReaderHelper::GetNextBOOL(BOOL& value) { INT val = 0; if (GetNextInteger(val) == FALSE) return FALSE; value = (val != 0); return TRUE; }
// Function for parsing user provided input file. // Users must adhere to input file structure provided // in the sample input file to insure correct parsing void BenchParams::ParseParamFile(std::string fileStr) { inputFile = fileStr; std::string lineStr; std::ifstream inFile(inputFile.c_str()); if (inFile.fail()) { SetDefault(); return; } useDefaultParams = false; // Benchmark Parameters runTag = GetNextString(inFile); // runTag devPropFile = runTag + "_device_info.out"; topoFile = runTag + "_topology.out"; // All Tests runAllDevices = GetNextBool(inFile); // runAllDevices testAllMemTypes = GetNextBool(inFile); // testAllMemTypes runBurstTests = GetNextBool(inFile); // runBurstTests runRangeTests = GetNextBool(inFile); // runRangeTests runSustainedTests = GetNextBool(inFile); // runSustainedTests runSocketTests = GetNextBool(inFile); // runSocketTests runPatternTests = GetNextBool(inFile); // runPatternTests numPatterns = (runPatternTests ? NUM_ACCESS_PATTERNS: 1); numStepRepeats = (long) GetNextInteger(inFile); // numStepRepeats numRangeSteps = (long) GetNextInteger(inFile); // numRangeSteps burstBlockSize = GetNextInteger(inFile); // burstBlockSize // Memory Overhead Test runMemoryOverheadTest = GetNextBool(inFile); // runMemoryOverheadTest for (int i = 0; i < 2; i++) // rangeMemOverhead rangeMemOH[i] = GetNextInteger(inFile); // Host-Host Bandwidth Test runBandwidthTestHH = GetNextBool(inFile); // runHHBandwidthTest for (int i = 0; i < 2; i++) // rangeHostHostBW rangeHHBW[i] = GetNextInteger(inFile); // Host-Device Bandwidth Test runBandwidthTestHD = GetNextBool(inFile); // runHDBandwidthTest for (int i = 0; i < 2; i++) // rangeHostDeviceBW rangeHDBW[i] = GetNextInteger(inFile); // P2P Bandwidth Test runBandwidthTestP2P = GetNextBool(inFile); // runP2PBandwidthTest for (int i = 0; i < 2; i++) // rangeDeviceP2P rangeP2PBW[i] = GetNextInteger(inFile); // NURMA Test runNURMATest = GetNextBool(inFile); // runNURMATest gapNURMA = GetNextInteger(inFile); // gapNURMA blockSizeNURMA = GetNextInteger(inFile); // blockSizeNURMA for (int i = 0; i < 2; i++) // rangeNURMA rangeNURMA[i] = GetNextInteger(inFile); // Memory System Contention Test runContentionTest = GetNextBool(inFile); // runContentionTest numContRepeats = GetNextInteger(inFile); // numContRepeats for (int i = 0; i < 3; i++) // rangeCont contBlockSize[i] = GetNextInteger(inFile); }
BOOL StringReaderHelper::GetNextInteger(INT& value, INT minValue, INT maxValue) { if (GetNextInteger(value)) return value >= minValue && value <= maxValue; return FALSE; }