public static Count read(String filename) { long start = System.currentTimeMillis(); System.out.println("\n\nReading File " + filename); Count allCount = new Count(); try (GridDataset gds = GridDataset.open(filename)) { for (GridDatatype gdt : gds.getGrids()) { Count count = read(gdt); System.out.printf("%80s == %d/%d%n", gdt.getFullName(), count.nmiss, count.nread); allCount.add(count); } long took = System.currentTimeMillis() - start; float r = ((float) took) / allCount.nread; System.out.printf("%n%80s == %d/%d%n", "total", allCount.nmiss, allCount.nread); System.out.printf("%n that took %d secs total, %f msecs per record%n", took / 1000, r); } catch (IOException ioe) { ioe.printStackTrace(); Formatter out = new Formatter(System.out); GribCdmIndex.gribCollectionCache.showCache(out); } return allCount; }
@AfterClass static public void after() { Grib.setDebugFlags(new DebugFlagsImpl()); Formatter out = new Formatter(System.out); FileCacheIF cache = GribCdmIndex.gribCollectionCache; if (cache != null) { cache.showTracking(out); cache.showCache(out); cache.clearCache(false); } FileCacheIF rafCache = RandomAccessFile.getGlobalFileCache(); if (rafCache != null) { rafCache.showCache(out); } System.out.printf(" countGC=%7d%n", GribCollectionImmutable.countGC); System.out.printf(" countPC=%7d%n", PartitionCollectionImmutable.countPC); System.out.printf(" countDataAccess=%7d%n", GribIosp.debugIndexOnlyCount); System.out.printf(" total files needed=%7d%n", GribCollectionImmutable.countGC + PartitionCollectionImmutable.countPC + GribIosp.debugIndexOnlyCount); FileCache.shutdown(); RandomAccessFile.setGlobalFileCache(null); TestDir.checkLeaks(); RandomAccessFile.setDebugLeaks(false); }
@AfterClass static public void after() { Grib.setDebugFlags(new DebugFlagsImpl()); Formatter out = new Formatter(System.out); FileCacheIF cache = GribCdmIndex.gribCollectionCache; if (cache != null) { cache.showTracking(out); cache.showCache(out); cache.clearCache(false); } FileCacheIF rafCache = RandomAccessFile.getGlobalFileCache(); if (rafCache != null) { rafCache.showCache(out); } System.out.printf(" countGC=%7d%n", GribCollectionImmutable.countGC); System.out.printf(" countPC=%7d%n", PartitionCollectionImmutable.countPC); System.out.printf(" countDataAccess=%7d%n", GribIosp.debugIndexOnlyCount); System.out.printf(" total files needed=%7d%n", GribCollectionImmutable.countGC + PartitionCollectionImmutable.countPC + GribIosp.debugIndexOnlyCount); FileCache.shutdown(); RandomAccessFile.setGlobalFileCache(null); TestDir.checkLeaks(); RandomAccessFile.setDebugLeaks(false); }
@AfterClass static public void after() { Grib.setDebugFlags(new DebugFlagsImpl()); Formatter out = new Formatter(System.out); FileCacheIF cache = GribCdmIndex.gribCollectionCache; if (cache != null) { cache.showTracking(out); cache.showCache(out); cache.clearCache(false); } FileCacheIF rafCache = RandomAccessFile.getGlobalFileCache(); if (rafCache != null) { rafCache.showCache(out); } System.out.printf(" countGC=%7d%n", GribCollectionImmutable.countGC); System.out.printf(" countPC=%7d%n", PartitionCollectionImmutable.countPC); System.out.printf(" countDataAccess=%7d%n", GribIosp.debugIndexOnlyCount); System.out.printf(" total files needed=%7d%n", GribCollectionImmutable.countGC + PartitionCollectionImmutable.countPC + GribIosp.debugIndexOnlyCount); FileCache.shutdown(); RandomAccessFile.setGlobalFileCache(null); TestDir.checkLeaks(); RandomAccessFile.setDebugLeaks(false); }
cache.showCache();
@Test public void TestCached() throws IOException { try { NetcdfDataset.initNetcdfFileCache(10, 20, -1); String filename = TestDir.cdmUnitTestDir + "ncml/nestedAgg/test.ncml"; try (NetcdfDataset ncd = NetcdfDataset.acquireDataset(DatasetUrl.findDatasetUrl(filename), true , null)) { Variable time = ncd.findVariable("time"); assert time != null; assert time.getSize() == 19723 : time.getSize(); //System.out.printf(" time array = %s%n", NCdumpW.toString(time.read())); } FileCacheIF cache = NetcdfDataset.getNetcdfFileCache(); cache.showCache(); } finally { NetcdfDataset.shutdown(); } }