View Javadoc

1   	/*
2    * Jour - java profiler and monitoring library
3    *
4    * Copyright (C) 2004 Jour team
5    *
6    * This library is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU Library General Public
8    * License as published by the Free Software Foundation; either
9    * version 2 of the License, or (at your option) any later version.
10   *
11   * This library is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   * Library General Public License for more details.
15   *
16   * You should have received a copy of the GNU Library General Public
17   * License along with this library; if not, write to the
18   * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19   * Boston, MA  02111-1307, USA.
20   */
21  package net.sf.jour;
22  
23  import net.sf.jour.timer.NativeTimer;
24  
25  import org.apache.log4j.spi.LoggingEvent;
26  
27  /*
28   * Created on 20.11.2004
29   *
30   * Contributing Author(s):
31   *
32   *   Misha Lifschitz <mishalifschitz at users.sourceforge.net> (Inital implementation)
33   *   Vlad Skarzhevskyy <vlads at users.sourceforge.net> (Inital implementation)
34   */
35  /***
36   * 
37   * Minimized information to be send over wire. 
38   * 
39   * @author vlads
40   * @version $Revision: 1.2 $ ($Author: vlads $)
41   */
42  public class ProfilerEvent implements java.io.Serializable {
43      
44      private int eventType;    
45      private double timeStamp;
46      private double elapsedTime;
47      private long classID;
48      private long methodID;
49  //	Java 1.3
50      // private StackTraceElement[] stackTrace;
51      private Object identifier;
52  
53      public ProfilerEvent(Object identifier) {
54          this.timeStamp = NativeTimer.getTime();
55      }
56      
57      public ProfilerEvent(ProfilerEvent startEvent) {
58          this.timeStamp = NativeTimer.getTime();
59          this.elapsedTime = startEvent.timeStamp - this.timeStamp;
60      }
61      
62      public ProfilerEvent(long clazzID, long methodID) {
63          this.classID = clazzID;
64          this.methodID = methodID;
65          this.timeStamp = NativeTimer.getTime();
66      }
67      
68  //	Java 1.3
69  /*
70      public ProfilerEvent() {
71          stackTrace = new Throwable().getStackTrace();
72          StackTraceElement callingMethod = stackTrace[stackTrace.length-2];
73          String className = callingMethod.getClassName();
74          String methodName = callingMethod.getMethodName();
75          int lineNumber = callingMethod.getLineNumber();
76      }
77  */   
78      /***
79       * @return Returns the classID.
80       */
81      public long getClassID() {
82          return classID;
83      }
84  
85      /***
86       * @return Returns the eventType.
87       */
88      public int getEventType() {
89          return eventType;
90      }
91      /***
92       * @return Returns the methodID.
93       */
94      public long getMethodID() {
95          return methodID;
96      }
97      /***
98       * @return Returns the timeStamp.
99       */
100     public double getTimeStamp() {
101         return timeStamp;
102     }
103     /***
104      * @return Returns the elapsedTime.
105      */
106     public double getElapsedTime() {
107         return elapsedTime;
108     }
109     /***
110      * @return Returns the identifier.
111      */
112     public Object getIdentifier() {
113         return identifier;
114     }
115     /***
116      * @return Returns the stackTrace.
117      */
118 //	Java 1.3
119 /*
120     public StackTraceElement[] getStackTrace() {
121         return stackTrace;
122     }
123 */    
124 }