How to trace a java-program

|
As a sysadmin I sometimes face situations, where a program behaves abnormally, while not creating errors at all or creating nonsense error-messages. In the past - before java came in - there were two counter-measures:
I usually use Are there better ways to do that (if the source-code is not available)? |
|||
|
As ckhan mentioned, Another useful tool is
This heap dump can be loaded in tools like Another tool, Finally, it is possible to use a Java Agent to push instrumentation on all methods of all objects at load-time. The library My Suggestion - start with VisualVM and see if that tells you what you need to know since it can show the current threads and important stats for the JVM. |
|||||
|

|
In the same vain when debugging programs that have gone awry on a Linux system you can use similar tools to debug running JVMs on your system. Tool #1 - jvmtopSimilar to
Its output is similarly styled to look like the tool
Tool #2 - jvmmonitorAnother alternative is to use jvmmonitor. JVM Monitor is a Java profiler integrated with Eclipse to monitor CPU, threads and memory usage of Java applications. You can either use it to automatically find running JVMs on the localhost or it can connect to remote JVMs using a port@host.
Tool #3 - visualvmvisualvm is probably "the tool" to reach for when debugging issues with the JVM. Its feature set is pretty deep and you can get a very in depth look at the innards. Profile application performance or analyze memory allocation:
Take and display thread dumps:
References |
|||
|
Consider See also the suggestions at this SO article: http://stackoverflow.com/questions/1025681/call-trace-in-java |
||||
|
If you are using RHEL OpenJDK (or similiar, the point is that it is not Oracle's JDK), you may use SystemTap for that. Some probes are enabled by using java command line options Here is example SystemTap Script:
You can also use Note that SystemTap will trace every method. It is also not able to get method's arguments. Another option is to use JVM own capabilities of tracing which is called JVMTI. One of the most famous JVMTI implementations is BTrace. |
How to trace a java-program的更多相关文章
- Core Java Volume I — 3.1. A Simple Java Program
Let’s look more closely at one of the simplest Java programs you can have—one that simply prints a m ...
- Java program to find the largest element in array
Java program to find the largest element in array Given an array of numbers, write a java program to ...
- jstack(Stack Trace for Java)
功能 用于生成虚拟机当前时刻的线程快照(一般称为threaddump或javacore文件).线程快照就是当前虚拟机内每一条线程正在执行的方法堆栈的集合,生成线程快照的主要目的是定位线程出现长时间 ...
- 2013.11.7-21:15_My first Java program
- Caused by: java.lang.NoSuchFieldError: TRACE
Caused by: java.lang.NoSuchFieldError: TRACE at org.slf4j.impl.Log4jLoggerAdapter.trace(Log4jLoggerA ...
- How to Create a Java Concurrent Program
In this Document Goal Solution Overview Steps in writing Java Concurrent Program Template ...
- Spark-HBase集成错误之 java.lang.NoClassDefFoundError: org/htrace/Trace
在进行Spark与HBase 集成的过程中遇到以下问题: java.lang.IllegalArgumentException: Error while instantiating 'org.apac ...
- 编写一个应用程序,利用数组或者集合, 求出"HELLO",“JAVA”,“PROGRAM”,“EXCEPTION”四个字符串的平均长度以及字符出现重复次数最多的字符串。
public class Number { public static void main(String[] args) { String[] arr = { "HELLO", & ...
- Java性能提示(全)
http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...
- [Java Basics] Stack, Heap, Constructor, I/O, Immutable, ClassLoader
Good about Java: friendly syntax, memory management[GC can collect unreferenced memory resources], o ...
随机推荐
- 解决在HTTPS页面里嵌套HTTP页面浏览器block的问题
问题描述: 浏览器默认是不允许在HTTPS里面引用HTTP页面的,ie下面会弹出提示框提示是否显示不安全的内容,一般都会弹出提示框,用户确认后才会继续加载,但是chrome下面直接被block掉,只在 ...
- vs2010 使用SignalR 提高B2C商城用户体验(一)
vs2010 使用SignalR 提高B2C商城用户体验(一) 1.需求简介,做为新时代的b2c商城,没有即时通讯,怎么提供用户粘稠度,怎么增加销量,用户购物的第一习惯就是咨询,即时通讯,应运而生.这 ...
- 【产品体验】喵街&飞凡
最近O2O很火啊,我也来找几个O2O产品体验下~~~ 阿里今年5月30号上线了一款线下逛街App——喵街,号称消费者的逛街神器.阿里去年已经与银泰合作一年,探索互联网和传统实体零售合作之路,这次则免费 ...
- 关于Matlab作图的若干问题
看到了北京一则新闻,想到如何测试双向镜子?百度之. 只要做以下简单的测试:把你的指甲尖放在镜子表面,如果在指甲尖与倒映图像之间有间隙,那就是真的镜子.然而,如果你 ...
- ANDROID_MARS学习笔记_S04_004_用HTTPCLENT发带参数的get和post请求
一.代码 1.xml(1)activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/r ...
- EMMC 简要介绍
一直想写一篇关于EMMC的文章,但是因为之前弄了很多PPT,所以一直提不起兴趣,索性直接把之前的一个介绍EMMC的PPT贴出来给大家看看,有什么问题可以直接跟帖,我会第一时间进行解答,谢谢
- Android之获得内存剩余大小与总大小
方法一: 如何查看android对应用的内存限制 每款手机对应用的限制都是不一样的,毕竟硬件不同,我们可以使用如下方式来查看单独的应用可使用的最大内存: 执行命令: adb shell getprop ...
- Android应用开发性能优化完全分析
1 背景 其实有点不想写这篇文章的,但是又想写,有些矛盾.不想写的原因是随便上网一搜一堆关于性能的建议,感觉大家你一总结.我一总结的都说到了很多优化注意事项,但是看过这些文章后大多数存在一个问题就是只 ...
- poj1286
等价类计数问题,我们就先构造置换群 显然置换分为两种类型,旋转和翻折 先考虑旋转,每旋转i格子,这个置换的循环数为gcd(i,n); (1<=i<=n) 为什么是这个范围,下篇报告再说 翻 ...
- 学以致用:让visualstudio爱上sublime
前言: 经常在vs中工作,但是一些编辑工作却非常喜欢sublime的方式,如果你也是,那我们来当媒婆吧,哈哈. 准备: Visualstudio一枚 Sublime一枚 ...


