Usage:
jinfo [option]
(to connect to running process)
jinfo [option]
(to connect to a core file)
jinfo [option] [server_id@]
(to connect to remote debug server)
where
is one of:
-flag to print the value of the named VM flag
-flag [+|-] to enable or disable the named VM flag
-flag = to set the named VM flag to the given value
-flags to print VM flags
-sysprops to print Java system properties
to print both of the above
-h | -help to print this help message
Usage:
jmap [option]
(to connect to running process)
jmap [option]
(to connect to a core file)
jmap [option] [server_id@]
(to connect to remote debug server)
where
is one of:
to print same info as Solaris pmap
-heap to print java heap summary
-histo[:live] to print histogram of java object heap; if the "live"
suboption is specified, only count live objects
-clstats to print class loader statistics
-finalizerinfo to print information on objects awaiting finalization
-dump: to dump java heap in hprof binary format
dump-options:
live dump only live objects; if not specified,
all objects in the heap are dumped.
format=b binary format
file= dump heap to
Example: jmap -dump:live,format=b,file=heap.bin
-F force. Use with -dump: or -histo
to force a heap dump or histogram when does not
respond. The "live" suboption is not supported
in this mode.
-h | -help to print this help message
-J to pass directly to the runtime system
执行如下命令:
> jmap -heap 14220
Mark Sweep Compact GC
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 104857600 (100.0MB)
NewSize = 34930688 (33.3125MB)
MaxNewSize = 34930688 (33.3125MB)
OldSize = 69926912 (66.6875MB)
NewRatio = 2
SurvivorRatio = 8
MetaspaceSize = 21807104 (20.796875MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 17592186044415 MB
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 31457280 (30.0MB)
used = 0 (0.0MB)
free = 31457280 (30.0MB)
0.0% used
Eden Space:
capacity = 27983872 (26.6875MB)
used = 0 (0.0MB)
free = 27983872 (26.6875MB)
0.0% used
From Space:
capacity = 3473408 (3.3125MB)
used = 0 (0.0MB)
free = 3473408 (3.3125MB)
0.0% used
To Space:
capacity = 3473408 (3.3125MB)
used = 0 (0.0MB)
free = 3473408 (3.3125MB)
0.0% used
tenured generation:
capacity = 69926912 (66.6875MB)
used = 725560 (0.6919479370117188MB)
free = 69201352 (65.99555206298828MB)
1.03759765625% used
1764 interned Strings occupying 157712 bytes.
Usage: jhat [-stack ] [-refs ] [-port ] [-baseline ] [-debug ] [-version] [-h|-help]
-J Pass directly to the runtime system. For
example, -J-mx512m to use a maximum heap size of 512MB
-stack false: Turn off tracking object allocation call stack.
-refs false: Turn off tracking of references to objects
-port : Set the port for the HTTP server. Defaults to 7000
-exclude : Specify a file that lists data members that should
be excluded from the reachableFrom query.
-baseline : Specify a baseline object dump. Objects in
both heap dumps with the same ID and same class will
be marked as not being "new".
-debug : Set debug level.
0: No debug output
1: Debug hprof file parsing
2: Debug hprof file parsing, no server
-version Report version number
-h|-help Print this help and exit
The file to read
For a dump file that contains multiple heap dumps,
you may specify which dump in the file
by appending "#" to the file name, i.e. "foo.hprof#3".
All boolean options default to "true"
> jmap -dump:format=b,file=test.bin 14220
Dumping heap to C:\Users\72419\Desktop\test.bin ...
Heap dump file created
然后使用jhat读入该文件,并分析:
> jhat test.bin
Reading from test.bin...
Dump file created Mon Sep 24 14:50:11 CST 2018
Snapshot read, resolving...
Resolving 10303 objects...
Chasing references, expect 2 dots..
Eliminating duplicate references..
Snapshot resolved.
Started HTTP server on port 7000
Server is ready.
> jstack -l 12432
......
"Thread-1" #12 prio=5 os_prio=0 tid=0x00000000195bd000 nid=0x5e90 waiting for monitor entry [0x000000001a20f000]
java.lang.Thread.State: BLOCKED (on object monitor)
at top.yeonon.ch10.DeadLockTest$DeadLock.run(DeadLockTest.java:29)
- waiting to lock <0x00000000d5fc0588> (a java.lang.String)
- locked <0x00000000d5fc05c0> (a java.lang.String)
Locked ownable synchronizers:
- None
"Thread-0" #11 prio=5 os_prio=0 tid=0x00000000195ba000 nid=0x5ed4 waiting for monitor entry [0x000000001a10f000]
java.lang.Thread.State: BLOCKED (on object monitor)
at top.yeonon.ch10.DeadLockTest$DeadLock.run(DeadLockTest.java:29)
- waiting to lock <0x00000000d5fc05c0> (a java.lang.String)
- locked <0x00000000d5fc0588> (a java.lang.String)
Locked ownable synchronizers:
- None
......
Found one Java-level deadlock:
=============================
"Thread-1":
waiting to lock monitor 0x000000000357ccf8 (object 0x00000000d5fc0588, a java.lang.String),
which is held by "Thread-0"
"Thread-0":
waiting to lock monitor 0x000000000357b858 (object 0x00000000d5fc05c0, a java.lang.String),
which is held by "Thread-1"
Java stack information for the threads listed above:
===================================================
"Thread-1":
at top.yeonon.ch10.DeadLockTest$DeadLock.run(DeadLockTest.java:29)
- waiting to lock <0x00000000d5fc0588> (a java.lang.String)
- locked <0x00000000d5fc05c0> (a java.lang.String)
"Thread-0":
at top.yeonon.ch10.DeadLockTest$DeadLock.run(DeadLockTest.java:29)
- waiting to lock <0x00000000d5fc05c0> (a java.lang.String)
- locked <0x00000000d5fc0588> (a java.lang.String)
Found 1 deadlock.
信息比较多,而且我已经省略了一些,主要看Found one Java-level deadlock后面的内容吧,这说明Jstack发现了一个死锁,并且将死锁相关的线程堆栈信息打印出来了,从上面可以看到“Thread-1”线程拿到了<0x00000000d5fc05c0>锁,正在等待 <0x00000000d5fc0588>锁,“Thread-0”拿着<0x00000000d5fc0588>锁,正在等待 <0x00000000d5fc05c0>,显然就是死锁了,同时看堆栈可以看到问题发生在DeadLockTest.java:29,即该类的29行出现问题(虽然这个值不一定完全对应源码位置,但基本相差不大,也算是有用的信息),接下来就是到源码相应的位置去分析代码了。
public class BTraceTest {
public int add(int a, int b) {
return a + b;
}
public static void main(String[] args) {
BTraceTest bTraceTest = new BTraceTest();
Scanner scanner = new Scanner(System.in);
for (int i = 0; i < 10; i++) {
scanner.nextLine();
int a = (int) Math.round(Math.random() * 1000);
int b = (int) Math.round(Math.random() * 1000);
System.out.println(bTraceTest.add(a, b));
}
}
}
/* BTrace Script Template */
import com.sun.btrace.annotations.*;
import static com.sun.btrace.BTraceUtils.*;
@BTrace
public class TracingScript {
/* put your code here */
@OnMethod(clazz="top.yeonon.ch10.BTraceTest", method="add", location=@Location(Kind.RETURN))
public static void func(@Self top.yeonon.ch10.BTraceTest instance, int a, int b, @Return int result) {
println("调用堆栈:");
jstack();
println(strcat("方法参数A:",str(a)));
println(strcat("方法参数B:",str(b)));
println(strcat("返回值result:",str(result)));
}
}
1、网络上现成的资料
格式: sed -i "s/查找字段/替换字段/g" `grep 查找字段 -rl 路径`
linux sed 批量替换多个文件中的字符串
sed -i "s/oldstring/newstring/g" `grep oldstring -rl yourdir`
例如:替换/home下所有文件中的www.admi
对于AJAX应用(使用XMLHttpRequests)来说,向服务器发起请求的传统方式是:获取一个XMLHttpRequest对象的引用、发起请求、读取响应、检查状态码,最后处理服务端的响应。整个过程示例如下:
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange
Hive中的排序语法 2014.06.22 ORDER BY
hive中的ORDER BY语句和关系数据库中的sql语法相似。他会对查询结果做全局排序,这意味着所有的数据会传送到一个Reduce任务上,这样会导致在大数量的情况下,花费大量时间。
与数据库中 ORDER BY 的区别在于在hive.mapred.mode = strict模式下,必须指定 limit 否则执行会报错。
post-commit hook failed (exit code 1) with output:
svn: E155004: Working copy 'D:\xx\xxx' locked
svn: E200031: sqlite: attempt to write a readonly database
svn: E200031: sqlite: attempt to write a