StatArchiveReader.StatArchiveFile[] archives = reader.getArchives(); for (int i=0; i < archives.length; i++) { System.out.println(archives[i].getArchiveInfo().toString());
/** * Returns an array of stat values that match the specified spec. * If nothing matches then an empty array is returned. */ public StatValue[] matchSpec(StatSpec spec) { if (spec.getCombineType() == StatSpec.GLOBAL) { StatValue[] allValues = matchSpec(new RawStatSpec(spec)); if (allValues.length == 0) { return allValues; } else { ComboValue cv = new ComboValue(allValues); // need to save this in reader's combo value list return new StatValue[]{cv}; } } else { List l = new ArrayList(); StatArchiveReader.StatArchiveFile[] archives = getArchives(); for (int i=0; i < archives.length; i++) { StatArchiveFile f = archives[i]; if (spec.archiveMatches(f.getFile())) { f.matchSpec(spec, l); } } StatValue[] result = new StatValue[l.size()]; return (StatValue[])l.toArray(result); } }
/** * Creates a StatArchiveReader that will read the named archive file. * @param autoClose if its <code>true</code> then the reader will close * input files as soon as it finds their end. * @throws IOException if <code>archiveName</code> could not be opened * read, or closed. */ public StatArchiveReader(File[] archiveNames, ValueFilter[] filters, boolean autoClose) throws IOException { this.archives = new StatArchiveFile[archiveNames.length]; this.dump = Boolean.getBoolean("StatArchiveReader.dumpall"); for (int i=0; i < archiveNames.length; i++) { this.archives[i] = new StatArchiveFile(this, archiveNames[i], dump, filters); } update(false, autoClose); if (this.dump || Boolean.getBoolean("StatArchiveReader.dump")) { this.dump(new PrintWriter(System.out)); } }
StatArchiveReader.StatArchiveFile[] archives = reader.getArchives(); for (int i=0; i < archives.length; i++) { System.out.println(archives[i].getArchiveInfo().toString());
String productVersion = null; for ( int i = 0; i < resources.length; i++ ) { String archive = resources[i].getArchive().getFile().getParentFile().getName(); if ( productVersion == null ) { productVersion = resources[i].getArchive().getArchiveInfo().getProductVersion();
/** * Returns an array of stat values that match the specified spec. * If nothing matches then an empty array is returned. */ public StatValue[] matchSpec(StatSpec spec) { if (spec.getCombineType() == StatSpec.GLOBAL) { StatValue[] allValues = matchSpec(new RawStatSpec(spec)); if (allValues.length == 0) { return allValues; } else { ComboValue cv = new ComboValue(allValues); // need to save this in reader's combo value list return new StatValue[]{cv}; } } else { List l = new ArrayList(); StatArchiveReader.StatArchiveFile[] archives = getArchives(); for (int i=0; i < archives.length; i++) { StatArchiveFile f = archives[i]; if (spec.archiveMatches(f.getFile())) { f.matchSpec(spec, l); } } StatValue[] result = new StatValue[l.size()]; return (StatValue[])l.toArray(result); } }
/** * Returns a string representation of this object. */ @Override public String toString() { StringBuffer result = new StringBuffer(); result.append(name) .append(", ") .append(id) .append(", ") .append(type.getName()) .append(": \"") .append(archive.formatTimeMillis(getFirstTimeMillis())) .append('\"'); if (!active) { result.append(" inactive"); } result.append(" samples="+ getSampleCount()); return result.toString(); } /**
protected void dump(PrintWriter stream) { if (archive != null) { stream.println("archive=" + archive.getFile()); } stream.println("archiveVersion=" + archiveVersion); if (archive != null) { stream.println("startDate=" + archive.formatTimeMillis(startTimeStamp)); } // stream.println("startTimeStamp=" + startTimeStamp +" tz=" + timeZoneName + " tzOffset=" + timeZoneOffset); // stream.println("timeZone=" + getTimeZone().getDisplayName()); stream.println("systemDirectory=" + systemDirectory); if (archive != null) { stream.println("systemStartDate=" + archive.formatTimeMillis(systemStartTimeStamp)); } stream.println("systemId=" + systemId); stream.println("productVersion=" + productVersion); stream.println("osInfo=" + os); stream.println("machineInfo=" + machine); } }
/** * Returns a string representation of this object. */ @Override public String toString() { StringBuffer result = new StringBuffer(); result.append(name) .append(", ") .append(id) .append(", ") .append(type.getName()) .append(": \"") .append(archive.formatTimeMillis(getFirstTimeMillis())) .append('\"'); if (!active) { result.append(" inactive"); } result.append(" samples="+ getSampleCount()); return result.toString(); } /**
private boolean update(boolean doReset, boolean autoClose) throws IOException { if (this.closed) { return false; } boolean result = false; StatArchiveReader.StatArchiveFile[] archives = getArchives(); for (int i=0; i < archives.length; i++) { StatArchiveFile f = archives[i]; if (f.update(doReset)) { result = true; } if (autoClose) { f.close(); } } return result; }
private boolean update(boolean doReset, boolean autoClose) throws IOException { if (this.closed) { return false; } boolean result = false; StatArchiveReader.StatArchiveFile[] archives = getArchives(); for (int i=0; i < archives.length; i++) { StatArchiveFile f = archives[i]; if (f.update(doReset)) { result = true; } if (autoClose) { f.close(); } } return result; }
protected void dump(PrintWriter stream) { if (archive != null) { stream.println("archive=" + archive.getFile()); } stream.println("archiveVersion=" + archiveVersion); if (archive != null) { stream.println("startDate=" + archive.formatTimeMillis(startTimeStamp)); } // stream.println("startTimeStamp=" + startTimeStamp +" tz=" + timeZoneName + " tzOffset=" + timeZoneOffset); // stream.println("timeZone=" + getTimeZone().getDisplayName()); stream.println("systemDirectory=" + systemDirectory); if (archive != null) { stream.println("systemStartDate=" + archive.formatTimeMillis(systemStartTimeStamp)); } stream.println("systemId=" + systemId); stream.println("productVersion=" + productVersion); stream.println("osInfo=" + os); stream.println("machineInfo=" + machine); } }
public StatArchiveFile(StatArchiveReader reader, File archiveName, boolean dump, ValueFilter[] filters) throws IOException { this.reader = reader; this.archiveName = archiveName; this.dump = dump; this.compressed = archiveName.getPath().endsWith(".gz"); this.is = new FileInputStream(this.archiveName); if (this.compressed) { this.dataIn = new DataInputStream(new BufferedInputStream(new GZIPInputStream(this.is, BUFFER_SIZE), BUFFER_SIZE)); } else { this.dataIn = new DataInputStream(new BufferedInputStream(this.is, BUFFER_SIZE)); } this.updateOK = this.dataIn.markSupported(); this.filters = createFilters(filters); }
public StatArchiveFile(StatArchiveReader reader, File archiveName, boolean dump, ValueFilter[] filters) throws IOException { this.reader = reader; this.archiveName = archiveName; this.dump = dump; this.compressed = archiveName.getPath().endsWith(".gz"); this.is = new FileInputStream(this.archiveName); if (this.compressed) { this.dataIn = new DataInputStream(new BufferedInputStream(new GZIPInputStream(this.is, BUFFER_SIZE), BUFFER_SIZE)); } else { this.dataIn = new DataInputStream(new BufferedInputStream(this.is, BUFFER_SIZE)); } this.updateOK = this.dataIn.markSupported(); this.filters = createFilters(filters); }
/** * Creates a StatArchiveReader that will read the named archive file. * @param autoClose if its <code>true</code> then the reader will close * input files as soon as it finds their end. * @throws IOException if <code>archiveName</code> could not be opened * read, or closed. */ public StatArchiveReader(File[] archiveNames, ValueFilter[] filters, boolean autoClose) throws IOException { this.archives = new StatArchiveFile[archiveNames.length]; this.dump = Boolean.getBoolean("StatArchiveReader.dumpall"); for (int i=0; i < archiveNames.length; i++) { this.archives[i] = new StatArchiveFile(this, archiveNames[i], dump, filters); } update(false, autoClose); if (this.dump || Boolean.getBoolean("StatArchiveReader.dump")) { this.dump(new PrintWriter(System.out)); } }
private ValueFilter[] createFilters(ValueFilter[] allFilters) { if (allFilters == null) { return new ValueFilter[0]; } ArrayList l = new ArrayList(); for (int i=0; i < allFilters.length; i++) { if (allFilters[i].archiveMatches(this.getFile())) { l.add(allFilters[i]); } } if (l.size() == allFilters.length) { return allFilters; } else { ValueFilter[] result = new ValueFilter[l.size()]; return (ValueFilter[])l.toArray(result); } }
private ValueFilter[] createFilters(ValueFilter[] allFilters) { if (allFilters == null) { return new ValueFilter[0]; } ArrayList l = new ArrayList(); for (int i=0; i < allFilters.length; i++) { if (allFilters[i].archiveMatches(this.getFile())) { l.add(allFilters[i]); } } if (l.size() == allFilters.length) { return allFilters; } else { ValueFilter[] result = new ValueFilter[l.size()]; return (ValueFilter[])l.toArray(result); } }
protected long[] getAllRawTimeStamps() { return archive.getTimeStamps().getRawTimeStamps(); } protected long getTimeBase() {
/** * Closes all archives. */ public void close() throws IOException { if (!this.closed) { StatArchiveReader.StatArchiveFile[] archives = getArchives(); for (int i=0; i < archives.length; i++) { StatArchiveFile f = archives[i]; f.close(); } this.closed = true; } }
protected long getTimeBase() { return archive.getTimeStamps().getBase(); } /**