mirror of
https://github.com/webbukkit/dynmap.git
synced 2025-02-17 20:31:37 +01:00
Add 'usenormalthreadpriority' setting (makes renders on Windows use normal priority)
This commit is contained in:
parent
f7dedff413
commit
03b280fe2d
@ -17,14 +17,16 @@ public class AsynchronousQueue<T> {
|
|||||||
private int accelDequeueThresh;
|
private int accelDequeueThresh;
|
||||||
private int pendingcnt;
|
private int pendingcnt;
|
||||||
private int pendinglimit;
|
private int pendinglimit;
|
||||||
|
private boolean normalprio;
|
||||||
|
|
||||||
public AsynchronousQueue(Handler<T> handler, int dequeueTime, int accelDequeueThresh, int accelDequeueTime, int pendinglimit) {
|
public AsynchronousQueue(Handler<T> handler, int dequeueTime, int accelDequeueThresh, int accelDequeueTime, int pendinglimit, boolean normalprio) {
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
this.dequeueTime = dequeueTime;
|
this.dequeueTime = dequeueTime;
|
||||||
this.accelDequeueTime = accelDequeueTime;
|
this.accelDequeueTime = accelDequeueTime;
|
||||||
this.accelDequeueThresh = accelDequeueThresh;
|
this.accelDequeueThresh = accelDequeueThresh;
|
||||||
if(pendinglimit < 1) pendinglimit = 1;
|
if(pendinglimit < 1) pendinglimit = 1;
|
||||||
this.pendinglimit = pendinglimit;
|
this.pendinglimit = pendinglimit;
|
||||||
|
this.normalprio = normalprio;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean push(T t) {
|
public boolean push(T t) {
|
||||||
@ -83,7 +85,8 @@ public class AsynchronousQueue<T> {
|
|||||||
});
|
});
|
||||||
thread.start();
|
thread.start();
|
||||||
try {
|
try {
|
||||||
thread.setPriority(Thread.MIN_PRIORITY);
|
if(!normalprio)
|
||||||
|
thread.setPriority(Thread.MIN_PRIORITY);
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
Log.info("Failed to set minimum priority for worker thread!");
|
Log.info("Failed to set minimum priority for worker thread!");
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@ public class MapManager {
|
|||||||
private int progressinterval = 100;
|
private int progressinterval = 100;
|
||||||
private boolean saverestorepending = true;
|
private boolean saverestorepending = true;
|
||||||
private boolean hideores = false;
|
private boolean hideores = false;
|
||||||
|
private boolean usenormalpriority = false;
|
||||||
|
|
||||||
private boolean pauseupdaterenders = false;
|
private boolean pauseupdaterenders = false;
|
||||||
private boolean pausefullrenders = false;
|
private boolean pausefullrenders = false;
|
||||||
@ -117,7 +118,8 @@ public class MapManager {
|
|||||||
public Thread newThread(Runnable r) {
|
public Thread newThread(Runnable r) {
|
||||||
Thread t = new Thread(r);
|
Thread t = new Thread(r);
|
||||||
t.setDaemon(true);
|
t.setDaemon(true);
|
||||||
t.setPriority(Thread.MIN_PRIORITY);
|
if(!mapman.usenormalpriority)
|
||||||
|
t.setPriority(Thread.MIN_PRIORITY);
|
||||||
t.setName("Dynmap Render Thread");
|
t.setName("Dynmap Render Thread");
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
@ -658,6 +660,9 @@ public class MapManager {
|
|||||||
/* Get block hiding data, if any */
|
/* Get block hiding data, if any */
|
||||||
hideores = configuration.getBoolean("hideores", false);
|
hideores = configuration.getBoolean("hideores", false);
|
||||||
|
|
||||||
|
/* See what priority to use */
|
||||||
|
usenormalpriority = configuration.getBoolean("usenormalthreadpriority", false);
|
||||||
|
|
||||||
/* Clear color scheme */
|
/* Clear color scheme */
|
||||||
ColorScheme.reset();
|
ColorScheme.reset();
|
||||||
|
|
||||||
@ -684,7 +689,8 @@ public class MapManager {
|
|||||||
(int) (configuration.getDouble("renderinterval", 0.5) * 1000),
|
(int) (configuration.getDouble("renderinterval", 0.5) * 1000),
|
||||||
configuration.getInteger("renderacceleratethreshold", 30),
|
configuration.getInteger("renderacceleratethreshold", 30),
|
||||||
(int)(configuration.getDouble("renderaccelerateinterval", 0.2) * 1000),
|
(int)(configuration.getDouble("renderaccelerateinterval", 0.2) * 1000),
|
||||||
configuration.getInteger("tiles-rendered-at-once", (Runtime.getRuntime().availableProcessors()+1)/2));
|
configuration.getInteger("tiles-rendered-at-once", (Runtime.getRuntime().availableProcessors()+1)/2),
|
||||||
|
usenormalpriority);
|
||||||
|
|
||||||
/* On dedicated thread, so default to no delays */
|
/* On dedicated thread, so default to no delays */
|
||||||
timeslice_int = (long)(configuration.getDouble("timesliceinterval", 0.0) * 1000);
|
timeslice_int = (long)(configuration.getDouble("timesliceinterval", 0.0) * 1000);
|
||||||
|
@ -133,6 +133,11 @@ renderaccelerateinterval: 0.2
|
|||||||
# How many update tiles to work on at once (if not defined, default is 1/2 the number of cores)
|
# How many update tiles to work on at once (if not defined, default is 1/2 the number of cores)
|
||||||
tiles-rendered-at-once: 2
|
tiles-rendered-at-once: 2
|
||||||
|
|
||||||
|
# If true, use normal priority threads for rendering (versus low priority) - this can keep rendering
|
||||||
|
# from starving on busy Windows boxes (Linux JVMs pretty much ignore thread priority), but may result
|
||||||
|
# in more competition for CPU resources with other processes
|
||||||
|
usenormalthreadpriority: true
|
||||||
|
|
||||||
# Save and restore pending tile renders - prevents their loss on server shutdown or /reload
|
# Save and restore pending tile renders - prevents their loss on server shutdown or /reload
|
||||||
saverestorepending: true
|
saverestorepending: true
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user