001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: * The Original Software is NetBeans. The Initial Developer of the Original
026: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
027: * Microsystems, Inc. All Rights Reserved.
028: *
029: * If you wish your version of this file to be governed by only the CDDL
030: * or only the GPL Version 2, indicate your decision by adding
031: * "[Contributor] elects to include this software in this distribution
032: * under the [CDDL or GPL Version 2] license." If you do not indicate a
033: * single choice of license, a recipient has the option to distribute
034: * your version of this file under either the CDDL, the GPL Version 2 or
035: * to extend the choice of license to its licensees as provided above.
036: * However, if you add GPL Version 2 code and therefore, elected the GPL
037: * Version 2 license, then the option applies only if the new code is
038: * made subject to such option by the copyright holder.
039: */
040:
041: package org.netbeans.lib.profiler.results.memory;
042:
043: import org.netbeans.lib.profiler.client.ClientUtils;
044: import org.netbeans.lib.profiler.results.CCTProvider;
045:
046: /**
047: * @author Jaroslav Bachorik
048: */
049: public interface MemoryCCTProvider extends CCTProvider {
050: //~ Inner Interfaces ---------------------------------------------------------------------------------------------------------
051:
052: public static interface Listener extends CCTProvider.Listener {
053: }
054:
055: //~ Inner Classes ------------------------------------------------------------------------------------------------------------
056:
057: // *****************************************************
058:
059: /**
060: * A container class, needed just for correct data transfer to its consumers.
061: * @author Misha Dmitirev
062: */
063: public static class ObjectNumbersContainer {
064: //~ Instance fields ------------------------------------------------------------------------------------------------------
065:
066: public float[] avgObjectAge;
067: public int[] maxSurvGen;
068: public long[] nTrackedAllocObjects;
069: public int[] nTrackedLiveObjects;
070: public long[] trackedLiveObjectsSize;
071: public int nInstrClasses;
072:
073: //~ Constructors ---------------------------------------------------------------------------------------------------------
074:
075: ObjectNumbersContainer(long[] nTrackedAllocObjects,
076: int[] nTrackedLiveObjects,
077: long[] trackedLiveObjectsSize, float[] avgObjectAge,
078: int[] maxSurvGen, boolean[] unprofiledClass,
079: int nProfiledClasses) {
080: nInstrClasses = nProfiledClasses;
081:
082: int len = nProfiledClasses;
083: this .nTrackedAllocObjects = new long[len];
084: this .nTrackedLiveObjects = new int[len];
085: this .trackedLiveObjectsSize = new long[len];
086: this .avgObjectAge = avgObjectAge;
087: this .maxSurvGen = maxSurvGen;
088:
089: if (nTrackedAllocObjects != null) {
090: System.arraycopy(nTrackedAllocObjects, 0,
091: this .nTrackedAllocObjects, 0, len);
092: }
093:
094: if (nTrackedLiveObjects != null) {
095: System.arraycopy(nTrackedLiveObjects, 0,
096: this .nTrackedLiveObjects, 0, len);
097: }
098:
099: if (trackedLiveObjectsSize != null) {
100: System.arraycopy(trackedLiveObjectsSize, 0,
101: this .trackedLiveObjectsSize, 0, len);
102: }
103:
104: for (int i = 0; i < unprofiledClass.length; i++) {
105: if (unprofiledClass[i]) {
106: this .nTrackedAllocObjects[i] = -1; // Special value
107: this .nTrackedLiveObjects[i] = 0;
108: this .trackedLiveObjectsSize[i] = 0;
109: this .avgObjectAge[i] = 0.0f;
110: this .maxSurvGen[i] = 0;
111: }
112: }
113: }
114: }
115:
116: //~ Methods ------------------------------------------------------------------------------------------------------------------
117:
118: long[] getAllocObjectNumbers();
119:
120: int getCurrentEpoch();
121:
122: ObjectNumbersContainer getLivenessObjectNumbers();
123:
124: // following methods should be used only temporarily
125: int getNProfiledClasses();
126:
127: long[] getObjectsSizePerClass();
128:
129: RuntimeMemoryCCTNode[] getStacksForClasses();
130:
131: void beginTrans(boolean mutable);
132:
133: boolean classMarkedUnprofiled(int classId);
134:
135: PresoObjAllocCCTNode createPresentationCCT(int classId,
136: boolean dontShowZeroLiveObjAllocPaths)
137: throws ClientUtils.TargetAppOrVMTerminated;
138:
139: void endTrans();
140:
141: /**
142: * Marks the class with the given id as "unprofiled". Instrumentation for the class is not removed at this point.
143: */
144: void markClassUnprofiled(int classId);
145:
146: void updateInternals();
147: }
|