@Test public void collectIO() throws IOException { doCollectFromFile("/io.txt", "read=2, written=36"); }
static void collectIO(RandomAccessFile procIO, StatisticsSink sink) { if (procIO == null) return; try { procIO.seek(0); String line; while ((line = procIO.readLine()) != null) { if (line.startsWith("read_bytes:")) { Matcher matcher = LinuxHelper.COUNT_PATTERN.matcher(line); if (matcher.find()) sink.addSize(PROCESS_VAR_READ, Long.parseLong(matcher.group(1))); continue; } if (line.startsWith("write_bytes:")) { Matcher matcher = LinuxHelper.COUNT_PATTERN.matcher(line); if (matcher.find()) sink.addSize(PROCESS_VAR_WRITTEN, Long.parseLong(matcher.group(1))); } } } catch (IOException ignored) { } }
ProcessStatistics extends AbstractStatistic { static void collectIO(RandomAccessFile procIO, StatisticsSink sink) { if (procIO == null) return; try { procIO.seek(0); String line; while ((line = procIO.readLine()) != null) { if (line.startsWith("read_bytes:")) { Matcher matcher = LinuxHelper.COUNT_PATTERN.matcher(line); if (matcher.find()) sink.addSize(PROCESS_VAR_READ, Long.parseLong(matcher.group(1))); continue; } if (line.startsWith("write_bytes:")) { Matcher matcher = LinuxHelper.COUNT_PATTERN.matcher(line); if (matcher.find()) sink.addSize(PROCESS_VAR_WRITTEN, Long.parseLong(matcher.group(1))); } } } catch (IOException ignored) { } } }
ProcessStatistics extends AbstractStatistic { static void collectIO(RandomAccessFile procIO, StatisticsSink sink) { if (procIO == null) return; try { procIO.seek(0); String line; while ((line = procIO.readLine()) != null) { if (line.startsWith("read_bytes:")) { Matcher matcher = LinuxHelper.COUNT_PATTERN.matcher(line); if (matcher.find()) sink.addSize(PROCESS_VAR_READ, Long.parseLong(matcher.group(1))); continue; } if (line.startsWith("write_bytes:")) { Matcher matcher = LinuxHelper.COUNT_PATTERN.matcher(line); if (matcher.find()) sink.addSize(PROCESS_VAR_WRITTEN, Long.parseLong(matcher.group(1))); } } } catch (IOException ignored) { } } ProcessStatistics(); }
ProcessStatistics extends AbstractStatistic { static void collectIO(RandomAccessFile procIO, StatisticsSink sink) { if (procIO == null) return; try { procIO.seek(0); String line; while ((line = procIO.readLine()) != null) { if (line.startsWith("read_bytes:")) { Matcher matcher = LinuxHelper.COUNT_PATTERN.matcher(line); if (matcher.find()) sink.addSize(PROCESS_VAR_READ, Long.parseLong(matcher.group(1))); continue; } if (line.startsWith("write_bytes:")) { Matcher matcher = LinuxHelper.COUNT_PATTERN.matcher(line); if (matcher.find()) sink.addSize(PROCESS_VAR_WRITTEN, Long.parseLong(matcher.group(1))); } } } catch (IOException ignored) { } } ProcessStatistics(); @Override void close(); }
ProcessStatistics extends AbstractStatistic { static void collectIO(RandomAccessFile procIO, StatisticsSink sink) { if (procIO == null) return; try { procIO.seek(0); String line; while ((line = procIO.readLine()) != null) { if (line.startsWith("read_bytes:")) { Matcher matcher = LinuxHelper.COUNT_PATTERN.matcher(line); if (matcher.find()) sink.addSize(PROCESS_VAR_READ, Long.parseLong(matcher.group(1))); continue; } if (line.startsWith("write_bytes:")) { Matcher matcher = LinuxHelper.COUNT_PATTERN.matcher(line); if (matcher.find()) sink.addSize(PROCESS_VAR_WRITTEN, Long.parseLong(matcher.group(1))); } } } catch (IOException ignored) { } } ProcessStatistics(); @Override void close();  }