This file contains 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
set terminal png small size 1024, 1024 | |
set output "memory_usage.png" | |
set title "JVM memory usage" | |
set ylabel "usage (MB)" | |
plot "jvm_usage.dat" using 2 title "JVM memory usage", \ | |
"jvm_usage.dat" using 3 title "JVM memory total", \ | |
"task_completion.dat" using 1:2:xticlabels(3) | |
set title "OS memory usage" |
This file contains 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
fun Long.readable(): String { | |
if (this < 1024) return "${this}B" | |
val z = (63 - countLeadingZeroBits()) / 10 | |
return "%.1f%sB".format(toDouble() / (1L shl z * 10), " KMGTPE"[z]) | |
} | |
class MemoryStatusListener : | |
org.gradle.process.internal.health.memory.JvmMemoryStatusListener, | |
org.gradle.process.internal.health.memory.OsMemoryStatusListener { | |
var jvmStatus: JvmMemoryStatus? = null |
This file contains 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
//https://www.ne.jp/asahi/hishidama/home/tech/java/Buffer.html#h_CharsetDecoder | |
val input = "0あいう" + | |
ubyteArrayOf(0xE9U, 0x82U, 0x8AU, 0xF3U, 0xA0U, 0x84U, 0x80U).toByteArray().toString(Charsets.UTF_8) + | |
ubyteArrayOf(0xF0U, 0x9FU, 0x98U, 0x8aU).toByteArray().toString(Charsets.UTF_8) | |
val stream = input.byteInputStream() | |
val decoder = Charsets.UTF_8.newDecoder() | |
val byteBuffer = ByteBuffer.allocate(4) | |
val charBuffer = CharBuffer.allocate(2) | |
var eof = false |
This file contains 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
// place this to buildSrc/main/kotlin/ProjectDependencyGraphTask.kt | |
// | |
// then use it in rootProject's build.gradle.kts | |
// | |
// val projectDependencyGraph by tasks.registering(ProjectDependencyGraphTask::class) | |
// | |
import org.gradle.api.DefaultTask | |
import org.gradle.api.Project | |
import org.gradle.api.artifacts.ProjectDependency |
This file contains 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 org.gradle.api.DefaultTask | |
import org.gradle.api.Project | |
import org.gradle.api.artifacts.ProjectDependency | |
import org.gradle.api.tasks.TaskAction | |
import java.util.* | |
import kotlin.collections.LinkedHashMap | |
import kotlin.collections.LinkedHashSet | |
@Suppress("unused") | |
open class ProjectDependencyGraphTask : DefaultTask() { |