All Projects → jcdavis → darkseer

jcdavis / darkseer

Licence: Apache-2.0 license
Experimental JVM profiler for analyzing real-world memory allocations

Programming Languages

c
50402 projects - #5 most used programming language
java
68154 projects - #9 most used programming language
Makefile
30231 projects

Labels

Projects that are alternatives of or similar to darkseer

play-scala-seed.g8
Play Scala Seed Template: run "sbt new playframework/play-scala-seed.g8"
Stars: ✭ 66 (+407.69%)
Mutual labels:  jvm
mini-jvm
Go语言实现的JVM,实现了部分字节码的解释执行,学习JVM使用
Stars: ✭ 29 (+123.08%)
Mutual labels:  jvm
pikt
🎨 Image-based poetic programming language.
Stars: ✭ 72 (+453.85%)
Mutual labels:  jvm
backlog-board
This is Kanban Board connected to Backlog
Stars: ✭ 18 (+38.46%)
Mutual labels:  jvm
play-java-rest-api-example
REST API using Play in Java
Stars: ✭ 44 (+238.46%)
Mutual labels:  jvm
rake
A Java library for Rapid Automatic Keyword Extraction (RAKE) 🍂
Stars: ✭ 23 (+76.92%)
Mutual labels:  jvm
scalecube-config
ScaleCube Config is a configuration access management library for JVM based distributed applications
Stars: ✭ 15 (+15.38%)
Mutual labels:  jvm
turtle
Run shell commands from a Kotlin script or application with ease
Stars: ✭ 128 (+884.62%)
Mutual labels:  jvm
Java-CS-Record
记录准备春招实习过程中,学习与复习的知识(模块化整理,非面试题速成)。注:暂停更新,后续请移步博客
Stars: ✭ 73 (+461.54%)
Mutual labels:  jvm
Latte-lang
100% Java compatibility and Functional Programming.
Stars: ✭ 128 (+884.62%)
Mutual labels:  jvm
imgui-java
JNI based binding for Dear ImGui
Stars: ✭ 270 (+1976.92%)
Mutual labels:  jvm
hello-kotlin-multiplatform
Multiplatform Kotlin Hello World (Android/Java/JavaScript)
Stars: ✭ 64 (+392.31%)
Mutual labels:  jvm
library-template-jvm
A Kotlin/JVM library template (with a sample project).
Stars: ✭ 46 (+253.85%)
Mutual labels:  jvm
etebase-java
A Java/Android client library for Etebase
Stars: ✭ 46 (+253.85%)
Mutual labels:  jvm
jvm-dump-proxy
A proxy DLL for Windows to dump JVM classes at JNI level
Stars: ✭ 53 (+307.69%)
Mutual labels:  jvm
hsbeat
Beat for Java HotSpot VM
Stars: ✭ 24 (+84.62%)
Mutual labels:  jvm
ark-java
Library for interacting with an Ark Ecosystem Blockchain using the JVM.
Stars: ✭ 15 (+15.38%)
Mutual labels:  jvm
gctoolkit
Tool for parsing GC logs
Stars: ✭ 1,127 (+8569.23%)
Mutual labels:  jvm
2p-kt
A Kotlin Multi-Platform ecosystem for symbolic AI
Stars: ✭ 52 (+300%)
Mutual labels:  jvm
generator-jvm
Generate JVM (java, kotlin, scala) project with gradle / maven / sbt build systems and docker / docker-compose for rapid development
Stars: ✭ 40 (+207.69%)
Mutual labels:  jvm

Darkseer

Darkseer is an experimental JVM profiler for analyzing actual memory allocations in a thread. It may be of interest to people looking to analyze the real-world memory usage of c2 compiled methods, free from the interference that comes from bytecode manipulating profilers and without having to use commercial features of the Oracle JDK (eg JFR). For more background on how it works, read my blog post.

This should be considered to be a proof of concept for the curious only.

Warning

Darkseer works by taking advantage of specific register allocation and memory layout of recent builds of OpenJDK on x86-64 to read internal JVM state. These assumptions are not likely to work on other JDKs, or even older versions of OpenJDK. These access patterns are very non-kosher and are likely to cause the JVM to crash. Don't run this anywhere you can't tolerate a JVM crash (ie any production deployment).

Building

The only requirements for building Darkseer are having clang/gcc and JAVA_HOME configured to point to an installed jdk. To build, run make demo, which will build both the agent as well as the interface jar, and then run a simple demo.

If you are modifying the signature of the native methods, running make stubs will create a generated header file in target with the correct function definitions

Running

To run, pass -agentpath:path/to/ldsagent.so to java and make sure darkseer.jar in on your classpath (see the demo in the Makefile). You start recording via DarkSeer.start() and stop with DarkSeer.end(), which will print out the total number of bytes allocated as well and the class and size of every allocated object, with controllable object content printing. (0 disables all output - 3 prints all objects)

If you have scala installed, make scalarepl will start a scala repl with correct agent/classpath params. If you have java 9+, make jshell will start a java repl with the correct agent/classpath params.

Limitations

Here are just a few:

  • Darkseer is fragile and only has basic sanity checks. Some GC events will cause it to crash the JVM (Somewhat fixable)
  • We can only look at allocations in a single TLAB slice. This is a fundamental limitation, but can be somewhat circumvented via increasing the TLAB size using -XX:MinTLABSize=
  • Some large objects will not be allocated in the TLAB. Darkseer can detect that this has happened, but cannot identify those alocations (unfixable)
  • Darkseer can only record allocations for the thread that called it (unfixable)
  • Darkseer can only record allocations for a single thread at a time (fixable)
  • No stack traces of allocations can be provided (likely unfixable)
  • Output is currently just printed to stdout (fixable)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].