author | timkelly |
Thu, 30 Jul 2009 11:56:23 -0500 | |
changeset 40 | eb3c938c7fef |
permissions | -rw-r--r-- |
40
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
1 |
/******************************************************************************* |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
2 |
* Copyright (c) 2000, 2005 IBM Corporation and others. |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
3 |
* All rights reserved. This program and the accompanying materials |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
5 |
* which accompanies this distribution, and is available at |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
6 |
* http://www.eclipse.org/legal/epl-v10.html |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
7 |
* |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
8 |
* Contributors: |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
9 |
* IBM Corporation - initial API and implementation |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
10 |
*******************************************************************************/ |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
11 |
package org.eclipse.core.internal.events; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
12 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
13 |
import org.eclipse.core.resources.*; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
14 |
import org.eclipse.core.runtime.PerformanceStats; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
15 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
16 |
/** |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
17 |
* An ResourceStats collects and aggregates timing data about an event such as |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
18 |
* a builder running, an editor opening, etc. |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
19 |
*/ |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
20 |
public class ResourceStats { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
21 |
/** |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
22 |
* The event that is currently occurring, maybe <code>null</code> |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
23 |
*/ |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
24 |
private static PerformanceStats currentStats; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
25 |
//performance event names |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
26 |
public static final String EVENT_BUILDERS = ResourcesPlugin.PI_RESOURCES + "/perf/builders"; //$NON-NLS-1$ |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
27 |
public static final String EVENT_LISTENERS = ResourcesPlugin.PI_RESOURCES + "/perf/listeners"; //$NON-NLS-1$ |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
28 |
public static final String EVENT_SAVE_PARTICIPANTS = ResourcesPlugin.PI_RESOURCES + "/perf/save.participants"; //$NON-NLS-1$ |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
29 |
public static final String EVENT_SNAPSHOT = ResourcesPlugin.PI_RESOURCES + "/perf/snapshot"; //$NON-NLS-1$ |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
30 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
31 |
//performance event enablement |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
32 |
public static boolean TRACE_BUILDERS = PerformanceStats.isEnabled(ResourceStats.EVENT_BUILDERS); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
33 |
public static boolean TRACE_LISTENERS = PerformanceStats.isEnabled(ResourceStats.EVENT_LISTENERS); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
34 |
public static boolean TRACE_SAVE_PARTICIPANTS = PerformanceStats.isEnabled(ResourceStats.EVENT_SAVE_PARTICIPANTS); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
35 |
public static boolean TRACE_SNAPSHOT = PerformanceStats.isEnabled(ResourceStats.EVENT_SNAPSHOT); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
36 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
37 |
public static void endBuild() { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
38 |
if (currentStats != null) |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
39 |
currentStats.endRun(); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
40 |
currentStats = null; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
41 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
42 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
43 |
public static void endNotify() { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
44 |
if (currentStats != null) |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
45 |
currentStats.endRun(); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
46 |
currentStats = null; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
47 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
48 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
49 |
public static void endSave() { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
50 |
if (currentStats != null) |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
51 |
currentStats.endRun(); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
52 |
currentStats = null; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
53 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
54 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
55 |
public static void endSnapshot() { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
56 |
if (currentStats != null) |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
57 |
currentStats.endRun(); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
58 |
currentStats = null; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
59 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
60 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
61 |
/** |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
62 |
* Notifies the stats tool that a resource change listener has been added. |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
63 |
*/ |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
64 |
public static void listenerAdded(IResourceChangeListener listener) { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
65 |
if (listener != null) |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
66 |
PerformanceStats.getStats(EVENT_LISTENERS, listener.getClass().getName()); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
67 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
68 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
69 |
/** |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
70 |
* Notifies the stats tool that a resource change listener has been removed. |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
71 |
*/ |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
72 |
public static void listenerRemoved(IResourceChangeListener listener) { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
73 |
if (listener != null) |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
74 |
PerformanceStats.removeStats(EVENT_LISTENERS, listener.getClass().getName()); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
75 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
76 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
77 |
public static void startBuild(IncrementalProjectBuilder builder) { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
78 |
currentStats = PerformanceStats.getStats(EVENT_BUILDERS, builder); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
79 |
currentStats.startRun(builder.getProject().getName()); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
80 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
81 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
82 |
public static void startNotify(IResourceChangeListener listener) { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
83 |
currentStats = PerformanceStats.getStats(EVENT_LISTENERS, listener); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
84 |
currentStats.startRun(); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
85 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
86 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
87 |
public static void startSnapshot() { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
88 |
currentStats = PerformanceStats.getStats(EVENT_SNAPSHOT, ResourcesPlugin.getWorkspace()); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
89 |
currentStats.startRun(); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
90 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
91 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
92 |
public static void startSave(ISaveParticipant participant) { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
93 |
currentStats = PerformanceStats.getStats(EVENT_SAVE_PARTICIPANTS, participant); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
94 |
currentStats.startRun(); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
95 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
96 |
} |