in src/main/kotlin/com/github/mkartashev/hserr/miner/artifact/Memory.kt [28:46]
override fun extract(log: HsErrLog): ProcessMemoryArtifact {
val memUsageSelection = log.start
.moveToLineStartsWithString("Process memory usage:").selectUpToFirstEmptyLine()
if (memUsageSelection.isEmpty()) fail("Couldn't find process memory usage information")
val rssString = memUsageSelection.start.moveToLineWith("Resident Set Size:")
.moveToLastStringInLine("Resident Set Size:", false)
.moveToNextWord().selectCurrentWord().toString()
val rss = parseMemorySize(rssString) ?: fail("Couldn't the RSS value")
val locations = mutableSetOf(memUsageSelection)
val procMemorySelection = log.start
.moveToLineStartsWithString("Process Memory:")
.selectUpToFirstEmptyLine()
if (!procMemorySelection.isEmpty()) locations.add(procMemorySelection)
return ProcessMemoryArtifact(log, locations, rss)
}