@Override protected final void closeProcessStats() { if (PureJavaMode.osStatsAreAvailable()) { if (!osStatsDisabled()) { if (this.processStats != null) { this.processStats.close(); } HostStatHelper.closeOSStats(); } } }
@Override protected final long getSpecialStatsId() { long statId = OSProcess.getId(); if (statId == 0 || statId == -1) { statId = getStatisticsManager().getId(); } return statId; }
public double[] getRawSnapshots() { int startIdx = getStartIdx(); int endIdx = getEndIdx(startIdx); int resultSize=(endIdx-startIdx) + 1; return series.getValuesEx(descriptor.getTypeCode(), startIdx, resultSize); }
/** * Called when this sampler has spent some time working and wants * it to be accounted for. */ private void accountForTimeSpentWorking(long nanosSpentWorking, long nanosSpentSleeping) { this.samplerStats.tookSample( nanosSpentWorking, getStatisticsManager().getStatisticsCount(), nanosSpentSleeping); }
static void readyRefreshOSStats() { if(isLinux()) { LinuxProcFsStatistics.readyRefresh(); } else { HostStatHelper.readyRefresh(); } }
/** * Initialize any special sampler stats */ private synchronized void initSpecialStats() { // add a vm resource long id = getSpecialStatsId(); this.vmStats = VMStatsContractFactory.create(getStatisticsManager(), id); initProcessStats(id); }
protected void makeInactive() { this.active = false; lastTSidx = archive.getTimeStamps().getSize() - 1; close(); // this frees up unused memory now that no more samples } /**
protected void addTimeStamp() { if (this.loaded) { if (firstTSidx == -1) { firstTSidx = archive.getTimeStamps().getSize() - 1; } for (int i=0; i < values.length; i++) { if (values[i] != null) { values[i].addSample(); } } } }
private static boolean testOneInterface(InetAddress addr, int port) { Keeper k = keepOneInterface(addr, port); if (k != null) { k.release(); return true; } else { return false; } } private static Keeper keepOneInterface(InetAddress addr, int port) {
/** * Returns a unique id for the sampler's system. */ @Override public final long getSystemId() { return getStatisticsManager().getId(); }
private int getMemoryUsed() { int result = 0; StatArchiveReader.StatArchiveFile[] archives = getArchives(); for (int i=0; i < archives.length; i++) { StatArchiveFile f = archives[i]; result += f.getMemoryUsed(); } return result; }
private void dump(PrintWriter stream) { StatArchiveReader.StatArchiveFile[] archives = getArchives(); for (int i=0; i < archives.length; i++) { StatArchiveFile f = archives[i]; f.dump(stream); } }
@Override public Statistics createAtomicStatistics(StatisticsType type, String textId, long numericId) { if (this.statsDisabled) { return new DummyStatisticsImpl(type, textId, numericId); } return super.createAtomicStatistics(type, textId, numericId); } }
public StatisticsType createType(String name, String description, StatisticDescriptor[] stats) { return addType(new StatisticsTypeImpl(name, description, stats)); } public StatisticsType findType(String name) {
@Override protected final void closeProcessStats() { if (PureJavaMode.osStatsAreAvailable()) { if (!osStatsDisabled()) { if (this.processStats != null) { this.processStats.close(); } HostStatHelper.closeOSStats(); } } }
@Override protected final long getSpecialStatsId() { long statId = OSProcess.getId(); if (statId == 0 || statId == -1) { statId = getStatisticsManager().getId(); } return statId; }
private int getMemoryUsed() { int result = 0; StatArchiveReader.StatArchiveFile[] archives = getArchives(); for (int i=0; i < archives.length; i++) { StatArchiveFile f = archives[i]; result += f.getMemoryUsed(); } return result; }