01: package tide.profiler;
02:
03: import snow.sortabletable.*;
04: import snow.utils.storage.FileUtils;
05: import java.io.*;
06: import javax.swing.*;
07: import javax.swing.event.*;
08: import java.awt.*;
09: import java.awt.event.*;
10: import java.util.*;
11:
12: /** NOT DONE YET ! TODO...
13: */
14: public final class HeapDumpReader {
15: private HeapDumpReader() {
16: }
17:
18: private static void readHeapDump(File f) throws Exception {
19: long t = System.currentTimeMillis();
20: RandomAccessFile raf = new RandomAccessFile(f, "r");
21: String line = null;
22: int count = 0;
23: while ((line = raf.readLine()) != null) // EXTREMELY SLOW
24: {
25: count++;
26: }
27: FileUtils.closeIgnoringExceptions(raf);
28:
29: System.out.println("" + (System.currentTimeMillis() - t)
30: + " ms, " + count + " lines");
31: }
32:
33: private static void readHeapDump2(File f) throws Exception {
34: long t = System.currentTimeMillis();
35: LineNumberReader dis = new LineNumberReader(new FileReader(f));
36: String line = null;
37: int count = 0;
38: dis.setLineNumber(10000000);
39: while ((line = dis.readLine()) != null) {
40: count++;
41:
42: }
43: FileUtils.closeIgnoringExceptions(dis);
44:
45: System.out.println("" + (System.currentTimeMillis() - t)
46: + " ms, " + count + " lines " + dis.getLineNumber());
47: }
48:
49: /*
50: public static void main(String[] args)
51: {
52: try{
53: readHeapDump2(new File("C:/proj/tide/profiler/snow.screenshot.ScreenShot.hprof_heap_dump.txt"));
54: readHeapDump2(new File("C:/proj/tide/profiler/snow.screenshot.ScreenShot.hprof_heap_dump.txt"));
55: readHeapDump2(new File("C:/proj/tide/profiler/snow.screenshot.ScreenShot.hprof_heap_dump.txt"));
56:
57: }
58: catch(Exception e) {
59: e.printStackTrace();
60: }
61: }*/
62:
63: }
|