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