Display rendertime of previous frame
This commit is contained in:
@@ -49,6 +49,7 @@ public class Client {
|
|||||||
private Configuration config;
|
private Configuration config;
|
||||||
private Log log;
|
private Log log;
|
||||||
private Job renderingJob;
|
private Job renderingJob;
|
||||||
|
private Job previousJob;
|
||||||
private BlockingQueue<Job> jobsToValidate;
|
private BlockingQueue<Job> jobsToValidate;
|
||||||
private boolean isValidatingJob;
|
private boolean isValidatingJob;
|
||||||
private long start_time;
|
private long start_time;
|
||||||
@@ -65,6 +66,7 @@ public class Client {
|
|||||||
this.log = Log.getInstance(this.config);
|
this.log = Log.getInstance(this.config);
|
||||||
this.gui = gui_;
|
this.gui = gui_;
|
||||||
this.renderingJob = null;
|
this.renderingJob = null;
|
||||||
|
this.previousJob = null;
|
||||||
this.jobsToValidate = new ArrayBlockingQueue<Job>(1024);
|
this.jobsToValidate = new ArrayBlockingQueue<Job>(1024);
|
||||||
this.isValidatingJob = false;
|
this.isValidatingJob = false;
|
||||||
|
|
||||||
@@ -781,9 +783,14 @@ public class Client {
|
|||||||
ajob.setOutputImagePath(null);
|
ajob.setOutputImagePath(null);
|
||||||
|
|
||||||
this.isValidatingJob = false;
|
this.isValidatingJob = false;
|
||||||
|
this.previousJob = ajob;
|
||||||
return Error.Type.OK;
|
return Error.Type.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Job getPreviousJob() {
|
||||||
|
return this.previousJob;
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean shouldWaitBeforeRender() {
|
protected boolean shouldWaitBeforeRender() {
|
||||||
int concurrent_job = this.jobsToValidate.size();
|
int concurrent_job = this.jobsToValidate.size();
|
||||||
if (this.isValidatingJob) {
|
if (this.isValidatingJob) {
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import java.util.Date;
|
|||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.BoxLayout;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
@@ -58,6 +59,7 @@ public class Working implements Activity {
|
|||||||
JLabel statusContent;
|
JLabel statusContent;
|
||||||
JLabel renderedFrameContent;
|
JLabel renderedFrameContent;
|
||||||
JLabel remainingFrameContent;
|
JLabel remainingFrameContent;
|
||||||
|
JLabel lastRenderTime;
|
||||||
JLabel lastRender;
|
JLabel lastRender;
|
||||||
JLabel creditEarned;
|
JLabel creditEarned;
|
||||||
JButton pauseButton;
|
JButton pauseButton;
|
||||||
@@ -84,6 +86,7 @@ public class Working implements Activity {
|
|||||||
waiting_projects_value = new JLabel("");
|
waiting_projects_value = new JLabel("");
|
||||||
connected_machines_value = new JLabel("");
|
connected_machines_value = new JLabel("");
|
||||||
user_info_total_rendertime_this_session_value = new JLabel("");
|
user_info_total_rendertime_this_session_value = new JLabel("");
|
||||||
|
lastRenderTime = new JLabel("");
|
||||||
lastRender = new JLabel("");
|
lastRender = new JLabel("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,8 +153,12 @@ public class Working implements Activity {
|
|||||||
|
|
||||||
// last frame
|
// last frame
|
||||||
JPanel last_frame_panel = new JPanel();
|
JPanel last_frame_panel = new JPanel();
|
||||||
|
last_frame_panel.setLayout(new BoxLayout(last_frame_panel, BoxLayout.Y_AXIS));
|
||||||
last_frame_panel.setBorder(BorderFactory.createTitledBorder("Last rendered frame"));
|
last_frame_panel.setBorder(BorderFactory.createTitledBorder("Last rendered frame"));
|
||||||
lastRender.setIcon(new ImageIcon(new BufferedImage(200, 120, BufferedImage.TYPE_INT_ARGB)));
|
lastRender.setIcon(new ImageIcon(new BufferedImage(200, 120, BufferedImage.TYPE_INT_ARGB)));
|
||||||
|
lastRender.setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||||
|
lastRenderTime.setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||||
|
last_frame_panel.add(lastRenderTime);
|
||||||
last_frame_panel.add(lastRender);
|
last_frame_panel.add(lastRender);
|
||||||
|
|
||||||
ImageIcon image = new ImageIcon(getClass().getResource("/title.png"));
|
ImageIcon image = new ImageIcon(getClass().getResource("/title.png"));
|
||||||
@@ -246,6 +253,7 @@ public class Working implements Activity {
|
|||||||
public void showLastRender() {
|
public void showLastRender() {
|
||||||
Client client = parent.getClient();
|
Client client = parent.getClient();
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
|
Job lastJob = client.getPreviousJob();
|
||||||
Server server = client.getServer();
|
Server server = client.getServer();
|
||||||
if (server != null) {
|
if (server != null) {
|
||||||
byte[] data = server.getLastRender();
|
byte[] data = server.getLastRender();
|
||||||
@@ -255,6 +263,12 @@ public class Working implements Activity {
|
|||||||
BufferedImage image = ImageIO.read(is);
|
BufferedImage image = ImageIO.read(is);
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
lastRender.setIcon(new ImageIcon(image));
|
lastRender.setIcon(new ImageIcon(image));
|
||||||
|
if (lastJob != null) {
|
||||||
|
// don't use lastJob.getProcessRender().getDuration() due to timezone
|
||||||
|
if (lastJob.getProcessRender().getDuration() > 1) {
|
||||||
|
lastRenderTime.setText("Render time : " + Utils.humanDuration(new Date(lastJob.getProcessRender().getEndTime() - lastJob.getProcessRender().getStartTime())));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user