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.wireprotocol;
042:
043: import java.io.IOException;
044: import java.io.ObjectInputStream;
045: import java.io.ObjectOutputStream;
046:
047: /**
048: * Response containing instrumentation- and profiling-related statistics - most of the data that is presented if one
049: * invokes Profile | Get internal statistics command in the tool.
050: *
051: * @author Misha Dmitriev
052: * @author Ian Formanek
053: */
054: public class InternalStatsResponse extends Response {
055: //~ Instance fields ----------------------------------------------------------------------------------------------------------
056:
057: public double averageHotswappingTime;
058: public double clientDataProcTime;
059: public double clientInstrTime;
060: public double maxHotswappingTime;
061: public double methodEntryExitCallTime0;
062: public double methodEntryExitCallTime1;
063: public double methodEntryExitCallTime2;
064: public double minHotswappingTime;
065: public double totalHotswappingTime;
066: public int nClassLoads;
067: public int nEmptyInstrMethodGroupResponses;
068: public int nFirstMethodInvocations;
069: public int nNonEmptyInstrMethodGroupResponses;
070: public int nSingleMethodInstrMethodGroupResponses;
071:
072: // Fields made public as an exception, to avoid too many accessors
073: public int nTotalInstrMethods;
074:
075: //~ Constructors -------------------------------------------------------------------------------------------------------------
076:
077: /**
078: * We don't use a normal constructor with parameters here, since there are too many parameters to pass.
079: * Instead we use public data fields.
080: */
081: public InternalStatsResponse() {
082: super (true, INTERNAL_STATS);
083: }
084:
085: //~ Methods ------------------------------------------------------------------------------------------------------------------
086:
087: // For debugging
088: public String toString() {
089: return "InternalStatsResponse, " + super .toString(); // NOI18N
090: }
091:
092: void readObject(ObjectInputStream in) throws IOException {
093: nTotalInstrMethods = in.readInt();
094: nClassLoads = in.readInt();
095: nFirstMethodInvocations = in.readInt();
096: nNonEmptyInstrMethodGroupResponses = in.readInt();
097: nEmptyInstrMethodGroupResponses = in.readInt();
098: nSingleMethodInstrMethodGroupResponses = in.readInt();
099: clientInstrTime = in.readDouble();
100: clientDataProcTime = in.readDouble();
101: totalHotswappingTime = in.readDouble();
102: averageHotswappingTime = in.readDouble();
103: minHotswappingTime = in.readDouble();
104: maxHotswappingTime = in.readDouble();
105: methodEntryExitCallTime0 = in.readDouble();
106: methodEntryExitCallTime1 = in.readDouble();
107: methodEntryExitCallTime2 = in.readDouble();
108: }
109:
110: // Custom serialization support
111: void writeObject(ObjectOutputStream out) throws IOException {
112: out.writeInt(nTotalInstrMethods);
113: out.writeInt(nClassLoads);
114: out.writeInt(nFirstMethodInvocations);
115: out.writeInt(nNonEmptyInstrMethodGroupResponses);
116: out.writeInt(nEmptyInstrMethodGroupResponses);
117: out.writeInt(nSingleMethodInstrMethodGroupResponses);
118: out.writeDouble(clientInstrTime);
119: out.writeDouble(clientDataProcTime);
120: out.writeDouble(totalHotswappingTime);
121: out.writeDouble(averageHotswappingTime);
122: out.writeDouble(minHotswappingTime);
123: out.writeDouble(maxHotswappingTime);
124: out.writeDouble(methodEntryExitCallTime0);
125: out.writeDouble(methodEntryExitCallTime1);
126: out.writeDouble(methodEntryExitCallTime2);
127: }
128: }
|