• Perf4J


    Perf4J是一个用于记录、监测和分析Java应用程序性能的开源工具。如同log4j类似于System.out.println()一样,Perf4J类似于System.currentTimeMillis()。

     Perf4J提供的功能包括: 用于计时的简单的停止观测(stop watch)机制。

       1. 用于解析日志文件的命令行工具,可以生成聚合统计和性能图表
       2. 易于与常见的日志框架和facades集成:log4j、java.util.logging、Apache Commons Logging及SLF4J。
       3. 运行时自定义log4j appender 产生统计数据和图表
       4. 可以将性能统计暴露为JMX属性,当统计超出指定极限时发送通知。
       5. 用于展现Web应用性能图表的Servlet。
       6. 提供了@Profiled注解和一套客户化的方面(aspect),在处理AOP框架如AspectJ或Spring AOP时可以灵活插入计时语句。


    Perf4J is a set of utilities for calculating and displaying perfomance statistics for Java code. For developers who are familiar with logging frameworks such as log4j or java.util.logging, an analogy helps to describe Perf4J:

    Perf4J is to System.currentTimeMillis() as log4j is to System.out.println()

    How is this relevant to Perf4J? Consider that before good logging frameworks were widely available, developers new to Java would often print debugging statements using System.out.println(). Later they would discover they wanted log statements to go to a dedicated file, perhaps a log file that was rolled daily. Then they would discover they wanted finer control of which log statements would be written, and they wanted it to be possible to only have some log statements written in some environments without changing any code. Thus, the full set of features that log4j provides comes out of the original desire to have a "better" System.out.println() for logging statements.

    Similarly, when new Java developers discover that they need to time specified blocks of code for performance logging and monitoring reasons, they often do something like this:

    long start = System.currentTimeMillis();

    // execute the block of code to be timed

    System.out.println("ms for block n was: " + (System.currentTimeMillis() - start));


    Later on, though, these developers find they want more information, such as aggregated performance statistics like mean, minimum, maximum, standard deviation and transactions per second over a set time span. They would like graphs of these values in real time to detect problems on a running server, or they would like to expose performance metrics through JMX. In addition, they want their timing statements to work with the common logging frameworks like log4j.

    Perf4J provides these features and more:

        * A simple stop watch mechanism for succinct timing statements.
        * A command line tool for parsing log files that generates aggregated statistics and performance graphs.
        * Easy integration with the most common logging frameworks and facades: log4j, java.util.logging, Apache Commons Logging and SLF4J.
        * Custom log4j appenders to generate statistics and graphs in a running application (custom java.util.logging handlers coming soon).
        * The ability to expose performance statistics as JMX attributes, and to send notifications when statistics exceed specified thresholds.
        * A servlet for exposing performance graphs in a web application.
        * A Profiled annotation and a set of custom aspects that allow unobstrusive timing statements when coupled with an AOP framework such as AspectJ or Spring AOP.
        * An extensible architecture.

    点击次数   官方主页【官方主页】   下载地址【下载地址】

    网友留言/评论

    我要留言/评论

    相关开源项目

    JAMon:JAMon(Java应用程序监视器)是一个免费的,简单,高性能,线程安全的Java API.它让开发者可以方便地监控软件。JAMon用来测定程序的性能瓶颈,程序与用户的互动性和程序的可量测性。JAMon收集概要的统计数据比如执行时间(总的,平均的,最大的,最小的等),并发程序请求等。JAMon把这些统计数据以报表的形式展示出来。
    JBossProfiler:JBossProfiler是一个利用JVMPI系统基于log的剖析器。它使用一个C开发的代理从JVM捕获事件并把它们记录到磁盘中。一个运行在JBoss或其它机器上的Web应用程序可被用来分析这些日记。
    Basher: Basher是一个针对Java POJOs的分析和性能测试框架。适用于开发人员和测试人员使用,让他们能够快速,简便的进行线程测试,描述和衡量他们的代码在各种预先设定情景下的性能。
    JMemProf:JMemProf基于Web的内存剖析工具.JMemProf允许你撷取应用程序在运行时内存剖析信息.
    JTreeProfiler:一个基于JVMPI的Java剖析器。它在一个XML文件中收集所有方法被调用的记录并把它们展示TreeMap中。
    InfraRED:InfraRED是一个用AspectJ开发的监测J2EE应用程序性能和诊断性能问题的工具。
    BTrace: BTrace是一个实时监控工具,使用了java agent 和jvm attach技术,可以在不停机的情况下实时监控线上程序的运行情况。并且做到最少的侵入,占用最少的系统资源。 Btrace基于动态字节码修改技术(Hotswap)来实现运行时java程序的跟踪和替换。Btrace的脚本是用纯java编写的,基于一套官方提供的annotation,使跟踪逻辑实现起来非常简单。简单来说,就是能在不改动当前程序的情况下,运行时的去监控Java程序的执行状况,例如可以做到内存状况的监控、方法调用的监控等等。
    P6Spy:P6Spy用来记录JDBC调用的日记信息.
    JRat:JRat是一个Java Runtime分析工具包.它的目的是让开发者更好的明白Java程序动行时的状态.JRat包括但并不只局限于性能剖析.
    JMP:JMP是一个针对Java的剖析器.它被用来追踪对象的使用和计算method的运行时间.它利用JVMPI接口来收集统计信息并与JVM相结合.JMP使用一个GTK+接口来显示运行的状态.