Skip to main content
summaryrefslogtreecommitdiffstats
blob: f48f1a3a40ed37dd3623976e6f29583c7e35ed87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package org.eclipse.jst.ws.tests.performance.util;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.test.performance.Performance;
import org.eclipse.test.performance.PerformanceMeter;
import org.eclipse.wst.common.environment.ILog;


public class EclipsePerformanceLog implements ILog {

  private boolean runState = false;
  Performance perf = null;      
  PerformanceMeter performanceMeter= null;  
  
  public boolean isEnabled() {
    // TODO Auto-generated method stub
    return false;
  }

  public boolean isEnabled(String option) {
    // TODO Auto-generated method stub
    return false;
  }
  
  public void log(int severity, int messageNum, Object caller, String method, Throwable throwable) {
    // TODO Auto-generated method stub

  }

  public void log(int severity, String option, int messageNum, Object caller, String method, Throwable throwable) {
    // TODO Auto-generated method stub

  }

  public void log(int severity, int messageNum, Object caller, String method, IStatus status) {
    // TODO Auto-generated method stub

  }

  public void log(int severity, String option, int messageNum, Object caller, String method, IStatus status) {
    // TODO Auto-generated method stub

  }

  public void log(int severity, int messageNum, Object caller, String method, Object object) {
    // TODO Auto-generated method stub

  }

  public void log(int severity, String option, int messageNum, Object caller, String method, Object object) {
    
    if (method.equals("runCommand")) {

      try {
        if (!runState) {
          // begin performance recording
          perf = Performance.getDefault();      
          performanceMeter = perf.createPerformanceMeter(((String)object).toString());          
          performanceMeter.start();
          runState = true;
        }
        else {
          // end performance recording
          performanceMeter.stop();
          performanceMeter.commit();
          perf.assertPerformance(performanceMeter);
          performanceMeter.dispose();
          runState = false;
        }
      }
      catch(Exception e) {
        // handle exception
      }        
    }
  }

}

Back to the top