protected void dump(PrintWriter stream) { calcStats(); stream.print(" " + descriptor.getName() + "="); stream.print("[size=" + getSnapshotsSize() + " min=" + nf.format(min) + " max=" + nf.format(max) + " avg=" + nf.format(avg) + " stddev=" + nf.format(stddev) + "]"); if (Boolean.getBoolean("StatArchiveReader.dumpall")) { series.dump(stream); } else { stream.println(); } }
protected void dump(PrintWriter stream) { stream.println(name + ":" + " file=" + getArchive().getFile() + " id=" + id + (active? "" : " deleted") + " start=" + archive.formatTimeMillis(getFirstTimeMillis())); for (int i=0; i < values.length; i++) { values[i].dump(stream); } }
void matchSpec(StatSpec spec, List matchedValues) { if (spec.typeMatches(this.type.getName())) { if (spec.instanceMatches(this.getName(), this.getId())) { for (int statIdx=0; statIdx < values.length; statIdx++) { if (values[statIdx] != null) { if (spec.statMatches(values[statIdx].getDescriptor().getName())) { matchedValues.add(values[statIdx]); } } } } } }
public double[] getSnapshots() { double[] result; int startIdx = getStartIdx(); int endIdx = getEndIdx(startIdx); int resultSize=(endIdx-startIdx) + 1; if (filter != FILTER_NONE && resultSize > 1) { long[] timestamps = null; if (filter == FILTER_PERSEC) { timestamps = resource.getAllRawTimeStamps(); } result = new double[resultSize-1]; int tsIdx = resource.getFirstTimeStampIdx()+startIdx; double[] values = series.getValuesEx(descriptor.getTypeCode(), startIdx, resultSize); for (int i=0; i < result.length; i++) { double valueDelta = values[i+1] - values[i]; if (filter == FILTER_PERSEC) { double timeDelta = (timestamps[tsIdx+i+1] - timestamps[tsIdx+i]); // millis valueDelta /= (timeDelta / 1000); // per second } result[i] = valueDelta; } } else { result = series.getValuesEx(descriptor.getTypeCode(), startIdx, resultSize); } calcStats(result); return result; }
protected ResourceInst(StatArchiveFile archive, int uniqueId, String name, long id, ResourceType type, boolean loaded) { this.loaded = loaded; this.archive = archive; // this.uniqueId = uniqueId; this.name = name; this.id = id; Assert.assertTrue(type != null); this.type = type; if (loaded) { StatDescriptor[] stats = type.getStats(); this.values = new SimpleValue[stats.length]; for (int i=0; i < stats.length; i++) { if (archive.loadStat(stats[i], this)) { this.values[i] = new SimpleValue(this, stats[i]); } else { this.values[i] = null; } } } else { this.values = null; } }
public double[] getSnapshots() { double[] result; int startIdx = getStartIdx(); int endIdx = getEndIdx(startIdx); int resultSize=(endIdx-startIdx) + 1; if (filter != FILTER_NONE && resultSize > 1) { long[] timestamps = null; if (filter == FILTER_PERSEC) { timestamps = resource.getAllRawTimeStamps(); } result = new double[resultSize-1]; int tsIdx = resource.getFirstTimeStampIdx()+startIdx; double[] values = series.getValuesEx(descriptor.getTypeCode(), startIdx, resultSize); for (int i=0; i < result.length; i++) { double valueDelta = values[i+1] - values[i]; if (filter == FILTER_PERSEC) { double timeDelta = (timestamps[tsIdx+i+1] - timestamps[tsIdx+i]); // millis valueDelta /= (timeDelta / 1000); // per second } result[i] = valueDelta; } } else { result = series.getValuesEx(descriptor.getTypeCode(), startIdx, resultSize); } calcStats(result); return result; }
protected ResourceInst(StatArchiveFile archive, int uniqueId, String name, long id, ResourceType type, boolean loaded) { this.loaded = loaded; this.archive = archive; // this.uniqueId = uniqueId; this.name = name; this.id = id; Assert.assertTrue(type != null); this.type = type; if (loaded) { StatDescriptor[] stats = type.getStats(); this.values = new SimpleValue[stats.length]; for (int i=0; i < stats.length; i++) { if (archive.loadStat(stats[i], this)) { this.values[i] = new SimpleValue(this, stats[i]); } else { this.values[i] = null; } } } else { this.values = null; } }
public long[] getRawAbsoluteTimeStamps() { int startIdx = getStartIdx(); int endIdx = getEndIdx(startIdx); int resultSize=(endIdx-startIdx) + 1; if (resultSize <= 0) { return new long[0]; } else { long[] result = new long[resultSize]; long[] timestamps = resource.getAllRawTimeStamps(); int tsIdx = resource.getFirstTimeStampIdx()+startIdx; long base = resource.getTimeBase(); for (int i=0; i < resultSize; i++) { result[i] = base + timestamps[tsIdx+i]; } return result; } }
public long[] getRawAbsoluteTimeStamps() { int startIdx = getStartIdx(); int endIdx = getEndIdx(startIdx); int resultSize=(endIdx-startIdx) + 1; if (resultSize <= 0) { return new long[0]; } else { long[] result = new long[resultSize]; long[] timestamps = resource.getAllRawTimeStamps(); int tsIdx = resource.getFirstTimeStampIdx()+startIdx; long base = resource.getTimeBase(); for (int i=0; i < resultSize; i++) { result[i] = base + timestamps[tsIdx+i]; } return result; } }
public boolean isTrimmedLeft() { return getStartIdx() != 0; }
public boolean isTrimmedLeft() { return getStartIdx() != 0; }
void matchSpec(StatSpec spec, List matchedValues) { if (spec.typeMatches(this.type.getName())) { if (spec.instanceMatches(this.getName(), this.getId())) { for (int statIdx=0; statIdx < values.length; statIdx++) { if (values[statIdx] != null) { if (spec.statMatches(values[statIdx].getDescriptor().getName())) { matchedValues.add(values[statIdx]); } } } } } }
protected void dump(PrintWriter stream) { calcStats(); stream.print(" " + descriptor.getName() + "="); stream.print("[size=" + getSnapshotsSize() + " min=" + nf.format(min) + " max=" + nf.format(max) + " avg=" + nf.format(avg) + " stddev=" + nf.format(stddev) + "]"); if (Boolean.getBoolean("StatArchiveReader.dumpall")) { series.dump(stream); } else { stream.println(); } }
public StatValue createTrimmed(long startTime, long endTime) { if (startTime == this.startTime && endTime == this.endTime) { return this; } else { return new SimpleValue(this, startTime, endTime); } }
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(); } } } }
/** * Returns the approximate amount of memory used to implement this object. */ protected int getMemoryUsed() { int result = 0; if (values != null) { for (int i=0; i < values.length; i++) { result += this.values[i].getMemoryUsed(); } } return result; }
public long[] getRawAbsoluteTimeStampsWithSecondRes() { long[] result = getRawAbsoluteTimeStamps(); for (int i=0; i < result.length; i++) { result[i] += 500; result[i] /= 1000; result[i] *= 1000; } return result; }
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(); } } } }
public double[] getRawSnapshots() { int startIdx = getStartIdx(); int endIdx = getEndIdx(startIdx); int resultSize=(endIdx-startIdx) + 1; return series.getValuesEx(descriptor.getTypeCode(), startIdx, resultSize); }
public long[] getRawAbsoluteTimeStampsWithSecondRes() { long[] result = getRawAbsoluteTimeStamps(); for (int i=0; i < result.length; i++) { result[i] += 500; result[i] /= 1000; result[i] *= 1000; } return result; }