From: Pavel V. <va...@us...> - 2002-02-16 14:05:38
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data In directory usw-pr-cvs1:/tmp/cvs-serv19518 Modified Files: MethodData.java AllocTypeData.java Log Message: perfomance fix, use EMPY_MAP Index: MethodData.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data/MethodData.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** MethodData.java 15 Feb 2002 22:37:30 -0000 1.11 --- MethodData.java 16 Feb 2002 14:05:31 -0000 1.12 *************** *** 66,100 **** * Mapping of {@link AllocTraceData} objects and trace IDs. */ ! private HashMap allocTraces; /** * Map of threads of this method where some objects were allocated. * Mapping of {@link AllocThreadMethodData} objects and thread IDs. */ ! private HashMap allocThreads; /** * Map of classes whose instances were allocated in this method. * Mapping of {@link AllocClassMethodData} objects and class IDs. */ ! private HashMap classes; /** * Map of traces of this method. * Mapping of {@link CPUTraceData} objects and trace IDs. */ ! private HashMap CPUTraces; /** * Map of threads in which this method was invoked. * Mapping of {@link CPUThreadMethodData} objects and thread IDs. */ ! private HashMap CPUThreads; /** * Map of traces in which this method waited. * Mapping of {@link CPUTraceData} objects and trace IDs. */ ! private HashMap MonTraces; /** * Map of threads in which this method waited. * Mapping of {@link CPUThreadMethodData} objects and thread IDs. */ ! private HashMap MonThreads; /** --- 66,100 ---- * Mapping of {@link AllocTraceData} objects and trace IDs. */ ! private Map allocTraces; /** * Map of threads of this method where some objects were allocated. * Mapping of {@link AllocThreadMethodData} objects and thread IDs. */ ! private Map allocThreads; /** * Map of classes whose instances were allocated in this method. * Mapping of {@link AllocClassMethodData} objects and class IDs. */ ! private Map classes; /** * Map of traces of this method. * Mapping of {@link CPUTraceData} objects and trace IDs. */ ! private Map CPUTraces; /** * Map of threads in which this method was invoked. * Mapping of {@link CPUThreadMethodData} objects and thread IDs. */ ! private Map CPUThreads; /** * Map of traces in which this method waited. * Mapping of {@link CPUTraceData} objects and trace IDs. */ ! private Map MonTraces; /** * Map of threads in which this method waited. * Mapping of {@link CPUThreadMethodData} objects and thread IDs. */ ! private Map MonThreads; /** *************** *** 116,126 **** this.endLine=endLine; this.clazz=clazz; ! allocTraces=new HashMap(); ! allocThreads=new HashMap();; ! CPUTraces=new HashMap(); ! classes=new HashMap(); ! CPUThreads=new HashMap(); ! MonTraces=new HashMap(); ! MonThreads=new HashMap(); } --- 116,129 ---- this.endLine=endLine; this.clazz=clazz; ! ! //empty collection used, beacause SnapShot includes all methods, most of them ! //doesn't have any statistic data ! allocTraces = Collections.EMPTY_MAP; ! allocThreads = Collections.EMPTY_MAP; ! CPUTraces= Collections.EMPTY_MAP; ! classes = Collections.EMPTY_MAP; ! CPUThreads = Collections.EMPTY_MAP; ! MonTraces = Collections.EMPTY_MAP; ! MonThreads = Collections.EMPTY_MAP; } *************** *** 210,213 **** --- 213,218 ---- */ void addAllocTrace(AllocTraceData trace) { + if ( allocTraces == Collections.EMPTY_MAP ) + allocTraces = new HashMap(); allocTraces.put(new Integer(trace.getID()), trace); } *************** *** 240,243 **** --- 245,250 ---- */ void addCPUTrace(CPUTraceData trace) { + if ( CPUTraces == Collections.EMPTY_MAP ) + CPUTraces = new HashMap(); CPUTraces.put(new Integer(trace.getID()), trace); } *************** *** 269,272 **** --- 276,281 ---- */ void addMonTrace(MonTraceData trace) { + if ( MonTraces == Collections.EMPTY_MAP ) + MonTraces = new HashMap(); MonTraces.put(new Integer(trace.getID()), trace); } *************** *** 299,302 **** --- 308,313 ---- */ void addClass(AllocTypeMethodData allocClass) { + if ( classes == Collections.EMPTY_MAP ) + classes = new HashMap(); classes.put(new Integer(allocClass.getID()), allocClass); } *************** *** 331,334 **** --- 342,347 ---- */ void addAllocThread(AllocThreadMethodData thread) { + if ( allocThreads == Collections.EMPTY_MAP ) + allocThreads = new HashMap(); allocThreads.put( thread.getThread(), thread); } *************** *** 361,364 **** --- 374,379 ---- */ void addCPUThread(CPUThreadMethodData thread) { + if ( CPUThreads == Collections.EMPTY_MAP ) + CPUThreads = new HashMap(); CPUThreads.put(new Integer(thread.getThread().getID()), thread); } *************** *** 390,393 **** --- 405,410 ---- */ void addMonThread(MonThreadMethodData thread) { + if ( MonThreads == Collections.EMPTY_MAP ) + MonThreads = new HashMap(); MonThreads.put(new Integer(thread.getThread().getID()), thread); } *************** *** 531,534 **** --- 548,554 ---- /* * $Log$ + * Revision 1.12 2002/02/16 14:05:31 vachis + * perfomance fix, use EMPY_MAP + * * Revision 1.11 2002/02/15 22:37:30 vachis * code refactorization Class..Data renamed to Type..Data Index: AllocTypeData.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/data/AllocTypeData.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** AllocTypeData.java 15 Feb 2002 22:37:30 -0000 1.1 --- AllocTypeData.java 16 Feb 2002 14:05:31 -0000 1.2 *************** *** 60,65 **** this.classData=classData; this.arrayType=type; ! methods=new HashMap(); ! threads=new HashMap(); } --- 60,65 ---- this.classData=classData; this.arrayType=type; ! methods=new HashMap(); //??use EMPTY_MAP ! threads= Collections.EMPTY_MAP; } *************** *** 138,141 **** --- 138,143 ---- */ void addThread(AllocThreadTypeData thread) { + if( threads == Collections.EMPTY_MAP ) + threads = new HashMap(); threads.put(new Integer(thread.getThread().getID()), thread); } *************** *** 157,160 **** --- 159,165 ---- /* * $Log$ + * Revision 1.2 2002/02/16 14:05:31 vachis + * perfomance fix, use EMPY_MAP + * * Revision 1.1 2002/02/15 22:37:30 vachis * code refactorization Class..Data renamed to Type..Data |