本文整理汇总了Java中edu.umd.cs.findbugs.log.Profiler类的典型用法代码示例。如果您正苦于以下问题:Java Profiler类的具体用法?Java Profiler怎么用?Java Profiler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Profiler类属于edu.umd.cs.findbugs.log包,在下文中一共展示了Profiler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: analyzeMethod
import edu.umd.cs.findbugs.log.Profiler; //导入依赖的package包/类
/**
* Analyze a method.
*
* @param classContext
* ClassContext storing method analysis objects for method's
* class
* @param analysisClass
* class the method analysis object should belong to
* @param methodDescriptor
* method descriptor identifying the method to analyze
* @return the computed analysis object for the method
* @throws CheckedAnalysisException
*/
@SuppressWarnings("unchecked")
private <E> E analyzeMethod(ClassContext classContext, Class<E> analysisClass, MethodDescriptor methodDescriptor)
throws CheckedAnalysisException {
IMethodAnalysisEngine<E> engine = (IMethodAnalysisEngine<E>) methodAnalysisEngineMap.get(analysisClass);
if (engine == null) {
throw new IllegalArgumentException("No analysis engine registered to produce " + analysisClass.getName());
}
Profiler profiler = getProfiler();
profiler.start(engine.getClass());
try {
return engine.analyze(this, methodDescriptor);
} finally {
profiler.end(engine.getClass());
}
}
示例2: validate
import edu.umd.cs.findbugs.log.Profiler; //导入依赖的package包/类
public When validate(Object constantValue) {
if (validator == null)
throw new IllegalStateException("No validator");
IAnalysisCache analysisCache = Global.getAnalysisCache();
Profiler profiler = analysisCache.getProfiler();
profiler.start(validator.getClass());
AtomicBoolean performing = performingValidation.get();
try {
if (!performing.compareAndSet(false, true)) {
throw new IllegalStateException("recursive validation");
}
return validator.forConstantValue(proxy, constantValue);
} catch (Exception e) {
AnalysisContext.logError("Error executing custom validator for " + typeQualifier + " " + constantValue, e);
return When.UNKNOWN;
} finally {
if (!performing.compareAndSet(true, false)) {
throw new IllegalStateException("performingValidation not set when validation completes");
}
profiler.end(validator.getClass());
}
}
示例3: analyzeMethod
import edu.umd.cs.findbugs.log.Profiler; //导入依赖的package包/类
public void analyzeMethod(ClassContext classContext, Method method, ResourceTrackerType resourceTracker,
ResourceCollection<Resource> resourceCollection) throws CFGBuilderException, DataflowAnalysisException {
MethodGen methodGen = classContext.getMethodGen(method);
if (methodGen == null)
return;
try {
CFG cfg = classContext.getCFG(method);
DepthFirstSearch dfs = classContext.getDepthFirstSearch(method);
if (DEBUG)
System.out.println(SignatureConverter.convertMethodSignature(methodGen));
for (Iterator<Resource> i = resourceCollection.resourceIterator(); i.hasNext();) {
Resource resource = i.next();
ResourceValueAnalysis<Resource> analysis = new ResourceValueAnalysis<Resource>(methodGen, cfg, dfs,
resourceTracker, resource);
Dataflow<ResourceValueFrame, ResourceValueAnalysis<Resource>> dataflow = new Dataflow<ResourceValueFrame, ResourceValueAnalysis<Resource>>(
cfg, analysis);
Profiler profiler = Global.getAnalysisCache().getProfiler();
profiler.start(resourceTracker.getClass());
try {
dataflow.execute();
} finally {
profiler.end(resourceTracker.getClass());
}
inspectResult(classContext, methodGen, cfg, dataflow, resource);
}
} catch (RuntimeException e) {
AnalysisContext.logError("Exception while analyzing " + methodGen.getClassName() + "." + methodGen.getName() + ":"
+ methodGen.getSignature(), e);
}
}
示例4: analyze
import edu.umd.cs.findbugs.log.Profiler; //导入依赖的package包/类
public ObligationDataflow analyze(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor)
throws CheckedAnalysisException {
CFG cfg = analysisCache.getMethodAnalysis(CFG.class, methodDescriptor);
DepthFirstSearch dfs = analysisCache.getMethodAnalysis(DepthFirstSearch.class, methodDescriptor);
XMethod xmethod = XFactory.createXMethod(methodDescriptor);
ConstantPoolGen cpg = analysisCache.getClassAnalysis(ConstantPoolGen.class, methodDescriptor.getClassDescriptor());
ObligationPolicyDatabase database = analysisCache.getDatabase(ObligationPolicyDatabase.class);
TypeDataflow typeDataflow = analysisCache.getMethodAnalysis(TypeDataflow.class, methodDescriptor);
IsNullValueDataflow invDataflow = analysisCache.getMethodAnalysis(IsNullValueDataflow.class, methodDescriptor);
ObligationFactory factory = database.getFactory();
ObligationAnalysis analysis = new ObligationAnalysis(dfs, xmethod, cpg, factory, database, typeDataflow, invDataflow,
analysisCache.getErrorLogger());
ObligationDataflow dataflow = new ObligationDataflow(cfg, analysis);
Profiler profiler = analysisCache.getProfiler();
profiler.start(analysis.getClass());
try {
dataflow.execute();
} finally {
profiler.end(analysis.getClass());
}
if (DEBUG_PRINTCFG) {
System.out.println("Dataflow CFG:");
DataflowCFGPrinter.printCFG(dataflow, System.out);
}
return dataflow;
}
示例5: makeZipCodeBase
import edu.umd.cs.findbugs.log.Profiler; //导入依赖的package包/类
public static AbstractScannableCodeBase makeZipCodeBase(ICodeBaseLocator codeBaseLocator, File file) throws IOException {
Profiler profiler = Global.getAnalysisCache().getProfiler();
profiler.start(ZipCodeBaseFactory.class);
try {
return countUsingZipFile(codeBaseLocator, file);
} finally {
profiler.end(ZipCodeBaseFactory.class);
}
}
示例6: visitClass
import edu.umd.cs.findbugs.log.Profiler; //导入依赖的package包/类
public void visitClass(ClassDescriptor classDescriptor) throws CheckedAnalysisException {
// Just get the ClassContext from the analysis cache
// and apply the detector to it.
IAnalysisCache analysisCache = Global.getAnalysisCache();
ClassContext classContext = analysisCache.getClassAnalysis(ClassContext.class, classDescriptor);
Profiler profiler = analysisCache.getProfiler();
profiler.start(detector.getClass());
try {
detector.visitClassContext(classContext);
} finally {
profiler.end(detector.getClass());
}
}
示例7: getResolvedAnnotation
import edu.umd.cs.findbugs.log.Profiler; //导入依赖的package包/类
public NullnessAnnotation getResolvedAnnotation(Object o, boolean getMinimal) {
Profiler profiler = Global.getAnalysisCache().getProfiler();
profiler.start(this.getClass());
try {
if (DEBUG) {
System.out.println("getResolvedAnnotation: o=" + o + "...");
}
TypeQualifierAnnotation tqa = null;
if (o instanceof XMethodParameter) {
XMethodParameter param = (XMethodParameter) o;
tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation(param.getMethod(),
param.getParameterNumber(), nonnullTypeQualifierValue);
} else if (o instanceof XMethod || o instanceof XField) {
tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation((AnnotatedObject) o,
nonnullTypeQualifierValue);
}
NullnessAnnotation result = toNullnessAnnotation(tqa);
if (DEBUG) {
if (result == null)
System.out.println(" ===> not found");
else
System.out.println(" ===> " + tqa + "/" + result.toString() );
}
return result;
} finally {
profiler.end(this.getClass());
}
}
示例8: ProjectStats
import edu.umd.cs.findbugs.log.Profiler; //导入依赖的package包/类
/**
* Constructor. Creates an empty object.
*/
public ProjectStats() {
this.packageStatsMap = new TreeMap<String, PackageStats>();
this.totalClasses = 0;
this.analysisTimestamp = new Date();
this.baseFootprint = new Footprint();
this.profiler = new Profiler();
}
示例9: sortByCallGraph
import edu.umd.cs.findbugs.log.Profiler; //导入依赖的package包/类
public static <E> List<E> sortByCallGraph(Collection<E> elements, OutEdges<E> outEdges) {
Profiler profile = Global.getAnalysisCache().getProfiler();
profile.start(TopologicalSort.class);
try {
SortAlgorithm<E> instance = new Worker2<E>(elements, outEdges);
return instance.compute();
} finally {
profile.end(TopologicalSort.class);
}
}
示例10: makeZipCodeBase
import edu.umd.cs.findbugs.log.Profiler; //导入依赖的package包/类
public static AbstractScannableCodeBase makeZipCodeBase(ICodeBaseLocator codeBaseLocator, File file) throws IOException {
Profiler profiler = Global.getAnalysisCache().getProfiler();
profiler.start(ZipCodeBaseFactory.class);
try {
return new ZipFileCodeBase(codeBaseLocator, file);
} catch (ZipException e) {
// May be too many zip entries
return new ZipInputStreamCodeBase(codeBaseLocator, file);
} finally {
profiler.end(ZipCodeBaseFactory.class);
}
}
示例11: validate
import edu.umd.cs.findbugs.log.Profiler; //导入依赖的package包/类
public When validate(@CheckForNull Object constantValue) {
if (validator == null)
throw new IllegalStateException("No validator");
IAnalysisCache analysisCache = Global.getAnalysisCache();
Profiler profiler = analysisCache.getProfiler();
profiler.start(validator.getClass());
try {
return ValidationSecurityManager.sandboxedValidation(proxy, validator, constantValue);
} catch (Exception e) {
AnalysisContext.logError("Error executing custom validator for " + typeQualifier + " " + constantValue, e);
return When.UNKNOWN;
} finally {
profiler.end(validator.getClass());
}
}
示例12: getInheritedAnnotation
import edu.umd.cs.findbugs.log.Profiler; //导入依赖的package包/类
public @CheckForNull NullnessAnnotation getInheritedAnnotation(XMethod m, int parameter) {
Profiler profiler = Global.getAnalysisCache().getProfiler();
profiler.start(this.getClass());
try {
TypeQualifierAnnotation tqa
= TypeQualifierApplications.getInheritedTypeQualifierAnnotation(m,
parameter, nonnullTypeQualifierValue);
NullnessAnnotation result = toNullnessAnnotation(tqa);
return result;
} finally {
profiler.end(this.getClass());
}
}
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:14,代码来源:TypeQualifierNullnessAnnotationDatabase.java
示例13: getDirectAnnotation
import edu.umd.cs.findbugs.log.Profiler; //导入依赖的package包/类
public @CheckForNull NullnessAnnotation getDirectAnnotation(Object o) {
Profiler profiler = Global.getAnalysisCache().getProfiler();
profiler.start(this.getClass());
try {
if (DEBUG) {
System.out.println("getDirectAnnotation: o=" + o + "...");
}
TypeQualifierAnnotation tqa = null;
if (o instanceof XMethodParameter) {
XMethodParameter param = (XMethodParameter) o;
tqa = TypeQualifierApplications.getDirectTypeQualifierAnnotation(param.getMethod(),
param.getParameterNumber(), nonnullTypeQualifierValue);
} else if (o instanceof XMethod || o instanceof XField) {
tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation((AnnotatedObject) o,
nonnullTypeQualifierValue);
}
NullnessAnnotation result = toNullnessAnnotation(tqa);
if (DEBUG) {
if (result == null)
System.out.println(" ===> not found");
else
System.out.println(" ===> " + tqa + "/" + result.toString() );
}
return result;
} finally {
profiler.end(this.getClass());
}
}
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:33,代码来源:TypeQualifierNullnessAnnotationDatabase.java
示例14: reportResultsToConsole
import edu.umd.cs.findbugs.log.Profiler; //导入依赖的package包/类
/**
* If there is a FB console opened, report results and statistics to it.
*/
private void reportResultsToConsole() {
if (!isStreamReportingEnabled()) {
return;
}
printToStream("Finished, found: " + bugCount + " bugs");
ConfigurableXmlOutputStream xmlStream = new ConfigurableXmlOutputStream(stream, true);
ProjectStats stats = bugCollection.getProjectStats();
printToStream("\nFootprint: " + new Footprint(stats.getBaseFootprint()).toString());
Profiler profiler = stats.getProfiler();
PrintStream printStream;
try {
printStream = new PrintStream(stream, false, "UTF-8");
} catch (UnsupportedEncodingException e1) {
// can never happen with UTF-8
return;
}
printToStream("\nTotal time:");
profiler.report(new Profiler.TotalTimeComparator(profiler), new Profiler.FilterByTime(10000000), printStream);
printToStream("\nTotal calls:");
int numClasses = stats.getNumClasses();
if(numClasses > 0) {
profiler.report(new Profiler.TotalCallsComparator(profiler), new Profiler.FilterByCalls(numClasses),
printStream);
printToStream("\nTime per call:");
profiler.report(new Profiler.TimePerCallComparator(profiler),
new Profiler.FilterByTimePerCall(10000000 / numClasses), printStream);
}
try {
xmlStream.finish();
} catch (IOException e) {
FindbugsPlugin.getDefault().logException(e, "Print to console failed");
}
}
示例15: getProfiler
import edu.umd.cs.findbugs.log.Profiler; //导入依赖的package包/类
public Profiler getProfiler() {
return bugReporter.getProjectStats().getProfiler();
}