-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Jobs-stats and, Frame-details windows, job names,classes, conta…
…ined jobs and so forth.
- Loading branch information
Showing
17 changed files
with
810 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
trick_source/java/src/main/java/trick/jobperf/FrameViewCanvas.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package trick.jobperf; | ||
|
||
import java.awt.*; | ||
import java.io.*; | ||
import java.util.*; | ||
import javax.swing.*; | ||
|
||
public class FrameViewCanvas extends JPanel { | ||
private FrameRecord frame; | ||
private TraceViewCanvas tvc; | ||
private Font headingsFont; | ||
private Font dataFont; | ||
|
||
public FrameViewCanvas( TraceViewCanvas tvc, FrameRecord frame ) { | ||
this.tvc = tvc; | ||
this.frame = frame; | ||
dataFont = new Font("Arial", Font.PLAIN, 18); | ||
headingsFont = new Font("Arial", Font.BOLD, 18); | ||
|
||
setPreferredSize(new Dimension(800, neededPanelHeight())); | ||
} | ||
|
||
private void doDrawing(Graphics g) { | ||
Graphics2D g2d = (Graphics2D) g; | ||
|
||
RenderingHints rh = new RenderingHints( | ||
RenderingHints.KEY_ANTIALIASING, | ||
RenderingHints.VALUE_ANTIALIAS_ON); | ||
|
||
rh.put(RenderingHints.KEY_RENDERING, | ||
RenderingHints.VALUE_RENDER_QUALITY); | ||
|
||
// Panel Background Color Fill | ||
g2d.setPaint(Color.WHITE); | ||
g2d.fillRect(0, 0, getWidth(), getHeight()); | ||
|
||
// TITLE | ||
g2d.setFont(headingsFont); | ||
g2d.setPaint( Color.RED ); | ||
g2d.drawString("Frame Details", 100, 50); | ||
|
||
// Column Headings | ||
g2d.setFont(headingsFont); | ||
g2d.setPaint( Color.BLUE ); | ||
g2d.drawString("Job-ID", 100, 80); | ||
g2d.drawString("Job-Class", 180, 80); | ||
g2d.drawString("Start-Time", 420, 80); | ||
g2d.drawString("Stop-Time", 520, 80); | ||
g2d.drawString("Duration", 620, 80); | ||
g2d.drawString("Job-Name", 740, 80); | ||
|
||
frame.SortByStartTime(); | ||
|
||
// For each job in the frame. | ||
int jobY = 100; | ||
for (JobExecutionEvent jobExec : frame.jobEvents) { | ||
g2d.setPaint( tvc.idToColorMap.getColor( jobExec.id ) ); | ||
g2d.fillRect(50, jobY, 20, 20); | ||
g2d.setPaint( Color.BLACK ); | ||
jobY += 20; | ||
JobSpecification jobSpec = tvc.jobSpecificationMap.getJobSpecification(jobExec.id); | ||
double duration = jobExec.stop - jobExec.start; | ||
|
||
g2d.setFont(dataFont); | ||
g2d.drawString(jobExec.id, 100, jobY); | ||
g2d.drawString(jobSpec.jobClass, 180, jobY); | ||
g2d.drawString( String.format("%12.6f", jobExec.start), 420, jobY); | ||
g2d.drawString( String.format("%12.6f", jobExec.stop), 520, jobY); | ||
g2d.drawString( String.format("%12.6f", duration), 620, jobY); | ||
g2d.drawString(jobSpec.name, 740, jobY); | ||
} | ||
frame.SortByJobEventDuration(); | ||
} | ||
|
||
/** | ||
* Calculate the height of the FrameViewCanvas (JPanel) needed to render the | ||
* jobs in the frame. | ||
*/ | ||
private int neededPanelHeight() { | ||
return 20 * frame.jobEvents.size() + 100; | ||
} | ||
|
||
/** | ||
* This function paints the FrameViewCanvas (i.e, JPanel) when required. | ||
*/ | ||
@Override | ||
public void paintComponent(Graphics g) { | ||
super.paintComponent(g); | ||
doDrawing(g); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
trick_source/java/src/main/java/trick/jobperf/FrameViewWindow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package trick.jobperf; | ||
|
||
import java.awt.*; | ||
import java.io.*; | ||
import java.util.*; | ||
import javax.swing.*; | ||
|
||
public class FrameViewWindow extends JFrame { | ||
public FrameViewWindow( TraceViewCanvas tvc, FrameRecord frame, int frameNumber ) { | ||
|
||
FrameViewCanvas frameViewCanvas = new FrameViewCanvas(tvc, frame); | ||
|
||
JScrollPane scrollPane = new JScrollPane( frameViewCanvas ); | ||
scrollPane.getVerticalScrollBar().setUnitIncrement( 20 ); | ||
|
||
JPanel scrollingFrameViewCanvas = new JPanel(); | ||
scrollingFrameViewCanvas.add(scrollPane); | ||
scrollingFrameViewCanvas.setLayout(new BoxLayout(scrollingFrameViewCanvas, BoxLayout.X_AXIS)); | ||
|
||
setTitle("Frame " + frameNumber); | ||
setPreferredSize(new Dimension(1200, 400)); | ||
add(scrollingFrameViewCanvas); | ||
pack(); | ||
setVisible(true); | ||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); | ||
setFocusable(true); | ||
setVisible(true); | ||
|
||
frameViewCanvas.repaint(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
trick_source/java/src/main/java/trick/jobperf/JobSpecification.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package trick.jobperf; | ||
|
||
import java.awt.*; | ||
import java.io.*; | ||
import java.util.*; | ||
|
||
|
||
/** | ||
* Class JobSpecification represents ... | ||
*/ | ||
class JobSpecification { | ||
public String name; | ||
public String jobClass; | ||
public int phase; | ||
|
||
/** | ||
* @param name identifies the relevant Trick job. | ||
* @param jobClass the Trick job class. | ||
* @param phase the Trick phase number of the Trick job. | ||
*/ | ||
public JobSpecification(String name, String jobClass, int phase) { | ||
this.name = name; | ||
this.jobClass = jobClass; | ||
this.phase = phase; | ||
} | ||
/** | ||
* Create a String representation of an object of this jobClass. | ||
*/ | ||
@Override | ||
public String toString() { | ||
return ( "JobSpecification: " + name + "," + jobClass + "," + phase ); | ||
} | ||
} |
Oops, something went wrong.