Используем время JVM
This commit is contained in:
parent
244f6e3461
commit
c7980d9068
@ -363,7 +363,7 @@ class StarboundClient(val starbound: Starbound) : Closeable {
|
||||
return true
|
||||
}
|
||||
|
||||
val measure = GLFW.glfwGetTime()
|
||||
val measure = JVMTimeSource.INSTANCE.seconds
|
||||
|
||||
if (frameRenderTime != 0.0 && starbound.initialized)
|
||||
world?.think(frameRenderTime)
|
||||
@ -438,11 +438,11 @@ class StarboundClient(val starbound: Starbound) : Closeable {
|
||||
GLFW.glfwPollEvents()
|
||||
input.think()
|
||||
|
||||
camera.think(GLFW.glfwGetTime() - measure)
|
||||
camera.think(JVMTimeSource.INSTANCE.seconds - measure)
|
||||
|
||||
gl.cleanup()
|
||||
|
||||
frameRenderTime = GLFW.glfwGetTime() - measure
|
||||
frameRenderTime = JVMTimeSource.INSTANCE.seconds - measure
|
||||
frameRenderTimes[++frameRenderIndex % frameRenderTimes.size] = frameRenderTime
|
||||
|
||||
return true
|
||||
|
@ -25,6 +25,7 @@ import java.io.File
|
||||
import java.io.FileNotFoundException
|
||||
import java.lang.ref.Cleaner
|
||||
import java.util.concurrent.ThreadFactory
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.collections.HashMap
|
||||
import kotlin.properties.ReadWriteProperty
|
||||
@ -151,7 +152,12 @@ class GLStateTracker(val locator: ISBFileLocator) {
|
||||
|
||||
private val cleanerBacklog = ArrayList<() -> Unit>()
|
||||
|
||||
var objectsCleaned = 0
|
||||
@Volatile
|
||||
var objectsCleaned = 0L
|
||||
private set
|
||||
|
||||
@Volatile
|
||||
var gcHits = 0L
|
||||
private set
|
||||
|
||||
private val cleaner = Cleaner.create(object : ThreadFactory {
|
||||
@ -170,6 +176,8 @@ class GLStateTracker(val locator: ISBFileLocator) {
|
||||
fn(nativeRef)
|
||||
checkForGLError()
|
||||
} else {
|
||||
gcHits++
|
||||
|
||||
synchronized(cleanerBacklog) {
|
||||
cleanerBacklog.add {
|
||||
fn(nativeRef)
|
||||
|
Loading…
Reference in New Issue
Block a user