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


Java ProjectStats类代码示例

本文整理汇总了Java中edu.umd.cs.findbugs.ProjectStats的典型用法代码示例。如果您正苦于以下问题:Java ProjectStats类的具体用法?Java ProjectStats怎么用?Java ProjectStats使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProjectStats类属于edu.umd.cs.findbugs包,在下文中一共展示了ProjectStats类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: union

import edu.umd.cs.findbugs.ProjectStats; //导入依赖的package包/类
static public SortedBugCollection union(SortedBugCollection origCollection, SortedBugCollection newCollection) {

        SortedBugCollection result = origCollection.duplicate();

        for (Iterator<BugInstance> i = newCollection.iterator(); i.hasNext();) {
            BugInstance bugInstance = i.next();
            result.add(bugInstance);
        }
        ProjectStats stats = result.getProjectStats();
        ProjectStats stats2 = newCollection.getProjectStats();
        stats.addStats(stats2);

        Project project = result.getProject();
        project.add(newCollection.getProject());

        return result;
    }
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:18,代码来源:MergeSummarizeAndView.java

示例2: merge

import edu.umd.cs.findbugs.ProjectStats; //导入依赖的package包/类
static public void merge(HashSet<String> hashes, SortedBugCollection into, SortedBugCollection from) {

        for (BugInstance bugInstance : from.getCollection()) {
            if (hashes == null || hashes.add(bugInstance.getInstanceHash()))
                into.add(bugInstance);
        }
        ProjectStats stats = into.getProjectStats();
        ProjectStats stats2 = from.getProjectStats();
        stats.addStats(stats2);

        Project project = into.getProject();
        Project project2 = from.getProject();
        project.add(project2);

        for(AnalysisError error : from.getErrors())
            into.addError(error);

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

示例3: setUp

import edu.umd.cs.findbugs.ProjectStats; //导入依赖的package包/类
@Override
public void setUp() {
    projectStats = new ProjectStats();
    bugCollection = new SortedBugCollection(projectStats);
    plugin = new CloudPluginBuilder().setCloudid("myAbstractCloud").setClassLoader(this.getClass().getClassLoader())
            .setCloudClass(MyAbstractCloud.class).setUsernameClass(NoNameLookup.class).setProperties(new PropertyBundle())
            .setDescription("no description").setDetails("no details").createCloudPlugin();
    cloud = new MyAbstractCloud(plugin, bugCollection, new Properties());
    summary = new StringWriter();
    timestampCounter = 0;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:12,代码来源:AbstractCloudTest.java

示例4: createSummary

import edu.umd.cs.findbugs.ProjectStats; //导入依赖的package包/类
private void createSummary(ProjectStats stats) throws IOException {
    StringWriter html = new StringWriter();
    try {
        stats.transformSummaryToHTML(html);
        summary = html.toString();
    } catch (Exception e) {
        logger.logMessage(ConsoleLogger.WARNING, MessageFormat.format(L10N.getLocalString("msg.failedtotransform_txt", "Failed to transform summary: {0}"), new Object[]{e.toString()}));
        summary = MISSING_SUMMARY_MESSAGE;
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:11,代码来源:AnalysisRun.java

示例5: reportResultsToConsole

import edu.umd.cs.findbugs.ProjectStats; //导入依赖的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

示例6: reportExtraData

import edu.umd.cs.findbugs.ProjectStats; //导入依赖的package包/类
@SuppressWarnings("boxing")
private void reportExtraData(AnalysisData data) {
    SortedBugCollection bugCollection = reporter.getBugCollection();
    if(bugCollection == null) {
        return;
    }
    if (FindBugsConsole.getConsole() == null) {
        return;
    }
    IOConsoleOutputStream out = FindBugsConsole.getConsole().newOutputStream();
    PrintWriter pw = new PrintWriter(out);

    ProjectStats stats = bugCollection.getProjectStats();
    Footprint footprint = new Footprint(stats.getBaseFootprint());
    Profiler profiler = stats.getProfiler();
    Profile profile = profiler.getProfile(ClassDataAnalysisEngine.class);
    long totalClassReadTime = TimeUnit.MILLISECONDS.convert(profile.getTotalTime(), TimeUnit.NANOSECONDS);
    long totalTime = TimeUnit.MILLISECONDS.convert(footprint.getClockTime(), TimeUnit.MILLISECONDS);

    double classReadSpeed = totalClassReadTime > 0? data.byteSize * 1000.0 / totalClassReadTime : 0;
    double classCountSpeed = totalTime > 0? data.classCount * 1000.0 / totalTime : 0;
    double classPart = totalTime > 0? totalClassReadTime * 100.0 / totalTime : 0;
    double appPart = data.byteSize > 0? data.byteSizeApp * 100.0 / data.byteSize : 0;
    double bytesPerClass = data.classCount > 0? ((double) data.byteSize)  / data.classCount : 0;
    long peakMemory = footprint.getPeakMemory() / (1024 * 1024);
    pw.printf("%n");
    pw.printf("Total bugs            : %1$ 20d %n", stats.getTotalBugs());
    pw.printf("Peak memory (MB)      : %1$ 20d %n", peakMemory);
    pw.printf("Total classes         : %1$ 20d %n", data.classCount);
    pw.printf("Total time (msec)     : %1$ 20d %n", totalTime);
    pw.printf("Class read time (msec): %1$ 20d %n", totalClassReadTime);
    pw.printf("Class read time (%%)   : %1$ 20.0f %n", classPart);
    pw.printf("Total bytes read      : %1$ 20d %n", data.byteSize);
    pw.printf("Application bytes     : %1$ 20d %n", data.byteSizeApp);
    pw.printf("Application bytes (%%) : %1$ 20.0f %n", appPart);
    pw.printf("Avg. bytes per class  : %1$ 20.0f %n", bytesPerClass);
    pw.printf("Analysis class/sec    : %1$ 20.0f %n", classCountSpeed);
    pw.printf("Read     bytes/sec    : %1$ 20.0f %n", classReadSpeed);
    pw.printf("            MB/sec    : %1$ 20.1f %n", classReadSpeed / (1024 * 1024));
    pw.flush();

    pw.close();

}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:45,代码来源:FindBugs2Eclipse.java


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