Skip to content

Commit 87dc192

Browse files
committed
Handle case where and id in the timeline is not found in the S-job_execution file.
1 parent 65d1355 commit 87dc192

File tree

6 files changed

+68
-19
lines changed

6 files changed

+68
-19
lines changed

trick_source/java/src/main/java/trick/jobperf/FrameViewCanvas.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ private void doDrawing(Graphics g) {
6868

6969
JobSpecification jobSpec = tvc.jobSpecificationMap.getJobSpecification(jobExec.id);
7070
if ( jobSpec == null) {
71-
g2d.drawString("???", 180, jobY);
72-
g2d.drawString("???", 740, jobY);
71+
g2d.setPaint( Color.RED );
72+
g2d.drawString("UNKNOWN", 180, jobY);
73+
g2d.drawString("UNKNOWN", 740, jobY);
7374
} else {
7475
g2d.drawString(jobSpec.jobClass, 180, jobY);
7576
g2d.drawString(jobSpec.name, 740, jobY);

trick_source/java/src/main/java/trick/jobperf/JobPerf.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,20 +158,24 @@ private ArrayList<JobExecutionEvent> getJobExecutionEventList( String fileName,
158158
try {
159159
BufferedReader in = new BufferedReader( new FileReader(fileName) );
160160

161-
// Strip the header off the CSV file.
161+
// Strip the header line off the CSV file.
162162
line = in.readLine();
163+
164+
// Iterate through and process each of the data lines.
163165
while( (line = in.readLine()) !=null) {
166+
boolean isTOF = false;
167+
boolean isEOF = false;
164168
field = line.split(",");
165169

166170
String id = field[0].trim();
167171
JobSpecification jobSpec = jobSpecificationMap.getJobSpecification(id);
168-
boolean isTOF = false;
169-
boolean isEOF = false;
170-
if (jobSpec.jobClass.equals("top_of_frame")) {
171-
isTOF = true;
172-
} else if (jobSpec.jobClass.equals("end_of_frame")) {
173-
isEOF = true;
174-
}
172+
if (jobSpec != null) {
173+
if (jobSpec.jobClass.equals("top_of_frame")) {
174+
isTOF = true;
175+
} else if (jobSpec.jobClass.equals("end_of_frame")) {
176+
isEOF = true;
177+
}
178+
}
175179
double start = Double.parseDouble( field[1]);
176180
double stop = Double.parseDouble( field[2]);
177181
if (start < stop) {

trick_source/java/src/main/java/trick/jobperf/JobStats.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,19 @@ public void write( JobSpecificationMap jobSpecificationMap ) {
178178
for (StatisticsRecord jobStatisticsRecord : jobStatisticsList ) {
179179

180180
JobSpecification jobSpec = jobSpecificationMap.getJobSpecification( jobStatisticsRecord.id);
181-
181+
String jobName = null;
182+
if (jobSpec != null) {
183+
jobName = jobSpec.name;
184+
} else {
185+
jobName = "UNKNOWN";
186+
}
182187
System.out.println( String.format("%10s %14.6f %14.6f %14.6f %14.6f %s",
183188
jobStatisticsRecord.id,
184189
jobStatisticsRecord.meanValue,
185190
jobStatisticsRecord.stddev,
186191
jobStatisticsRecord.minValue,
187192
jobStatisticsRecord.maxValue,
188-
jobSpec.name
193+
jobName
189194
)
190195
);
191196
}

trick_source/java/src/main/java/trick/jobperf/JobStatsViewCanvas.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public JobStatsViewCanvas( JobStats jobStats,
2424
}
2525

2626
private void doDrawing(Graphics g) {
27+
2728
Graphics2D g2d = (Graphics2D) g;
2829

2930
RenderingHints rh = new RenderingHints(
@@ -57,16 +58,23 @@ private void doDrawing(Graphics g) {
5758
int jobY = 100;
5859
for (StatisticsRecord jobStatisticsRecord : jobStats.jobStatisticsList ) {
5960

60-
JobSpecification jobSpec = jobSpecificationMap.getJobSpecification( jobStatisticsRecord.id);
61-
6261
g2d.setFont(dataFont);
6362
g2d.setPaint( Color.BLACK );
63+
6464
g2d.drawString(jobStatisticsRecord.id, 100, jobY);
6565
g2d.drawString( String.format("%14.6f", jobStatisticsRecord.meanValue), 180, jobY);
6666
g2d.drawString( String.format("%14.6f", jobStatisticsRecord.stddev), 280, jobY);
6767
g2d.drawString( String.format("%14.6f", jobStatisticsRecord.minValue), 380, jobY);
6868
g2d.drawString( String.format("%14.6f", jobStatisticsRecord.maxValue), 480, jobY);
69-
g2d.drawString(jobSpec.name, 600, jobY);
69+
70+
JobSpecification jobSpec = jobSpecificationMap.getJobSpecification( jobStatisticsRecord.id);
71+
if (jobSpec != null) {
72+
g2d.drawString(jobSpec.name, 600, jobY);
73+
} else {
74+
g2d.setPaint( Color.RED );
75+
g2d.drawString("UNKNOWN", 600, jobY);
76+
}
77+
7078
jobY += 20;
7179
}
7280
}

trick_source/java/src/main/java/trick/jobperf/TraceViewCanvas.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public TraceViewCanvas( ArrayList<JobExecutionEvent> jobExecEvtList,
9494
for (JobExecutionEvent jobExec : jobExecEvtList ) {
9595

9696
if ((!wasTOF && jobExec.isTOF) || ( wasEOF && !jobExec.isEOF )) {
97+
9798
// Wrap up the previous frame record.
9899
frameRecord.stop = jobExec.start;
99100
frameRecord.CalculateJobContainment();
@@ -152,6 +153,20 @@ public int getFirstRenderFrame() {
152153
return frameRenderRange.first;
153154
}
154155

156+
public int getLastRenderFrame() {
157+
return frameRenderRange.last;
158+
}
159+
160+
// public void moveRenderFrameRangeBy(int advance) {
161+
//
162+
// if ( ((frameRenderRange.first + advance) > 0) &&
163+
// ((frameRenderRange.first + advance) < frameArray.length ))
164+
//
165+
//
166+
//
167+
// }
168+
// }
169+
155170
public void setFirstRenderFrame(int first) throws InvalidFrameBoundsExpection {
156171
if ((first >= 0) && (first <= frameRenderRange.last)) {
157172
frameRenderRange = new FrameRange(first, frameRenderRange.last);
@@ -162,10 +177,6 @@ public void setFirstRenderFrame(int first) throws InvalidFrameBoundsExpection {
162177
}
163178
}
164179

165-
public int getLastRenderFrame() {
166-
return frameRenderRange.last;
167-
}
168-
169180
public void setLastRenderFrame(int last) throws InvalidFrameBoundsExpection {
170181
if ((last >= frameRenderRange.first) && (last < frameArray.length)) {
171182
frameRenderRange = new FrameRange(frameRenderRange.first, last);

trick_source/java/src/main/java/trick/jobperf/TraceViewInputToolBar.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public class TraceViewInputToolBar extends JToolBar implements ActionListener {
2727
private TraceViewCanvas traceView;
2828
private JTextField frameSizeField;
2929
private JButton frameDetailsButton;
30+
private JButton advanceRangeButton;
31+
private JButton retreatRangeButton;
3032
private JTextField firstRenderFrameField;
3133
private JTextField lastRenderFrameField;
3234
/**
@@ -84,6 +86,18 @@ public void keyPressed(KeyEvent e) {
8486
}
8587
});
8688

89+
advanceRangeButton = new JButton("Advance");
90+
advanceRangeButton.addActionListener(this);
91+
advanceRangeButton.setActionCommand("advance-frame-range");
92+
advanceRangeButton.setToolTipText("Advance the selected range of frames to be displayed.");
93+
add(advanceRangeButton);
94+
95+
advanceRangeButton = new JButton("Retreat");
96+
advanceRangeButton.addActionListener(this);
97+
advanceRangeButton.setActionCommand("retreat-frame-range");
98+
advanceRangeButton.setToolTipText("Retreat the selected range of frames to be displayed.");
99+
add(advanceRangeButton);
100+
87101
add( new JLabel(" "));
88102

89103
// Add Trick LOGO here.
@@ -96,6 +110,12 @@ public void actionPerformed(ActionEvent e) {
96110
case "display-frame-details":
97111
traceView.displaySelectedFrame();
98112
break;
113+
case "advance-frame-range":
114+
// DO ACTION
115+
break;
116+
case "retreat-frame-range":
117+
// DO ACTION
118+
break;
99119
default:
100120
System.out.println("Unknown Action Command:" + s);
101121
break;

0 commit comments

Comments
 (0)