Skip to content
Snippets Groups Projects
Commit 31bc3bfe authored by ael-mess's avatar ael-mess
Browse files

debug

parent 4735a409
Branches
No related tags found
No related merge requests found
......@@ -22,13 +22,11 @@ public class main {
System.out.println("[\u001B[32mOK\u001B[0m]");
System.out.println("\n> Analysing the data...");
task_service tasks = new task_service(parser.getTraces());
tasks.Externset(args[0], Integer.valueOf(args[1]));
task_service tasks = new task_service(parser.getTraces(), args);
System.out.println("[\u001B[32mOK\u001B[0m]");
System.out.println("\n> Generating the SVG...");
printer_service printer = new printer_service(tasks, "build/"+args[0]+".svg");
printer.Externset(Double.valueOf(args[2]), Double.valueOf(args[3]), Boolean.valueOf(args[4]), Boolean.valueOf(args[5]));
printer_service printer = new printer_service(tasks, "build/"+args[0]+".svg", args);
System.out.println("[\u001B[32mOK\u001B[0m]");
//System.out.println(parser.description());
......
......@@ -128,13 +128,13 @@ public class form {
this.graph.draw(rec);
}
public void jobNS(Element root, SVGDocument doc, Double x, Double y, Double width, Double height, String col, List<String> text) {
public void jobNS(Element root, SVGDocument doc, Double x, Double y, Double width, Double height, String col, String text1, String text2) {
Random rand = new Random();
int id = rand.nextInt(Integer.MAX_VALUE - 1) + 0;
this.recNS = doc.createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "rect");
this.recNS.setAttributeNS(null, "id", ""+id);
this.recNS.setAttributeNS(null, "transform", "translate(50,25)");
this.recNS.setAttributeNS(null, "transform", "translate(75,25)");
this.recNS.setAttributeNS(null, "x", Double.toString(x));
this.recNS.setAttributeNS(null, "y", Double.toString(y));
this.recNS.setAttributeNS(null, "width", Double.toString(width));
......@@ -144,13 +144,13 @@ public class form {
this.recNS.setAttributeNS(null, "stroke-width", "0.5px");
root.appendChild(this.recNS);
this.jobInfoNS(root, doc, x, y, width, height, id, text);
this.jobInfoNS(root, doc, x, y, width, height, id, text1, text2);
rand = null;
}
private void jobInfoNS(Element root, SVGDocument doc, Double x, Double y, Double width, Double height, Integer id, List<String> text) {
private void jobInfoNS(Element root, SVGDocument doc, Double x, Double y, Double width, Double height, Integer id, String text1, String text2) {
this.recNS = doc.createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "rect");
this.recNS.setAttributeNS(null, "transform", "translate(50,25)");
this.recNS.setAttributeNS(null, "transform", "translate(75,25)");
this.recNS.setAttributeNS(null, "x", Double.toString(x));
this.recNS.setAttributeNS(null, "y", Double.toString(y));
this.recNS.setAttributeNS(null, "width", Double.toString(width));
......@@ -169,13 +169,13 @@ public class form {
back.setAttributeNS(null, "height", "12");
back.setAttributeNS(null, "fill", "white");
back.setAttributeNS(null, "stroke", "black");
back.setAttributeNS(null, "transform", "translate(-25,13)");
back.setAttributeNS(null, "transform", "translate(0,13)");
back.setAttributeNS(null, "stroke-width", "0.5px");
back.setAttributeNS(null, "visibility", "hidden");
root.appendChild(back);
this.textNS1 = doc.createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "text");
this.textNS1.setAttributeNS(null, "transform", "translate(50,25)");
this.textNS1.setAttributeNS(null, "transform", "translate(75,25)");
this.textNS1.setAttributeNS(null, "x", Double.toString(x));
this.textNS1.setAttributeNS(null, "y", Double.toString(y-7.0));
this.textNS1.setAttributeNS(null, "stroke", "none");
......@@ -183,10 +183,10 @@ public class form {
this.textNS1.setAttributeNS(null, "text-anchor", "middle");
this.textNS1.setAttributeNS(null, "font-family", "arial");
this.textNS1.setAttributeNS(null, "visibility", "hidden");
this.textNS1.setTextContent(text.get(0));
this.textNS1.setTextContent(text1);
root.appendChild(this.textNS1);
this.textNS2 = doc.createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "text");
this.textNS2.setAttributeNS(null, "transform", "translate(50,25)");
this.textNS2.setAttributeNS(null, "transform", "translate(75,25)");
this.textNS2.setAttributeNS(null, "x", Double.toString(x));
this.textNS2.setAttributeNS(null, "y", Double.toString(y-2.0));
this.textNS2.setAttributeNS(null, "stroke", "none");
......@@ -194,7 +194,7 @@ public class form {
this.textNS2.setAttributeNS(null, "text-anchor", "middle");
this.textNS2.setAttributeNS(null, "font-family", "arial");
this.textNS2.setAttributeNS(null, "visibility", "hidden");
this.textNS2.setTextContent(text.get(1));
this.textNS2.setTextContent(text2);
root.appendChild(this.textNS2);
Element set = doc.createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "set");
......
......@@ -22,21 +22,25 @@ public class printer_service {
protected svggen svg = null;
protected task_service tasks = null;
protected Element root = null;
protected Integer curH = 0;
public printer_service(task_service t, String out) throws IOException, NullPointerException, OutOfMemoryError {
public printer_service(task_service t, String out, String[] args) throws IOException, NullPointerException, OutOfMemoryError {
try {
this.tasks = t;
this.svg = new svggen(t, out);
System.out.println("SVG file generated in build/");
svg.setCanvas();
this.Externset(Double.valueOf(args[2]), Double.valueOf(args[3]), Boolean.valueOf(args[4]), Boolean.valueOf(args[5]));
this.svg.setCanvas();
System.out.println("Canvas set");
this.root = this.svg.getDoc().getDocumentElement();
this.svg.getGraph().getRoot(root);
if(this.svg.isOsactive()) this.draw_os();
else this.curH++;
this.draw_main();
this.draw_tasks(this.svg.isPercpu());
this.draw_tasks();
System.out.println("Threads printed in build/"+this.svg.getApp().getName()+".svg");
svg.streamOut(root);
System.out.println("SVG file savedin build/"+this.svg.getApp().getName()+".svg");
......@@ -57,120 +61,129 @@ public class printer_service {
}
// drawing tasks jobs calling tooltips (param: h) height 6/2 smaller
public void draw_tasks(Boolean act) throws NullPointerException {
double h = this.svg.getOs().size()+ 1.0;
public void draw_tasks() throws NullPointerException {
int h = this.curH;
double w = 0.0;
double x = 0.0;
double y = this.svg.getTask_hei();
boolean started = false;
boolean switched = false;
List<String> text = new ArrayList<>();
int os_preem = 0;
String text1 = "", text2 = "";
for(task t : this.svg.getTasks()) {
if(act) h = this.svg.getOs().size()+ 1.0 + t.getCpu_id();
text.add(0, "task"+t.getName()+" PID:"+t.getId()+" P:"+t.getPeriod()/1000.0+"ms D:"+t.getDeadline()/1000.0+"ms CPU:"+t.getCpu_id());
if(this.svg.isPercpu()) h = this.curH + t.getCpu_id();
for(t_event t_e : t.getEvents()) {
switch(t_e.getType()) {
case START :
started = true;
x = (t_e.getValue() - this.svg.getStart())*this.svg.getScale();
text.add(1, "from "+((t_e.getValue()-this.svg.getStart())*1000.0)+"ms");
text1 = "task"+t.getName()+" PID:"+t.getId()+" P:"+t.getPeriod()/1000.0+"ms D:"+t.getDeadline()/1000.0+"ms CPU:"+t.getCpu_id();
text2 = "from "+((t_e.getValue()-this.svg.getStart())*1000.0)+"ms";
os_preem = 0;
break;
case FINISH :
if(started && !switched) {
started = false;
w = (t_e.getValue() - this.svg.getStart())*this.svg.getScale() - x;
text.add(1, text.get(1)+" to "+((t_e.getValue()-this.svg.getStart())*1000.0)+"ms");
this.svg.getForm().jobNS(root, this.svg.getDoc(), x, h*y+3.0, w, y-6.0, this.getColor(t_e, act, t), text);
text1 += " ("+os_preem+" os preem)";
text2 += " to "+((t_e.getValue()-this.svg.getStart())*1000.0)+"ms";
this.svg.getForm().jobNS(root, this.svg.getDoc(), x, h*y+3.0, w, y-6.0, this.getColor(t_e, t), text1, text2);
}
break;
case SWITCH_OUT :
if(started && !switched) {
if(this.svg.isOsactive() || this.tasks.getTids().contains(t_e.getNp_tid())) {
switched = true;
w = (t_e.getValue() - this.svg.getStart())*this.svg.getScale() - x;
text.add(1, text.get(1)+" to "+((t_e.getValue()-this.svg.getStart())*1000.0)+"ms");
this.svg.getForm().jobNS(root, this.svg.getDoc(), x, h*y+3.0, w, y-6.0, this.getColor(t_e, act, t), text);
text1 += " ("+os_preem+" os preem)";
text2 += " to "+((t_e.getValue()-this.svg.getStart())*1000.0)+"ms";
this.svg.getForm().jobNS(root, this.svg.getDoc(), x, h*y+3.0, w, y-6.0, this.getColor(t_e, t), text1, text2);
}
else os_preem++;
}
break;
case SWITCH_IN :
if(started && switched) {
if(this.svg.isOsactive() || this.tasks.getTids().contains(t_e.getNp_tid())) {
switched = false;
x = (t_e.getValue() - this.svg.getStart())*this.svg.getScale();
text.add(1, "from "+((t_e.getValue()-this.svg.getStart())*1000.0)+"ms");
text1 = "task"+t.getName()+" PID:"+t.getId()+" P:"+t.getPeriod()/1000.0+"ms D:"+t.getDeadline()/1000.0+"ms CPU:"+t.getCpu_id();
text2 = "from "+((t_e.getValue()-this.svg.getStart())*1000.0)+"ms";
os_preem = 0;
}
}
break;
}
}
if(!act) h += 1.0;
if(!this.svg.isPercpu()) h++;
}
text = null;
}
private String getColor(t_event evt, Boolean act, task t) {
if(act) return t.getColorS();
else if(evt.getType().equals(Types.SWITCH_OUT) || (evt.isPassed() && evt.getType().equals(Types.FINISH))) return "green";
else return "red";
private String getColor(t_event evt, task t) {
if(this.svg.isPercpu() || t.getStart()==null) return t.getColorS();
else if(evt.isPassed()!=null && !evt.isPassed()) return "red";
else return "green";
}
// drawing main thread (param: h)
public void draw_main() throws NullPointerException {
double w = 0.0;
double x = 0.0;
double h = this.svg.getOs().size();
double y = this.svg.getTask_hei();
boolean started = false;
List<String> text = new ArrayList<>();
String text1 = "", text2 = "";
for(t_event t_e : this.svg.getApp().getEvents()) {
text.add(this.svg.getApp().getName()+" PID:"+this.svg.getApp().getId()+" CPU:"+this.svg.getApp().getCpu_id());
text1 = ""+this.svg.getApp().getName()+" PID:"+this.svg.getApp().getId()+" CPU:"+this.svg.getApp().getCpu_id();
switch(t_e.getType()) {
case SWITCH_OUT :
if(started) {
text2 += " to "+((t_e.getValue()-this.svg.getStart())*1000.0)+"ms";
started = false;
w = (t_e.getValue() - this.svg.getStart())*this.svg.getScale() - x;
text.add(1, text.get(1)+" to "+((t_e.getValue()-this.svg.getStart())*1000.0)+"ms");
this.svg.getForm().jobNS(root, this.svg.getDoc(), x, h*y, w, y, "blue", text);
this.svg.getForm().jobNS(root, this.svg.getDoc(), x, this.curH*y, w, y, "blue", text1, text2);
}
break;
case SWITCH_IN :
if(!started) {
text2 = "from "+((t_e.getValue()-this.svg.getStart())*1000.0)+"ms";
started = true;
x = (t_e.getValue() - this.svg.getStart())*this.svg.getScale();
text.add(1, "from "+((t_e.getValue()-this.svg.getStart())*1000.0)+"ms");
}
break;
}
}
text = null;
this.curH++;
}
// drawing os activity (param: h)
public void draw_os() throws NullPointerException {
double h = 0.0;
double w = 0.0;
double x = 0.0;
double y = this.svg.getTask_hei();
boolean started = false;
List<String> text = new ArrayList<>();
String text1 = "", text2 = "";
this.curH = 0;
for(app proc : this.svg.getOs()) {
for(t_event t_e : proc.getEvents()) {
switch(t_e.getType()) {
case SWITCH_OUT :
if(started) {
text.add(1, "last: "+t_e.getNp_name()+" TID:"+t_e.getNp_tid());
text2 = "last: "+t_e.getNp_name()+" TID:"+t_e.getNp_tid();
started = false;
w = (t_e.getValue() - this.svg.getStart())*this.svg.getScale() - x;
this.svg.getForm().jobNS(root, this.svg.getDoc(), x, h*y, w, y, "blue", text);
this.svg.getForm().jobNS(root, this.svg.getDoc(), x, this.curH*y, w, y, "blue", text1, text2);
}
break;
case SWITCH_IN :
if(!started) {
text.add(0, "first: "+t_e.getNp_name()+" TID:"+t_e.getNp_tid());
text1 = "first: "+t_e.getNp_name()+" TID:"+t_e.getNp_tid();
started = true;
x = (t_e.getValue() - this.svg.getStart())*this.svg.getScale();
}
break;
}
}
this.curH++;
}
text = null;
}
}
......@@ -46,6 +46,7 @@ public class svggen {
protected app main = null;
protected Boolean osactive = true;
protected Boolean percpu = false;
protected Integer curH = 0;
public svggen(task_service serv, String out) throws IOException, NullPointerException {
try {
......@@ -62,13 +63,7 @@ public class svggen {
this.os = serv.getOs_task();
this.cpu = serv.getCpu();
this.start = this.os.get(0).getStart();
this.width = (serv.getEnd() - this.start) * this.scale;
int nbt = 0, oss = 0;
if(percpu) nbt = this.cpu.size();
else nbt = serv.getNb_task();
if(osactive) oss = this.os.size();
else oss = 1;
this.height = (nbt + 1 + oss)* this.task_hei;
this.width = (serv.getEnd() - this.start);
this.out = new FileWriter(out);
} catch(IOException e) {
......@@ -122,6 +117,23 @@ public class svggen {
return this.main;
}
public Integer getCurH() {
return this.curH;
}
public void setHeight() {
int nbt = 0, oss = 0;
if(this.percpu) nbt = this.cpu.size();
else nbt = tasks.size();
if(this.osactive) oss = this.os.size();
else oss = 1;
this.height = (nbt + 1 + oss)* this.task_hei;
}
public void setWidth() {
this.width = this.width * this.scale;
}
public Boolean isOsactive() {
return this.osactive;
}
......@@ -146,57 +158,61 @@ public class svggen {
this.percpu = act;
}
// setting the canvas with 50/2 height and 100/2 width plus
// setting the canvas with 50/2 height and 150/2 width plus
public void setCanvas() throws NullPointerException {
this.svgGenerator.setSVGCanvasSize(new Dimension(this.width.intValue()+1+100, this.height.intValue()+1+50));
this.setHeight();
this.setWidth();
this.svgGenerator.setSVGCanvasSize(new Dimension(this.width.intValue()+1+150, this.height.intValue()+1+50));
this.svgGenerator.translate(0, 25);
this.setText();
this.svgGenerator.translate(50, 0);
this.svgGenerator.translate(75, 0);
this.setTInfo();
}
// setting info text for canvas (param: h, dist from x=0)
private void setText() throws NullPointerException {
int h = 1;
if(this.osactive) {
h = 0;
for(app proc: this.os) {
this.svgGenerator.drawString("OS CPU:"+proc.getId(), 5.0f, (float)(this.task_hei*(h+0.5)));
h++;
}
this.curH = 0;
if(this.osactive) for(app proc: this.os) {
this.svgGenerator.drawString("OS CPU:"+proc.getId(), 5.0f, (float)(this.task_hei*(this.curH+0.5)));
this.curH++;
}
else this.curH++;
this.svgGenerator.drawString("Main task "+this.main.getName()+" PID:"+this.main.getId(), 3.0f, (float)(this.task_hei*(h+0.5)));
h++;
this.svgGenerator.drawString("Main task "+this.main.getName()+" PID:"+this.main.getId(), 3.0f, (float)(this.task_hei*(this.curH+0.5)));
this.curH++;
if(this.percpu) for(Integer id : this.cpu) {
this.svgGenerator.drawString("CPU"+id, 3.0f, (float)(this.task_hei*(h+0.5)));
h++;
this.svgGenerator.drawString("CPU"+id, 3.0f, (float)(this.task_hei*(this.curH+0.5)));
this.curH++;
}
else for(task t : this.tasks) {
this.svgGenerator.drawString("Task"+t.getName()+" TID:"+t.getId()+": CPU:"+t.getCpu_id(), 3.0f, (float)(this.task_hei*(h+0.5)));
this.svgGenerator.drawString("(P:"+t.getPeriod()/1000.0+"ms D:"+t.getDeadline()/1000.0+"ms)", 3.0f, (float)(this.task_hei*(h+0.75)));
h++;
this.svgGenerator.drawString("Task"+t.getName()+" TID:"+t.getId()+": CPU:"+t.getCpu_id(), 3.0f, (float)(this.task_hei*(this.curH+0.5)));
this.svgGenerator.drawString("(P:"+t.getPeriod()/1000.0+"ms D:"+t.getDeadline()/1000.0+"ms)", 3.0f, (float)(this.task_hei*(this.curH+0.75)));
this.curH++;
}
}
// setting period and deadline infos (param: h)
// using the last period for axis info (1 for 2 period)
private void setTInfo() throws NullPointerException {
int h = 1 + os.size();
this.curH = 0;
int period = 0, deadline = 0;
Double start = null;
if(!this.percpu) for(task t : this.tasks) {
if(!this.percpu) {
this.curH = 1 + os.size();
for(task t : this.tasks) {
period = t.getPeriod();
deadline = t.getDeadline();
start = t.getStart();
if(period != 0 && deadline != 0 && start!=null) for(int nb_period=0; ((start-this.start+((nb_period/1000000.0)*period))*this.scale)<this.width; nb_period++) {
this.f.wakeLine((start - this.start + (nb_period/1000000.0)*period)*this.scale, (1+h)*this.task_hei, h*this.task_hei);
this.f.deadLine((start - this.start + (nb_period/1000000.0)*deadline)*this.scale, (1+h)*this.task_hei, h*this.task_hei);
this.f.wakeLine((start - this.start + (nb_period/1000000.0)*period)*this.scale, (1+this.curH)*this.task_hei, this.curH*this.task_hei);
this.f.deadLine((start - this.start + (nb_period/1000000.0)*deadline)*this.scale, (1+this.curH)*this.task_hei, this.curH*this.task_hei);
}
this.curH++;
}
h++;
}
else this.curH++;
period = this.tasks.get(0).getPeriod();
this.f.axis(this.width, this.height, period*this.scale/1000000.0);
......
......@@ -19,17 +19,17 @@ public class task_service {
protected List<task> tasks = null;
protected List<trace> traces = null;
protected List<Integer> cpu = null;
protected Integer nb_task = 0;
protected List<Integer> tids = null;
protected app main_task = null;
protected List<app> os = null;
protected Double end = 0.0;
public task_service(List<trace> traces) throws NullPointerException {
public task_service(List<trace> traces, String[] args) throws NullPointerException {
try {
this.traces = traces;
this.tasks = new ArrayList<>();
this.cpu = new ArrayList<>();
List<Integer> tids = new ArrayList<>();
this.tids = new ArrayList<>();
for(trace tr : this.traces) {
if(!cpu.contains(tr.getCpu_id())) this.cpu.add(tr.getCpu_id());
if(tr instanceof ptask_tracepoint && !tids.contains(tr.getTid())) tids.add(tr.getTid());
......@@ -43,22 +43,24 @@ public class task_service {
System.out.println("Main thread and system activity set");
System.out.println("Tracing start from "+this.os.get(0).getStart()+" to "+this.end+" ("+(this.end-this.os.get(0).getStart())+"s)");
for(trace tr : this.traces) if(tr instanceof ptask_tracepoint && tids.remove(tr.getTid())) this.setTask(tr);
this.nb_task = this.tasks.size();
System.out.println(""+this.nb_task+" tasks imported");
List<Integer> tmp = new ArrayList<>(tids);
for(trace tr : this.traces) if(tr instanceof ptask_tracepoint && tmp.remove(tr.getTid())) this.setTask(tr);
tmp = null;
System.out.println(""+this.tasks.size()+" tasks imported");
if(this.tasks.size()==0) throw new NullPointerException("No tasks detected");
tids = null;
if(!this.Externset(args[0], Integer.valueOf(args[1]))) System.out.println("Two differents pid detected for "+args[0]+" :"+args[1]+" and "+this.main_task.getId());
} catch(NullPointerException e) {
if(this.tasks.size()==0) throw new NullPointerException("No tasks detected");
throw new NullPointerException("Null pointer parameter");
}
}
// for external informations
public void Externset(String name, Integer pid) throws NullPointerException {
public Boolean Externset(String name, Integer pid) throws NullPointerException {
this.main_task.setName(name);
this.main_task.setId(pid);
return this.main_task.getId().equals(pid);
}
// setting the os activity per cpu in this list
......@@ -85,6 +87,7 @@ public class task_service {
trace tr = it.next();
while(it.hasNext() && !(tr instanceof ptask_tracepoint)) tr = it.next();
this.main_task.setId(tr.getPid());
this.tids.add(this.main_task.getId());
this.main_task.setCpu_id(tr.getCpu_id());
this.main_task.setColor();
......@@ -103,15 +106,14 @@ public class task_service {
t.setDeadline(((ptask_tracepoint) tr).getDeadline());
t.setColor();
this.setEvents(t);
t = null;
}
public List<Integer> getCpu() {
return this.cpu;
}
public Integer getNb_task() {
return this.nb_task;
public List<Integer> getTids() {
return this.tids;
}
public List<task> getTasks() {
......@@ -130,46 +132,12 @@ public class task_service {
return this.end;
}
// checking errors in events importation (used only in debug)
public void check() {
if(this.traces!=null) System.err.println(" "+this.traces.size()+" traces saved");
else System.err.println(" null traces pointer");
if(this.main_task==null) System.err.println(" null main task pointer");
if(this.os==null) System.err.println(" null os list pointer");
System.err.println(" tracing start from "+this.os.get(0).getStart()+" to "+this.end+" ("+(this.end-this.os.get(0).getStart())+"s)");
List<Integer> ptask_tids = new ArrayList<>();
List<Integer> all_tids = new ArrayList<>();
int main_pid = 0;
for(trace tr : this.traces) {
if(tr instanceof ptask_tracepoint && !ptask_tids.contains(tr.getTid())) {
ptask_tids.add(tr.getTid());
main_pid = tr.getPid();
}
if(!all_tids.contains(tr.getTid())) all_tids.add(tr.getTid());
}
if(!this.main_task.getId().equals(main_pid)) System.err.println(" two differents pid for main "+main_pid+" and "+this.main_task.getId());
String ret = "\n ";
for(Integer id : all_tids) ret += id+", ";
System.err.println(" tids in the traces :"+ret);
if(this.tasks.size() != ptask_tids.size()) System.err.println(" missing task in the trace");
if(this.tasks!=null) System.err.println(""+this.tasks.size()+" tasks detected :");
else System.err.println(" null tasks pointer");
ret = "\n ";
// checking events errors in events importation (used only in debug)
public void check_events() {
t_event evt;
for(task t : this.tasks) {
if(!ptask_tids.contains(t.getId())) System.err.println(" unknown task detected :"+t.getName()+":"+t.getId());
t.check_events();
}
for(task t : this.tasks) t.check_events();
for(app proc : this.os) proc.check_events();
this.main_task.check_events();
ptask_tids = null;
all_tids = null;
}
// setting task events
......@@ -177,7 +145,7 @@ public class task_service {
List<t_event> events = new ArrayList<>();
int i = 0, idx = 0;
boolean once = true;
Double period = 0.0;
Double deadline = t.getDeadline()*1.0;
for(trace tr : this.traces) {
i = 0;
if(t.getId().equals(tr.getTid())) {
......@@ -189,27 +157,33 @@ public class task_service {
if(((ptask_tracepoint) tr).getFlag().equals("\"NOW\"")) {
t.setState(true);
if(once && t.getStart()!=null) events.add(idx, new t_event(Types.START, t.getStart()));
if(once) period = t.getPeriod()*1.0;
if(once) deadline++;
once = false;
}
i++;
if(t.isActivated()) {
if(((ptask_tracepoint) tr).getState().equals("\"b_wait_period\"")) events.add(new t_event(Types.FINISH, tr.getTime().getTime("seconde"), (tr.getTime().getTime("seconde")-t.getStart())<(period/1000000.0)));
if(((ptask_tracepoint) tr).getState().equals("\"b_wait_period\"")) {
if(t.getStart() != null) events.add(new t_event(Types.FINISH, tr.getTime().getTime("seconde"), (tr.getTime().getTime("seconde")-t.getStart())<(deadline/1000000.0)));
else events.add(new t_event(Types.FINISH, tr.getTime().getTime("seconde")));
}
else if(((ptask_tracepoint) tr).getState().equals("\"e_wait_period\"")) {
events.add(new t_event(Types.START, tr.getTime().getTime("seconde")));
period += t.getPeriod();
deadline += t.getDeadline();
}
else if(((ptask_tracepoint) tr).getState().equals("\"b_wait_activation\"")) {
if(t.getStart() != null) events.add(new t_event(Types.FINISH, tr.getTime().getTime("seconde"), (tr.getTime().getTime("seconde")-t.getStart())<(deadline/1000000.0)));
else events.add(new t_event(Types.FINISH, tr.getTime().getTime("seconde")));
}
else if(((ptask_tracepoint) tr).getState().equals("\"b_wait_activation\"")) events.add(new t_event(Types.FINISH, tr.getTime().getTime("seconde"), (tr.getTime().getTime("seconde")-t.getStart())<(period/1000000.0)));
else if(((ptask_tracepoint) tr).getState().equals("\"e_wait_activation\"")) {
events.add(new t_event(Types.START, tr.getTime().getTime("seconde")));
period += t.getPeriod();
deadline += t.getDeadline();
}
}
else if(((ptask_tracepoint) tr).getState().equals("\"e_wait_activation\"")) {
t.setState(true);
events.add(new t_event(Types.START, tr.getTime().getTime("seconde")));
period = t.getPeriod()*1.0;
deadline = t.getDeadline()*1.0;
}
}
else if(tr instanceof sched_switch) {
......@@ -228,19 +202,14 @@ public class task_service {
// setting the os events
private void setOs_events(app proc, Integer id) throws NullPointerException {
List<t_event> events = new ArrayList<>();
List<Integer> tids = new ArrayList<>();
for(trace tr : this.traces)
if(tr instanceof ptask_tracepoint && !tids.contains(tr.getTid())) tids.add(tr.getTid());
tids.add(this.main_task.getId());
for(trace tr : this.traces) if(tr instanceof sched_switch && tr.getCpu_id().equals(id)) {
if(tids.contains(((sched_switch) tr).getNext_tid()) && !tids.contains(((sched_switch) tr).getPrev_tid()))
if(this.tids.contains(((sched_switch) tr).getNext_tid()) && !this.tids.contains(((sched_switch) tr).getPrev_tid()))
events.add(new t_event(Types.SWITCH_OUT, tr.getTime().getTime("seconde"), ((sched_switch) tr).getPrev_tid(), ((sched_switch) tr).getPrev_comm()));
else if(tids.contains(((sched_switch) tr).getPrev_tid()) && !tids.contains(((sched_switch) tr).getNext_tid()))
else if(this.tids.contains(((sched_switch) tr).getPrev_tid()) && !this.tids.contains(((sched_switch) tr).getNext_tid()))
events.add(new t_event(Types.SWITCH_IN, tr.getTime().getTime("seconde"), ((sched_switch) tr).getNext_tid(), ((sched_switch) tr).getNext_comm()));
}
proc.setEvents(events);
tids = null;
}
// setting the main app events
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment