Skip to content
This repository has been archived by the owner on Mar 14, 2019. It is now read-only.

UseCases

zhongl edited this page Jun 21, 2012 · 1 revision

loaded

housemd> loaded String
java.lang.String -> /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/rt.jar

Display source path of java.lang.String.

housemd> loaded -h ScalaObject
scala.ScalaObject -> /home/housemd/housemd.jar
    - com.github.zhongl.housemd.Duck$1@1e859c0
        - sun.misc.Launcher$AppClassLoader@1cde100
            - sun.misc.Launcher$ExtClassLoader@16f0472

Display source path of scala.ScalaObject and it's ClassLoader hierarchies.

Caution: BootClassLoader will not show up, because it is null.

trace

housemd> trace -t 2 TraceTarget$A.m
INFO : probe class TraceTarget$A
TraceTarget$A.m(int, String)    TraceTarget$CL@42719c            0            -ms    [Static Method]
TraceTarget$A.m(String)         TraceTarget$CL@42719c            2            3ms    TraceTarget$A@401369

TraceTarget$A.m(int, String)    TraceTarget$CL@42719c            0            -ms    [Static Method]
TraceTarget$A.m(String)         TraceTarget$CL@42719c            4            1ms    TraceTarget$A@401369

INFO : Ended by timeout
INFO : reset class TraceTarget$A

Trace invocations of TraceTarget$A.m in next 2 seconds.

The columns of each line is: method full name, classloader, total invoked times, average elapse millis, self-instance(or static method)

housemd> trace -l 4 TraceTarget$D+.mD1
INFO : probe class TraceTarget$D
TraceTarget$D.mD1(int)    TraceTarget$CL@42719c            2           <1ms    TraceTarget$B@80cac9

INFO : Ended by overlimit
INFO : reset class TraceTarget$D

Trace next 4 times invocation of TraceTarget$D.mD1

housemd> trace -i 4 TraceTarget$D+
INFO : probe class TraceTarget$D
INFO : probe class TraceTarget$B
TraceTarget$B.mC(String)       TraceTarget$CL@42719c            8           <1ms    TraceTarget$B@80cac9
TraceTarget$B.mD2(int, int)    TraceTarget$CL@42719c            8           <1ms    TraceTarget$B@80cac9
TraceTarget$D.mD1(int)         TraceTarget$CL@42719c            8           <1ms    TraceTarget$B@80cac9

TraceTarget$B.mC(String)       TraceTarget$CL@42719c           16           <1ms    TraceTarget$B@80cac9
TraceTarget$B.mD2(int, int)    TraceTarget$CL@42719c           16           <1ms    TraceTarget$B@80cac9
TraceTarget$D.mD1(int)         TraceTarget$CL@42719c           16           <1ms    TraceTarget$B@80cac9

INFO : Ended by timeout
INFO : reset class TraceTarget$D
INFO : reset class TraceTarget$B

Trace invocations of all declared methods of TraceTarget$D but display the summary statistics in every 4 seconds until timeout or overlimit.

housemd> trace -d TraceTarget.addOne TraceTarget$A
......
INFO : You can get invocation detail from /tmp/trace/19987@hostname/detail

Trace invocation of TraceTarget.addOne and all declared methods of TraceTarget$A

-d option enable to output more invocation detail logs to a file

The detail file looks like:

2012-06-14 14:38:29 8ms [main] null TraceTarget.addOne [0] 1
2012-06-14 14:38:29 2ms [main] TraceTarget$A@995a79 TraceTarget$A.m [123] void
2012-06-14 14:38:30 0ms [main] null TraceTarget.addOne [0] 1
2012-06-14 14:38:30 0ms [main] TraceTarget$A@995a79 TraceTarget$A.m [123] void

The columns of each line is: date, time, elapse, call thread, self instance, method full name, arguments, return(or exception)

housemd> trace -s TraceTarget.addOne
......
INFO : You can get invocation stack from /tmp/trace/19987@hostname/stack

-s option enable to output invocation stack traces to a file

The stack file looks like:

TraceTarget.addOne(Integer) call by thread [main]
    TraceTarget.main(TraceTarget.java:42)

env

housemd> env USER
USER = housemd

Display system enviroment USER

housemd> env -e T.*
TERM                = xterm
TYPESAFE_STACK_HOME = /home/housemd/

Display system enviroments which key starts with T

inspect

housemd> inspect -l 1 TraceTarget$B.s
INFO : Probe class TraceTarget$B
TraceTarget$B.s 123 TraceTarget$B@1687e7c TraceTarget$CL@42719c

INFO : Ended by overlimit
INFO : Reset class TraceTarget$B

Display the value of field named s, which belongs to instance of TraceTarget$B

The columns of each line is: field full name, value, self instance, classloader

More infomation by typing help <command>.

Clone this wiki locally