Add javadoc
This commit is contained in:
committed by
Sheepit Renderfarm
parent
1ef0b2f4b7
commit
8b12e9de8a
@@ -28,6 +28,12 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
import lombok.Setter;
|
||||
import oshi.software.os.OSProcess;
|
||||
|
||||
/**
|
||||
* Provides facilities to track how long a render process takes,
|
||||
* how long different phases lasted
|
||||
* how many resources it uses and has used
|
||||
* and to end the process if necessary
|
||||
*/
|
||||
@Data public class RenderProcess {
|
||||
private long startTime;
|
||||
private long endTime;
|
||||
@@ -61,6 +67,9 @@ import oshi.software.os.OSProcess;
|
||||
log = _log;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the Process object with the current memory usage
|
||||
*/
|
||||
public void update() {
|
||||
OSProcess osp = osProcess; // Shallow copy to try to not run into a race condition via being nulled
|
||||
try {
|
||||
@@ -81,6 +90,7 @@ import oshi.software.os.OSProcess;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get how long the render process has been running for
|
||||
* @return duration in seconds
|
||||
*/
|
||||
public int getDuration() {
|
||||
@@ -93,6 +103,9 @@ import oshi.software.os.OSProcess;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kills the render process
|
||||
*/
|
||||
public void kill() {
|
||||
if (process != null){
|
||||
try {
|
||||
@@ -104,6 +117,9 @@ import oshi.software.os.OSProcess;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends the render process by killing it and recording the time it ended
|
||||
*/
|
||||
public void finish() {
|
||||
kill();
|
||||
endTime = new Date().getTime();
|
||||
@@ -111,10 +127,23 @@ import oshi.software.os.OSProcess;
|
||||
process = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Records when the render process started
|
||||
*/
|
||||
public void start() {
|
||||
startTime = new Date().getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the exit value for the render process.
|
||||
* @return the exit value of the process represented
|
||||
* by this Process object. By convention,
|
||||
* the value 0 indicates normal termination.
|
||||
* For this method it might also mean that the
|
||||
* process is still running.
|
||||
* Returns -1 if process is null.
|
||||
* @see Process#exitValue()
|
||||
*/
|
||||
public int exitValue() {
|
||||
int value = 0;
|
||||
if (process == null) {
|
||||
|
||||
Reference in New Issue
Block a user