KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > ejb > codegen > IASEJBCTimes


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * IASEJBCTimes.java
26  *
27  * Created on June 23, 2002, 10:05 PM
28  *
29  * @author bnevins
30  * @version $Revision: 1.3 $
31  * <BR> <I>$Source: /cvs/glassfish/appserv-core/src/java/com/sun/ejb/codegen/IASEJBCTimes.java,v $
32  *
33  */

34
35 package com.sun.ejb.codegen;
36  
37 /**
38  * This class gathers timing information for the sub-tasks of IASEJBC
39  */

40
41 public class IASEJBCTimes
42 {
43     public IASEJBCTimes()
44     {
45     }
46
47     ///////////////////////////////////////////////////////////////////////////
48

49     public long getTotalTime()
50     {
51         return totalTime;
52     }
53
54     ///////////////////////////////////////////////////////////////////////////
55

56     public String JavaDoc toString()
57     {
58         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
59         sb.append("Total Time for EJBC: " + totalTime + " msec, ");
60         sb.append(makeEntry("CMP Generation", cmpGeneratorTime));
61         sb.append(makeEntry("Java Compilation", javaCompileTime));
62         sb.append(makeEntry("RMI Compilation", RMICompileTime));
63                 sb.append(makeEntry("JAX-RPC Generation", jaxrpcGenerationTime));
64         sb.append("\n");
65         return sb.toString();
66     }
67     
68     ///////////////////////////////////////////////////////////////////////////
69

70     private String JavaDoc makeEntry(String JavaDoc title, long time)
71     {
72         return title + ": " + time + " msec (" + percent(time) + "), ";
73     }
74     
75     ///////////////////////////////////////////////////////////////////////////
76

77     private String JavaDoc percent(long time)
78     {
79         if(totalTime <= 0)
80             return "0%";
81         
82         return "" + ((time * 100) / totalTime) + "%";
83     }
84     
85     ///////////////////////////////////////////////////////////////////////////
86

87     long cmpGeneratorTime = 0;
88     long javaCompileTime = 0;
89     long RMICompileTime = 0;
90         long jaxrpcGenerationTime = 0;
91     long totalTime = 0;
92         
93 }
94
Popular Tags