This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* A small cpu and memory stress program | |
* compile: CC cpumem.cpp -o cpumem -lpthread | |
* or: make LDFLAGS=-lpthread cpumem | |
*/ | |
#include <pthread.h> | |
#include <iostream> | |
#include <vector> | |
#include <sys/types.h> | |
#include <assert.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collection.JavaConversions._ | |
import java.lang.management._ | |
val MB = (1024*1024).toFloat | |
def b2mb(bval: Long): Float = bval / MB | |
def mpoolSum(mp: MemoryPoolMXBean) = "%s: use %.2f comm %.2f max %.2f".format(mp.getName, b2mb(mp.getUsage.getUsed), b2mb(mp.getUsage.getCommitted), b2mb(mp.getUsage.getMax)) | |
def minfo = ManagementFactory.getMemoryPoolMXBeans.filter(_.getType == MemoryType.HEAP).map(mpoolSum).mkString("\n") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object PmapFilter { | |
case class Mr(start: Long, end: Long, desc: String) { | |
override def toString = | |
"%08x-%08x %6dk %s".format(start, end, (end-start)/1024, desc) | |
} | |
def process(path: String) : String = { | |
import scala.io.Source | |
def procMr(current: Mr, prevEnd: Long) = prevEnd match { | |
case 0 => current.toString | |
case x if prevEnd == current.start => current.toString |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prints address map with gap size between segment | |
* within a core file. This program uses readelf | |
* command and expects the output is same as the | |
* readelf on Linux. | |
*/ | |
object CoreAmap { | |
def main(args: Array[String]) { | |
for (a <- args) doAmapCore(a) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ~/local/jdk1.7.0-b147/fastdebug/bin/java -cp classes:lib/asm-4.0.jar name.yt.icache.Pet | |
D: bsm: type: (Object)void | |
D: bsm: fallback: MethodHandle(Object)void | |
D: bsm: fallback: MethodHandle(Object)void | |
D: fallback: type: (Object)void | |
D: fallback: type.dropParameterTypes(0,1): ()void | |
D: fallback: receiverClass: class name.yt.icache.Cat | |
D: fallback: target: MethodHandle(Cat)void | |
D: fallback: target after asType: MethodHandle(Object)void | |
D: fallback: test: MethodHandle(Object)boolean |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "JniEx.h" | |
#include <stdlib.h> | |
void bad_func() | |
{ | |
int *ip = (int*)0xbffffffe; | |
*ip = 1; | |
} | |
JNIEXPORT void JNICALL Java_JniEx_crash (JNIEnv *env, jclass cls) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ~/local/jdk1.7.0-b147/fastdebug/bin/java -XX:+Verbose -XX:+PrintEscapeAnalysis -jar ~/local/jdk1.6.0_26/demo/jfc/Java2D/Java2Demo.jar | |
VM option '+Verbose' | |
VM option '+PrintEscapeAnalysis' | |
======== Connection graph for java.util.Properties$LineReader::readLine | |
519 JavaObject GlobalEscape NSR [[ 578F 589F 623F 624F 452F 468F 469F 602F 606F]] 519 AllocateArray === 503 199 501 8 1 ( 517 506 512 505 10 438 281 22 65 22 384 68 22 1 1 ) [[ 520 521 522 529 530 531 ]] rawptr:NotNull ( int:>=0, java/lang/Object:NotNull *, bool, int ) java.util.Properties$LineReader::readLine @ bci:286 Type:{0:control, 1:abIO, 2:memory, 3:rawptr:BotPTR, 4:return_address, 5:rawptr:NotNull} !jvms: java.util.Properties$LineReader::readLine @ bci:286 | |
LocalVar [[ 519P]] 531 Proj === 519 [[ 532 536 ]] #5 Type:rawptr:NotNull !jvms: java.util.Properties$LineReader::readLine @ bci:286 | |
LocalVar [[ 519P]] 536 CheckCastPP === 533 531 [[ 655 678 655 624 578 578 589 589 624 623 ]] Type:char[i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C1 | |
$ ~/jdk1.7.0-b147/fastdebug/bin/java -XX:CompileOnly=gvnex::doHashSum -XX:+PrintLIR -client gvnex | |
VM option 'CompileOnly=gvnex::doHashSum' | |
VM option '+PrintLIR' | |
CompileOnly: compileonly *gvnex*.doHashSum | |
LIR: | |
B1 [0, 0] sux: B0 | |
__id_Instruction___________________________________________ | |
0 label [label:0x939c62c] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -XX::CompileOnly=sum::doit would narrow down the method to compile, but it | |
// is not used here. | |
$ ~/jdk1.7.0-b147/fastdebug/bin/java -XX:+PrintOptoAssembly sum | |
VM option '+PrintOptoAssembly' | |
{method} | |
- klass: {other class} | |
- this oop: 0x911f8110 | |
- method holder: 'sum' | |
- constants: 0x911f7e10 constant pool [32] for 'sum' cache=0x911f86b0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int doit(); | |
flags: ACC_STATIC | |
Code: | |
stack=2, locals=2, args_size=0 | |
0: iconst_0 | |
1: istore_0 | |
2: iconst_0 | |
3: istore_1 | |
4: iload_1 | |
5: bipush 100 |