mirror of
https://github.com/nasa/trick.git
synced 2025-03-22 20:15:26 +00:00
Refactor timeline log and improve frame boundary determination.
This commit is contained in:
parent
8533029a62
commit
7595728216
@ -58,16 +58,22 @@ public class FrameViewCanvas extends JPanel {
|
||||
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);
|
||||
|
||||
JobSpecification jobSpec = tvc.jobSpecificationMap.getJobSpecification(jobExec.id);
|
||||
if ( jobSpec == null) {
|
||||
g2d.drawString("???", 180, jobY);
|
||||
g2d.drawString("???", 740, jobY);
|
||||
} else {
|
||||
g2d.drawString(jobSpec.jobClass, 180, jobY);
|
||||
g2d.drawString(jobSpec.name, 740, jobY);
|
||||
}
|
||||
}
|
||||
frame.SortByJobEventDuration();
|
||||
}
|
||||
|
@ -15,13 +15,13 @@ import java.net.URL;
|
||||
* Class JobExecutionEvent represents one execution/run of a Trick job.
|
||||
* <id> identifies the job. <start> and <stop> specify the
|
||||
* clock times at which the job started and finished.
|
||||
* <isEOF> and <isTOF> indicate whether the job was run as
|
||||
* an "end-of-frame", or a "top-of-frame" job.
|
||||
* <isTOF> indicates whether the job was run as
|
||||
* an "top-of-frame" job.
|
||||
*/
|
||||
class JobExecutionEvent {
|
||||
public String id;
|
||||
public boolean isEOF;
|
||||
public boolean isTOF;
|
||||
public boolean isEOF;
|
||||
public double start;
|
||||
public double stop;
|
||||
public int contained;
|
||||
@ -35,8 +35,8 @@ class JobExecutionEvent {
|
||||
*/
|
||||
public JobExecutionEvent(String id, boolean isTOF, boolean isEOF, double start, double stop) {
|
||||
this.id = id;
|
||||
this.isEOF = isEOF;
|
||||
this.isTOF = isTOF;
|
||||
this.isEOF = isEOF;
|
||||
this.start = start;
|
||||
this.stop = stop;
|
||||
contained = 1;
|
||||
|
@ -74,7 +74,6 @@ public class JobPerf {
|
||||
String filesDir = Paths.get(timeLineFileName).toAbsolutePath().getParent().toString();
|
||||
System.out.println( "\n\nFilesDir = " + filesDir + "\n\n");
|
||||
|
||||
|
||||
// Generate the JobSpecificationMap from information extracted from the S_job_execution
|
||||
// file, that should be in the same directory as the time-line file.
|
||||
File s_job_execution_file = new File( filesDir + "/S_job_execution" );
|
||||
@ -103,7 +102,7 @@ public class JobPerf {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
jobExecEvtList = getJobExecutionEventList(timeLineFileName);
|
||||
jobExecEvtList = getJobExecutionEventList(timeLineFileName, jobSpecificationMap);
|
||||
|
||||
if (printReport) {
|
||||
jobStats = new JobStats(jobExecEvtList);
|
||||
@ -150,7 +149,8 @@ public class JobPerf {
|
||||
/**
|
||||
* Read the timeline file, resulting in a ArrayList<JobExecutionEvent>.
|
||||
*/
|
||||
private ArrayList<JobExecutionEvent> getJobExecutionEventList( String fileName ) {
|
||||
private ArrayList<JobExecutionEvent> getJobExecutionEventList( String fileName,
|
||||
JobSpecificationMap jobSpecificationMap ) {
|
||||
String line;
|
||||
String field[];
|
||||
|
||||
@ -162,16 +162,18 @@ public class JobPerf {
|
||||
line = in.readLine();
|
||||
while( (line = in.readLine()) !=null) {
|
||||
field = line.split(",");
|
||||
// Need to strip trailing 0's from the id to make the ID's in
|
||||
// 1) timeline file and 2) the S_job_execution file consistent.
|
||||
String id = field[0].replaceAll("0*$","");
|
||||
boolean isTOF = false;
|
||||
if (Integer.parseInt(field[1]) == 1) isTOF = true;
|
||||
boolean isEOF = false;
|
||||
if (Integer.parseInt(field[2]) == 1) isEOF = true;
|
||||
double start = Double.parseDouble( field[3]);
|
||||
double stop = Double.parseDouble( field[4]);
|
||||
|
||||
String id = field[0].trim();
|
||||
JobSpecification jobSpec = jobSpecificationMap.getJobSpecification(id);
|
||||
boolean isTOF = false;
|
||||
boolean isEOF = false;
|
||||
if (jobSpec.jobClass.equals("top_of_frame")) {
|
||||
isTOF = true;
|
||||
} else if (jobSpec.jobClass.equals("end_of_frame")) {
|
||||
isEOF = true;
|
||||
}
|
||||
double start = Double.parseDouble( field[1]);
|
||||
double stop = Double.parseDouble( field[2]);
|
||||
if (start < stop) {
|
||||
JobExecutionEvent evt = new JobExecutionEvent(id, isTOF, isEOF, start, stop);
|
||||
jobExecEvtList.add( evt);
|
||||
|
@ -27,10 +27,10 @@ public class JobSpecificationMap {
|
||||
if (field.length == 9) {
|
||||
String jobclass = field[2].trim();
|
||||
int phase = Integer.parseInt( field[3].trim());
|
||||
String id = field[7].trim();
|
||||
String id = String.format("%.2f", Double.parseDouble( field[7].trim()));
|
||||
String name = field[8].trim();
|
||||
// System.out.println( "JobSpec = <" + id + "," + name + "," + jobclass + ">\n\n");
|
||||
jobSpecMap.put(id, new JobSpecification(name, jobclass, phase));
|
||||
//System.out.println("JobSpec = " + id + "," + jobclass + "," + name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,12 +87,13 @@ public class TraceViewCanvas extends JPanel {
|
||||
|
||||
try {
|
||||
boolean wasTOF = false;
|
||||
boolean wasEOF = false;
|
||||
|
||||
List<FrameRecord> frameList = new ArrayList<FrameRecord>();
|
||||
FrameRecord frameRecord = new FrameRecord();
|
||||
for (JobExecutionEvent jobExec : jobExecEvtList ) {
|
||||
|
||||
if (!wasTOF && jobExec.isTOF) {
|
||||
if ((!wasTOF && jobExec.isTOF) || ( wasEOF && !jobExec.isEOF )) {
|
||||
// Wrap up the previous frame record.
|
||||
frameRecord.stop = jobExec.start;
|
||||
frameRecord.CalculateJobContainment();
|
||||
@ -105,6 +106,8 @@ public class TraceViewCanvas extends JPanel {
|
||||
frameRecord.jobEvents.add(jobExec);
|
||||
|
||||
wasTOF = jobExec.isTOF;
|
||||
wasEOF = jobExec.isEOF;
|
||||
|
||||
idToColorMap.addKey(jobExec.id);
|
||||
}
|
||||
|
||||
|
@ -603,17 +603,14 @@ int Trick::FrameLog::shutdown() {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
fprintf(fp_log,"jobID,isTopOfFrame,isEndOfFrame,startTime,stopTime\n");
|
||||
fprintf(fp_log,"jobID,startTime,stopTime\n");
|
||||
|
||||
time_scale = 1.0 / exec_get_time_tic_value();
|
||||
tl = timeline[thread_num];
|
||||
for ( ii = 0 ; ii < tl_count[thread_num] ; ii++ ) {
|
||||
start = tl[ii].start * time_scale;
|
||||
stop = tl[ii].stop * time_scale;
|
||||
int isTrickJob = (tl[ii].trick_job) ? 1 : 0;
|
||||
int isEndOfFrame = (tl[ii].isEndOfFrame) ? 1 : 0;
|
||||
int isTopOfFrame = (tl[ii].isTopOfFrame) ? 1 : 0;
|
||||
fprintf(fp_log,"%f,%d,%d,%f,%f\n", tl[ii].id, isTopOfFrame, isEndOfFrame, start, stop);
|
||||
fprintf(fp_log,"%5.2f, %f, %f\n", tl[ii].id, start, stop);
|
||||
}
|
||||
fflush(fp_log);
|
||||
fclose(fp_log);
|
||||
|
Loading…
x
Reference in New Issue
Block a user