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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
/*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.core.runtime.internal.stats;
import java.util.ArrayList;
import java.util.List;
/**
* Contains information about activated bundles and acts as the main
* entry point for logging bundle activity.
*/
public class BundleStats {
public String symbolicName;
public long id;
public int activationOrder;
private long timestamp; //timeStamp at which this bundle has been activated
private boolean duringStartup; // indicate if the bundle has been activated during startup
private long startupTime; // the time took by the bundle to startup
private long startupMethodTime; // the time took to run the startup method
// Indicate the position of the activation trace in the file
private long traceStart = -1;
private long traceEnd = -1;
//To keep bundle parentage
private List<BundleStats> bundlesActivated = new ArrayList<BundleStats>(3); // TODO create lazily
private BundleStats activatedBy = null;
public BundleStats(String name, long id) {
this.symbolicName = name;
this.id = id;
}
public long getTimestamp() {
return timestamp;
}
public int getActivationOrder() {
return activationOrder;
}
protected void activated(BundleStats info) {
bundlesActivated.add(info);
}
public BundleStats getActivatedBy() {
return activatedBy;
}
public long getId() {
return id;
}
public String getSymbolicName() {
return symbolicName;
}
public long getStartupTime() {
return startupTime;
}
public long getStartupMethodTime() {
return startupMethodTime;
}
public boolean isStartupBundle() {
return duringStartup;
}
public int getClassLoadCount() {
if (!StatsManager.MONITOR_CLASSES)
return 0;
ClassloaderStats loader = ClassloaderStats.getLoader(symbolicName);
return loader == null ? 0 : loader.getClassLoadCount();
}
public long getClassLoadTime() {
if (!StatsManager.MONITOR_CLASSES)
return 0;
ClassloaderStats loader = ClassloaderStats.getLoader(symbolicName);
return loader == null ? 0 : loader.getClassLoadTime();
}
public List<BundleStats> getBundlesActivated() {
return bundlesActivated;
}
public long getTraceStart() {
return traceStart;
}
public long getTraceEnd() {
return traceEnd;
}
protected void setTimestamp(long value) {
timestamp = value;
}
protected void setActivationOrder(int value) {
activationOrder = value;
}
protected void setTraceStart(long time) {
traceStart = time;
}
protected void setDuringStartup(boolean value) {
duringStartup = value;
}
protected void endActivation() {
startupTime = System.currentTimeMillis() - timestamp;
}
protected void setTraceEnd(long position) {
traceEnd = position;
}
protected void setActivatedBy(BundleStats value) {
activatedBy = value;
}
}
|