有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Java获取运行时信息

我需要知道如何获取运行时的历史记录。我需要获得关于每个线程、它所使用的每个类、每个方法和创建的每个对象的信息。类似调试器的东西。只是我需要一个文件中的所有信息。有人能帮我吗


共 (1) 个答案

  1. # 1 楼答案

    你可能需要探索一下JVM TI APIs

    The JVM tool interface (JVM TI) is a native programming interface for use by tools. It provides both a way to inspect the state and to control the execution of applications running in the Java virtual machine (JVM). JVM TI supports the full breadth of tools that need access to JVM state, including but not limited to: profiling, debugging, monitoring, thread analysis, and coverage analysis tools.

    Note: JVM TI was introduced at JDK 5.0. JVM TI replaces the Java Virtual Machine Profiler Interface (JVMPI) and the Java Virtual Machine Debug Interface (JVMDI) which, as of JDK 6, are no longer provided.

    VisualVM这样的调试器使用这个接口来了解JVM和不同的统计信息