当前位置: 首页>>代码示例>>Java>>正文


Java Profiler类代码示例

本文整理汇总了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());
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:29,代码来源:AnalysisCache.java

示例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());

    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:25,代码来源:TypeQualifierValue.java

示例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);
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:36,代码来源:ResourceTrackingDetector.java

示例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;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:34,代码来源:ObligationDataflowFactory.java

示例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);
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:10,代码来源:ZipCodeBaseFactory.java

示例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());
        }
    }
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:16,代码来源:DetectorToDetector2Adapter.java

示例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());
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:34,代码来源:TypeQualifierNullnessAnnotationDatabase.java

示例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();
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:11,代码来源:ProjectStats.java

示例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);
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:11,代码来源:TopologicalSort.java

示例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);
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:13,代码来源:ZipCodeBaseFactory.java

示例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());
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:16,代码来源:TypeQualifierValue.java

示例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");
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:42,代码来源:Reporter.java

示例15: getProfiler

import edu.umd.cs.findbugs.log.Profiler; //导入依赖的package包/类
public Profiler getProfiler() {
    return bugReporter.getProjectStats().getProfiler();
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:4,代码来源:AnalysisCache.java


注:本文中的edu.umd.cs.findbugs.log.Profiler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。