179 lines
4.8 KiB
Java
179 lines
4.8 KiB
Java
package it.acxent.face;
|
|
|
|
import java.util.concurrent.Semaphore;
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
|
|
public class AppStats {
|
|
public static volatile double scoring1CurrentTargetVelox;
|
|
|
|
public static volatile double scoring7CurrentTargetVelox;
|
|
|
|
public static volatile String scoring1ETA;
|
|
|
|
public static volatile String scoring7ETA;
|
|
|
|
public static volatile int numberOfCores;
|
|
|
|
public static volatile int numCudaDevices;
|
|
|
|
public static volatile int threadsPerCudaProcessor;
|
|
|
|
public static volatile int maxNumberOfThreads;
|
|
|
|
public static volatile int currentNumQueryCallable;
|
|
|
|
public static volatile int currentThreadCount;
|
|
|
|
public static volatile int semaphoreAvailablePermits;
|
|
|
|
public static volatile int semaphoreQueueLength;
|
|
|
|
public static volatile int poolActiveThreads;
|
|
|
|
public static volatile long poolTotalTasks;
|
|
|
|
public static volatile long poolCompletedTasks;
|
|
|
|
public static volatile int poolQueuedTasks;
|
|
|
|
public static void updateFromPoolAndSemaphore(ThreadPoolExecutor pool, Semaphore semaphore) {
|
|
if (pool != null) {
|
|
poolActiveThreads = pool.getActiveCount();
|
|
poolTotalTasks = pool.getTaskCount();
|
|
poolCompletedTasks = pool.getCompletedTaskCount();
|
|
poolQueuedTasks = pool.getQueue().size();
|
|
}
|
|
if (semaphore != null) {
|
|
semaphoreAvailablePermits = semaphore.availablePermits();
|
|
semaphoreQueueLength = semaphore.getQueueLength();
|
|
}
|
|
}
|
|
|
|
public static double getScoring1CurrentTargetVelox() {
|
|
return scoring1CurrentTargetVelox;
|
|
}
|
|
|
|
public static void setScoring1CurrentTargetVelox(double scoring1CurrentTargetVelox) {
|
|
AppStats.scoring1CurrentTargetVelox = scoring1CurrentTargetVelox;
|
|
}
|
|
|
|
public static double getScoring7CurrentTargetVelox() {
|
|
return scoring7CurrentTargetVelox;
|
|
}
|
|
|
|
public static void setScoring7CurrentTargetVelox(double scoring7CurrentTargetVelox) {
|
|
AppStats.scoring7CurrentTargetVelox = scoring7CurrentTargetVelox;
|
|
}
|
|
|
|
public static int getNumberOfCores() {
|
|
return numberOfCores;
|
|
}
|
|
|
|
public static void setNumberOfCores(int numberOfCores) {
|
|
AppStats.numberOfCores = numberOfCores;
|
|
}
|
|
|
|
public static int getNumCudaDevices() {
|
|
return numCudaDevices;
|
|
}
|
|
|
|
public static void setNumCudaDevices(int numCudaDevices) {
|
|
AppStats.numCudaDevices = numCudaDevices;
|
|
}
|
|
|
|
public static int getThreadsPerCudaProcessor() {
|
|
return threadsPerCudaProcessor;
|
|
}
|
|
|
|
public static void setThreadsPerCudaProcessor(int threadsPerCudaProcessor) {
|
|
AppStats.threadsPerCudaProcessor = threadsPerCudaProcessor;
|
|
}
|
|
|
|
public static int getMaxNumberOfThreads() {
|
|
return maxNumberOfThreads;
|
|
}
|
|
|
|
public static void setMaxNumberOfThreads(int maxNumberOfThreads) {
|
|
AppStats.maxNumberOfThreads = maxNumberOfThreads;
|
|
}
|
|
|
|
public static int getCurrentNumQueryCallable() {
|
|
return currentNumQueryCallable;
|
|
}
|
|
|
|
public static void setCurrentNumQueryCallable(int currentNumQueryCallable) {
|
|
AppStats.currentNumQueryCallable = currentNumQueryCallable;
|
|
}
|
|
|
|
public static int getCurrentThreadCount() {
|
|
return currentThreadCount;
|
|
}
|
|
|
|
public static void setCurrentThreadCount(int currentThreadCount) {
|
|
AppStats.currentThreadCount = currentThreadCount;
|
|
}
|
|
|
|
public static int getSemaphoreAvailablePermits() {
|
|
return semaphoreAvailablePermits;
|
|
}
|
|
|
|
public static void setSemaphoreAvailablePermits(int semaphoreAvailablePermits) {
|
|
AppStats.semaphoreAvailablePermits = semaphoreAvailablePermits;
|
|
}
|
|
|
|
public static int getSemaphoreQueueLength() {
|
|
return semaphoreQueueLength;
|
|
}
|
|
|
|
public static void setSemaphoreQueueLength(int semaphoreQueueLength) {
|
|
AppStats.semaphoreQueueLength = semaphoreQueueLength;
|
|
}
|
|
|
|
public static int getPoolActiveThreads() {
|
|
return poolActiveThreads;
|
|
}
|
|
|
|
public static void setPoolActiveThreads(int poolActiveThreads) {
|
|
AppStats.poolActiveThreads = poolActiveThreads;
|
|
}
|
|
|
|
public static long getPoolTotalTasks() {
|
|
return poolTotalTasks;
|
|
}
|
|
|
|
public static void setPoolTotalTasks(long poolTotalTasks) {
|
|
AppStats.poolTotalTasks = poolTotalTasks;
|
|
}
|
|
|
|
public static long getPoolCompletedTasks() {
|
|
return poolCompletedTasks;
|
|
}
|
|
|
|
public static void setPoolCompletedTasks(long poolCompletedTasks) {
|
|
AppStats.poolCompletedTasks = poolCompletedTasks;
|
|
}
|
|
|
|
public static int getPoolQueuedTasks() {
|
|
return poolQueuedTasks;
|
|
}
|
|
|
|
public static void setPoolQueuedTasks(int poolQueuedTasks) {
|
|
AppStats.poolQueuedTasks = poolQueuedTasks;
|
|
}
|
|
|
|
public static String getScoring1ETA() {
|
|
return scoring1ETA;
|
|
}
|
|
|
|
public static void setScoring1ETA(String scoring1eta) {
|
|
scoring1ETA = scoring1eta;
|
|
}
|
|
|
|
public static String getScoring7ETA() {
|
|
return scoring7ETA;
|
|
}
|
|
|
|
public static void setScoring7ETA(String scoring7eta) {
|
|
scoring7ETA = scoring7eta;
|
|
}
|
|
}
|