Skip to content
Snippets Groups Projects
Commit a3e12700 authored by Flora Dziedzic's avatar Flora Dziedzic
Browse files

Prise en compte de la date actuelle de réveil pour les tracer, pour pouvoir...

Prise en compte de la date actuelle de réveil pour les tracer, pour pouvoir ainsi éviter de les tracer après les avoir calculées
parent ef645234
No related branches found
No related tags found
No related merge requests found
Showing with 1170 additions and 44 deletions
......@@ -17,9 +17,9 @@ public class ptask_tracepoint extends userspace_tracepoint {
protected Integer prio = null;
protected Integer period = null;
protected Integer deadline = null;
protected Integer offset = null;
protected Long actualat = null;
public ptask_tracepoint(time_trace time, Integer cpu_id, Integer pid, Integer tid, String flag, String state, Integer idx, String tim, Integer prio, Integer peri, Integer dd, Integer offset) {
public ptask_tracepoint(time_trace time, Integer cpu_id, Integer pid, Integer tid, String flag, String state, Integer idx, String tim, Integer prio, Integer peri, Integer dd, String at) {
BigInteger bigInt = new BigInteger(tim);
this.time = time;
......@@ -33,7 +33,7 @@ public class ptask_tracepoint extends userspace_tracepoint {
this.prio = prio;
this.period = peri;
this.deadline = dd;
this.offset = offset;
this.actualat= Long.parseLong(at);
}
public String getFlag() {
......@@ -64,11 +64,11 @@ public class ptask_tracepoint extends userspace_tracepoint {
return this.deadline;
}
public Integer getOffset() {
return this.offset;
public Long getActualat() {
return this.actualat;
}
public String description() {
return "["+super.time.getHour()+":"+super.time.getMinute()+":"+super.time.getSeconde()+"] (+"+super.time.getDelta()+") cpu id="+super.getCpu_id()+", pid="+super.getPid()+", tid="+super.getTid()+" "+this.getFlag()+" "+this.getState()+" "+this.getIndex()+" "+this.getTimes()+" "+this.getPrio()+" "+this.getPeriod()+" "+this.getDeadline()+" "+this.getOffset();
return "["+super.time.getHour()+":"+super.time.getMinute()+":"+super.time.getSeconde()+"] (+"+super.time.getDelta()+") cpu id="+super.getCpu_id()+", pid="+super.getPid()+", tid="+super.getTid()+" "+this.getFlag()+" "+this.getState()+" "+this.getIndex()+" "+this.getTimes()+" "+this.getPrio()+" "+this.getPeriod()+" "+this.getDeadline()+" "+this.getActualat();
}
}
/****************************************************************************
* Class: trace() *
* Parameters: all the trace parameters *
* Autor: ael-mess *
* Description: represents the parameters required for tracing *
****************************************************************************/
package com.event;
import java.math.BigInteger;
public class ptask_tracepoint extends userspace_tracepoint {
protected String flag = null;
protected String state = null;
protected Integer index = null;
protected Long times = null;
protected Integer prio = null;
protected Integer period = null;
protected Integer deadline = null;
protected Long actualat = null;
public ptask_tracepoint(time_trace time, Integer cpu_id, Integer pid, Integer tid, String flag, String state, Integer idx, String tim, Integer prio, Integer peri, Integer dd, String at) {
BigInteger bigInt = new BigInteger(tim);
this.time = time;
this.cpu_id = cpu_id;
this.pid = pid;
this.tid = tid;
this.flag = flag;
this.state = state;
this.index = idx;
if(bigInt.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0) this.times = Long.valueOf(tim);
this.prio = prio;
this.period = peri;
this.deadline = dd;
this.actualat= Long.parseLong(at);
System.out.println("ptask_tracepoint");
System.out.println(actualat);
}
public String getFlag() {
return this.flag;
}
public String getState() {
return this.state;
}
public Integer getIndex() {
return this.index;
}
public Long getTimes() {
return this.times;
}
public Integer getPrio() {
return this.prio;
}
public Integer getPeriod() {
return this.period;
}
public Integer getDeadline() {
return this.deadline;
}
public Long getActualat() {
return this.actualat;
}
public String description() {
return "["+super.time.getHour()+":"+super.time.getMinute()+":"+super.time.getSeconde()+"] (+"+super.time.getDelta()+") cpu id="+super.getCpu_id()+", pid="+super.getPid()+", tid="+super.getTid()+" "+this.getFlag()+" "+this.getState()+" "+this.getIndex()+" "+this.getTimes()+" "+this.getPrio()+" "+this.getPeriod()+" "+this.getDeadline()+" "+this.getActualat();
}
}
......@@ -45,6 +45,7 @@ PTASK_PRIORITY : 'ptask_priority';
PTASK_PERIOD : 'ptask_period';
PTASK_DEADLINE : 'ptask_deadline';
PTASK_OFFSET : 'ptask_offset';
PTASK_LASTAT : 'ptask_actual_at';
PTASK_STATE : QUOT('b_wait_period'|'e_wait_period'|'b_wait_activation'|'e_wait_activation'|'creation'|'activation')QUOT;
PTASK_FLAG : QUOT('DEFERRED'|'NOW')QUOT;
......
lexer grammar traceLexer;
@lexer::header {package com.parser.java;}
EQ : '=';
PLUS : '+';
DOT : '.';
COL : ':';
COM : ',';
LBRA : '[';
RBRA : ']';
LPAR : '(';
RPAR : ')';
LCBRA : '{';
RCBRA : '}';
QUOT : '"';
PTASK_TRACEPOINT : 'ptask_provider:ptask_tracepoint';
SCHED_SWITCH : 'sched_switch';
EXIT_CLONE : 'syscall_exit_clone';
ENTRY_CLONE : 'syscall_entry_clone';
CPU_ID : 'cpu_id';
PID : 'pid';
TID : 'tid';
RET : 'ret';
CLONE_FLAG : 'clone_flags';
NEWSP : 'newsp';
PARENT_TID : 'parent_tid';
CHILD_TID : 'child_tid';
PREV_COMM : 'prev_comm';
PREV_TID : 'prev_tid';
PREV_PRIO : 'prev_prio';
PREV_STATE : 'prev_state';
NEXT_COMM : 'next_comm';
NEXT_TID : 'next_tid';
NEXT_PRIO : 'next_prio';
PTASK_FLAG_F : 'ptask_flag';
PTASK_STATE_F : 'ptask_state';
PTASK_PID : 'ptask_pid';
PTASK_TID : 'ptask_tid';
PTASK_INDEX : 'ptask_index';
PTASK_TIME : 'ptask_time';
PTASK_PRIORITY : 'ptask_priority';
PTASK_PERIOD : 'ptask_period';
PTASK_DEADLINE : 'ptask_deadline';
PTASK_OFFSET : 'ptask_offset';
PTASK_LASTAT : 'ptask_lastat';
PTASK_STATE : QUOT('b_wait_period'|'e_wait_period'|'b_wait_activation'|'e_wait_activation'|'creation'|'activation')QUOT;
PTASK_FLAG : QUOT('DEFERRED'|'NOW')QUOT;
DELTA : ([0-9]'.'[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])|'?.?????????';
INT : [0-9]+;
SINT : '-'[0-9]+;
HEX : '0x'[0-9A-F]+;
ID : QUOT[A-Za-z0-9/:.)(~ _-]+QUOT;
HOSTNAME : [A-Za-z0-9-]+;
WS : [ \t\r\n]+ -> skip;
......@@ -21,9 +21,9 @@ trace returns [ trace tr ] :
{ $tr = new sched_switch($timestamp.t,$header.cpu_id,$context.cntx.get(0),$context.cntx.get(1),$prev_comm.text,$next_comm.text,$prev_tid.int,$next_tid.int,$prev_prio.text,$next_prio.text,$prev_state.int); }
| timestamp HOSTNAME PTASK_TRACEPOINT COL LCBRA header RCBRA COM LCBRA PTASK_PID EQ pid=INT COM PTASK_TID EQ tid=INT COM PTASK_INDEX EQ ptask_index=INT COM PTASK_FLAG_F EQ ptask_flag=PTASK_FLAG COM PTASK_STATE_F EQ ptask_state=PTASK_STATE COM PTASK_TIME EQ times=INT COM PTASK_PRIORITY EQ ptask_prio=INT COM PTASK_PERIOD EQ ptask_peri=INT COM PTASK_DEADLINE EQ ptask_dead=INT COM PTASK_OFFSET EQ ptask_offset=INT RCBRA
| timestamp HOSTNAME PTASK_TRACEPOINT COL LCBRA header RCBRA COM LCBRA PTASK_PID EQ pid=INT COM PTASK_TID EQ tid=INT COM PTASK_INDEX EQ ptask_index=INT COM PTASK_FLAG_F EQ ptask_flag=PTASK_FLAG COM PTASK_STATE_F EQ ptask_state=PTASK_STATE COM PTASK_TIME EQ times=INT COM PTASK_PRIORITY EQ ptask_prio=INT COM PTASK_PERIOD EQ ptask_peri=INT COM PTASK_DEADLINE EQ ptask_dead=INT COM PTASK_LASTAT EQ ptask_actual_at=sint RCBRA
{ $tr = new ptask_tracepoint($timestamp.t,$header.cpu_id,$pid.int,$tid.int,$ptask_flag.text,$ptask_state.text,$ptask_index.int,$times.text,$ptask_prio.int,$ptask_peri.int,$ptask_dead.int,$ptask_offset.int); }
{ $tr = new ptask_tracepoint($timestamp.t,$header.cpu_id,$pid.int,$tid.int,$ptask_flag.text,$ptask_state.text,$ptask_index.int,$times.text,$ptask_prio.int,$ptask_peri.int,$ptask_dead.int,$ptask_actual_at.text); }
;
......
parser grammar traceParser;
@header {
package com.parser.java;
import com.event.*;
}
options {tokenVocab=traceLexer;}
start returns [ List<trace> traces ] : { $traces = new ArrayList<>(); } (trace { $traces.add($trace.tr); })* EOF;
trace returns [ trace tr ] :
timestamp HOSTNAME ENTRY_CLONE COL LCBRA header RCBRA COM LCBRA context RCBRA COM LCBRA CLONE_FLAG EQ clone_flag=HEX COM NEWSP EQ newsp=HEX COM PARENT_TID EQ ptid=HEX COM CHILD_TID EQ ctid=HEX RCBRA
{ $tr = new clone_entry($timestamp.t,$header.cpu_id,$context.cntx.get(0),$context.cntx.get(1),$clone_flag.text,$newsp.text,$ptid.text,$ctid.text); }
| timestamp HOSTNAME EXIT_CLONE COL LCBRA header RCBRA COM LCBRA context RCBRA COM LCBRA RET EQ ret=INT RCBRA
{ $tr = new clone_exit($timestamp.t,$header.cpu_id,$context.cntx.get(0),$context.cntx.get(1),$ret.int); }
| timestamp HOSTNAME SCHED_SWITCH COL LCBRA header RCBRA COM LCBRA context RCBRA COM LCBRA PREV_COMM EQ prev_comm=comm COM PREV_TID EQ prev_tid=INT COM PREV_PRIO EQ prev_prio=sint COM PREV_STATE EQ prev_state=INT COM NEXT_COMM EQ next_comm=comm COM NEXT_TID EQ next_tid=INT COM NEXT_PRIO EQ next_prio=sint RCBRA
{ $tr = new sched_switch($timestamp.t,$header.cpu_id,$context.cntx.get(0),$context.cntx.get(1),$prev_comm.text,$next_comm.text,$prev_tid.int,$next_tid.int,$prev_prio.text,$next_prio.text,$prev_state.int); }
| timestamp HOSTNAME PTASK_TRACEPOINT COL LCBRA header RCBRA COM LCBRA PTASK_PID EQ pid=INT COM PTASK_TID EQ tid=INT COM PTASK_INDEX EQ ptask_index=INT COM PTASK_FLAG_F EQ ptask_flag=PTASK_FLAG COM PTASK_STATE_F EQ ptask_state=PTASK_STATE COM PTASK_TIME EQ times=INT COM PTASK_PRIORITY EQ ptask_prio=INT COM PTASK_PERIOD EQ ptask_peri=INT COM PTASK_DEADLINE EQ ptask_dead=INT COM PTASK_LASTAT EQ ptask_lastat=sint RCBRA
{ $tr = new ptask_tracepoint($timestamp.t,$header.cpu_id,$pid.int,$tid.int,$ptask_flag.text,$ptask_state.text,$ptask_index.int,$times.text,$ptask_prio.int,$ptask_peri.int,$ptask_dead.int,$ptask_lastat.text); }
;
timestamp returns [ time_trace t ] :
LBRA h=INT COL m=INT COL s=INT DOT os=INT RBRA LPAR PLUS delta=DELTA RPAR
{ $t = new time_trace($h.int,$m.int,$s.int,$os.text,$delta.text); } ;
header returns [ Integer cpu_id ] :
CPU_ID EQ cpuid=INT
{ $cpu_id = $cpuid.int; } ;
context returns [ List<Integer> cntx ] :
PID EQ pid=INT COM TID EQ tid=INT
{ $cntx = new ArrayList<Integer>(2);
$cntx.add(0,$pid.int);
$cntx.add(1,$tid.int); } ;
comm : ID;
sint : INT|SINT;
/****************************************************************************
* Class: printer_service() *
* Parameters: task service class, svg generator *
* Autor: ael-mess *
* Description: generates the svg file and draw the actions *
****************************************************************************/
package com.printer;
import com.task.*;
import java.io.IOException;
import java.lang.OutOfMemoryError;
import java.util.List;
import java.util.ArrayList;
import java.awt.Color;
import org.w3c.dom.svg.SVGDocument;
import org.w3c.dom.Element;
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, String[] args) throws IOException, NullPointerException, OutOfMemoryError {
try {
this.tasks = t;
this.svg = new svggen(t, out);
System.out.println("SVG file generated in build/");
this.Externset(Double.valueOf(args[2]), Double.valueOf(args[3]), Boolean.valueOf(args[4]), Boolean.valueOf(args[5]));
System.out.println("extern set");
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();
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");
} catch(NullPointerException e) {
throw new NullPointerException("Null pointer parameter");
} catch (OutOfMemoryError e) {
System.err.println("Exception in thread \"main\" java.lang.OutOfMemoryError: Java heap space: failed reallocation (too many events in the trace file)\n at com.printer.printer_service.<init>(printer_service.java:46)\n at com.main.main(main.java:30)");
System.exit(2);
}
}
// for external informations
public void Externset(Double scale, Double task_h, Boolean osactive, Boolean cpu) throws NullPointerException {
this.svg.setScale(scale);
this.svg.setTask_hei(task_h);
this.svg.setOsactive(osactive);
this.svg.setPercpu(cpu);
}
// drawing tasks jobs calling tooltips (param: h) height 6/2 smaller
public void draw_tasks() throws NullPointerException {
double w = 0.0;
double x = 0.0;
double y = this.svg.getTask_hei();
int job = 0;
boolean started = false;
boolean switched = false;
int os_preem = 0;
String text1 = "", text2 = "";
for(Integer id : this.svg.getCpu()) {
for(task t : this.svg.getTasks()) if(t.getCpu_id().equals(id)) {
job = 0;
for(t_event t_e : t.getEvents()) {
switch(t_e.getType()) {
case START :
if(!started) {
job++;
started = true;
x = (t_e.getValue() - this.svg.getStart())*this.svg.getScale();
text1 = "("+job+") 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;
text1 += " ("+os_preem+" os preem)";
text2 += " to "+((t_e.getValue()-this.svg.getStart())*1000.0)+"ms";
this.svg.getForm().jobNS(this.root, this.svg.getDoc(), x, this.curH*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;
text1 += " ("+os_preem+" os preem)";
text2 += " to "+((t_e.getValue()-this.svg.getStart())*1000.0)+"ms";
this.svg.getForm().jobNS(this.root, this.svg.getDoc(), x, this.curH*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();
text1 = "("+job+") 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(!this.svg.isPercpu()) this.curH++;
}
if(this.svg.isPercpu()) this.curH++;
}
}
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 y = this.svg.getTask_hei();
boolean started = false;
String text1 = "", text2 = "";
for(t_event t_e : this.svg.getApp().getEvents()) {
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;
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();
}
break;
}
}
this.curH++;
}
// drawing os activity (param: h)
public void draw_os() throws NullPointerException {
double w = 0.0;
double x = 0.0;
double y = this.svg.getTask_hei();
boolean started = false;
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) {
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, this.curH*y, w, y, "blue", text1, text2);
}
break;
case SWITCH_IN :
if(!started) {
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++;
}
}
}
......@@ -168,7 +168,6 @@ public class svggen {
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(75, 0);
......@@ -202,7 +201,8 @@ public class svggen {
// using the last period for axis info (1 for 2 period)
private void setTInfo() throws NullPointerException {
this.curH = 0;
int period = 0, deadline = 0, offset=0;
int period = 0, deadline = 0;
long actualat=0;
Double start = null;
if(!this.percpu) {
if(this.osactive) this.curH = 1 + os.size();
......@@ -210,23 +210,16 @@ public class svggen {
for(Integer id : this.cpu) {
this.f.line(this.curH*this.task_hei, this.width);
for(task t : this.tasks) if(t.getCpu_id().equals(id)) {
period = t.getPeriod();
deadline = t.getDeadline();
offset = t.getOffset();
start = t.getStart();
if(t.isPeriodic()) {
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((offset/1000000.0 + (nb_period/1000000.0)*period)*this.scale, (1+this.curH)*this.task_hei, this.curH*this.task_hei);
this.f.deadLine((offset/1000000.0 + ((nb_period*period+deadline)/1000000.0))*this.scale, (1+this.curH)*this.task_hei, this.curH*this.task_hei);
}
}
for(t_event t_e : t.getEvents()) {
if(t_e.getType().equals(Types.ACTIVATION) && deadline!=0)
boolean testaperiodic = !t.isPeriodic() && t_e.getType().equals(Types.START);
boolean testperiodic = t.isPeriodic() && t_e.getType().equals(Types.FINISH);
if ( (testperiodic || testaperiodic) && deadline!=0)
{
this.f.wakeLine((t_e.getValue()-this.start)*this.scale, (1+this.curH)*this.task_hei, this.curH*this.task_hei);
this.f.deadLine((t_e.getValue()+(deadline/1000000.0)-this.start)*this.scale, (1+this.curH)*this.task_hei, this.curH*this.task_hei);
this.f.wakeLine((t_e.getActualat()/1000000.0)*this.scale, (1+this.curH)*this.task_hei, this.curH*this.task_hei);
this.f.deadLine( ((t_e.getActualat()+deadline)/1000000.0)*this.scale, (1+this.curH)*this.task_hei, this.curH*this.task_hei);
}
}
this.curH++;
}
......
/****************************************************************************
* Class: svggen() *
* Parameters: svg generation parameters *
* Autor: ael-mess *
* Description: creates svg document and sets the canvas and the infos *
****************************************************************************/
package com.printer;
import com.task.*;
import java.io.Writer;
import java.io.FileWriter;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.lang.NullPointerException;
import java.util.ArrayList;
import java.util.List;
import java.awt.Graphics2D;
import java.awt.Dimension;
import java.awt.Font;
import org.apache.batik.svggen.SVGGraphics2D;
import org.apache.batik.svggen.SVGGeneratorContext;
import org.apache.batik.anim.dom.SVGDOMImplementation;
import org.w3c.dom.svg.SVGDocument;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Element;
public class svggen {
protected SVGDocument doc = null;
protected SVGGeneratorContext ctx = null;
protected SVGGraphics2D svgGenerator = null;
protected form f = null;
protected Double start = 0.0;
protected Double height = 0.0;
protected Double width = 0.0;
protected Double scale = 1000.0;
protected Double task_hei = 20.0;
protected List<task> tasks = null;
protected List<app> os = null;
protected List<Integer> cpu = null;
protected Writer out = null;
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 {
DOMImplementation domImpl = SVGDOMImplementation.getDOMImplementation();
String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;//"http://www.w3.org/2000/svg";
this.doc = (SVGDocument) domImpl.createDocument(svgNS, "svg", null);
this.ctx = SVGGeneratorContext.createDefault(this.doc);
ctx.setComment("SVG created for ptask apps");
this.svgGenerator = new SVGGraphics2D(ctx, false);
this.f = new form((Graphics2D)this.svgGenerator);
this.tasks = serv.getTasks();
this.main = serv.getMain_task();
this.os = serv.getOs_task();
this.cpu = serv.getCpu();
if(this.main.getStart()==null) this.start = this.os.get(0).getStart();
else this.start = this.main.getStart();
this.width = (serv.getEnd() - this.start);
this.out = new FileWriter(out);
} catch(IOException e) {
throw new FileNotFoundException("SVG file "+out+" can not be created");
} catch(NullPointerException e) {
throw new NullPointerException("Null pointer parameter");
}
}
public SVGDocument getDoc() {
return this.doc;
}
public SVGGraphics2D getGraph() {
return this.svgGenerator;
}
public Double getStart() {
return this.start;
}
public Double getTask_hei() {
return this.task_hei;
}
public Double getHeight() {
return this.height;
}
public Double getWidth() {
return this.width;
}
public Double getScale() {
return this.scale;
}
public List<task> getTasks() {
return this.tasks;
}
public form getForm() {
return this.f;
}
public List<app> getOs() {
return this.os;
}
public app getApp() {
return this.main;
}
public Integer getCurH() {
return this.curH;
}
public List<Integer> getCpu() {
return this.cpu;
}
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;
}
public Boolean isPercpu() {
return this.percpu;
}
public void setScale(Double scale) {
this.scale = scale;
}
public void setTask_hei(Double th) {
this.task_hei = th;
}
public void setOsactive(Boolean act) {
this.osactive = act;
}
public void setPercpu(Boolean act) {
this.percpu = act;
}
// setting the canvas with 50/2 height and 150/2 width plus
public void setCanvas() throws NullPointerException {
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(75, 0);
this.setTInfo();
}
// setting info text for canvas (param: h, dist from x=0)
private void setText() throws NullPointerException {
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*(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*(this.curH+0.5)));
this.curH++;
}
else for(Integer id : this.cpu) for(task t : this.tasks) if(t.getCpu_id().equals(id)) {
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 {
this.curH = 0;
int period = 0, deadline = 0;
long actualat=0;
Double start = null;
if(!this.percpu) {
if(this.osactive) this.curH = 1 + os.size();
else this.curH = 2;
for(Integer id : this.cpu) {
this.f.line(this.curH*this.task_hei, this.width);
for(task t : this.tasks) if(t.getCpu_id().equals(id)) {
deadline = t.getDeadline();
for(t_event t_e : t.getEvents()) {
boolean testaperiodic = !t.isPeriodic() && t_e.getType().equals(Types.START);
boolean testperiodic = t.isPeriodic() && t_e.getType().equals(Types.FINISH);
if ( (testperiodic || testaperiodic) && deadline!=0)
{
this.f.wakeLine((t_e.getActualat()/1000000.0)*this.scale, (1+this.curH)*this.task_hei, this.curH*this.task_hei);
this.f.deadLine( ((t_e.getActualat()+deadline)/1000000.0)*this.scale, (1+this.curH)*this.task_hei, this.curH*this.task_hei);
}
}
this.curH++;
}
}
}
else this.curH++;
period = this.tasks.get(0).getPeriod();
this.f.axis(this.width, this.height, period*this.scale/1000000.0);
this.svgGenerator.setFont(Font.decode("arial-plain-3"));
for(int nb_period=0; ((nb_period/1000000.0)*period*this.scale*2)<this.width; nb_period+=1)
this.svgGenerator.drawString(""+String.format("%.3f", ((nb_period/1000.0)*period*2))+"ms", (float)((nb_period/1000000.0)*period*this.scale*2.0f), (float)(this.height+5.0f));
this.f.setFont();
}
public void streamOut(Element root) throws NullPointerException, IOException {
try {
this.svgGenerator.stream(root, this.out);
this.out.close();
} catch(IOException e) {
throw new FileNotFoundException("SVG file "+this.out+" can not be closed");
}
}
}
......@@ -13,7 +13,7 @@ public class t_event {
protected Integer np_tid = null;
protected String np_name = null;
protected Boolean pass = null;
protected Integer offset = null;
protected Long actualat = null;
//differents construcors for all Types of t_events
......@@ -22,10 +22,17 @@ public class t_event {
this.value = value;
}
public t_event(Integer offset, Types type, Double value) {
public t_event(Long actualat, Types type, Double value) {
this.type = type;
this.value = value;
this.offset = offset;
this.actualat = actualat;
}
public t_event(Long actualat, Types type, Double value, Boolean pass) {
this.type = type;
this.value = value;
this.pass = pass;
this.actualat = actualat;
}
public t_event(Types type, Double value, Boolean pass) {
......@@ -59,8 +66,8 @@ public class t_event {
return this.np_tid;
}
public Integer getOffset() {
return this.offset;
public Long getActualat() {
return this.actualat;
}
public String getNp_name() {
......
/****************************************************************************
* Class: t_event() *
* Parameters: the time task parameters *
* Autor: ael-mess *
* Description: represents the parameters required for timing *
****************************************************************************/
package com.task;
public class t_event {
protected Double value = null;
protected Types type = null;
protected Integer np_tid = null;
protected String np_name = null;
protected Boolean pass = null;
protected Long actualat = null;
//differents construcors for all Types of t_events
public t_event(Types type, Double value) {
this.type = type;
this.value = value;
}
public t_event(Long actualat, Types type, Double value) {
this.type = type;
this.value = value;
this.actualat = actualat;
}
public t_event(Long actualat, Types type, Double value, Boolean pass) {
this.type = type;
this.value = value;
this.pass = pass;
this.actualat = actualat;
}
public t_event(Types type, Double value, Boolean pass) {
this.type = type;
this.value = value;
this.pass = pass;
}
public t_event(Types type, Double value, Integer tid) {
this.type = type;
this.value = value;
this.np_tid = tid;
}
public t_event(Types type, Double value, Integer tid, String name) {
this.type = type;
this.value = value;
this.np_tid = tid;
this.np_name = name;
}
public Double getValue() {
return this.value;
}
public Types getType() {
return this.type;
}
public Integer getNp_tid() {
return this.np_tid;
}
public Integer getActualat() {
return this.actualat;
}
public String getNp_name() {
return this.np_name;
}
public Boolean isPassed() {
return this.pass;
}
public String description() {
return ""+this.getType().toString()+":"+this.getValue()+":"+this.getNp_tid()+":"+this.getNp_name()+":"+this.isPassed();
}
}
......@@ -20,7 +20,7 @@ public class task {
protected Integer cpu_id = null;
protected Integer period = null;
protected Integer deadline = null;
protected Integer offset = null;
protected Long actualat = null;
protected Double start = null;
protected Boolean state = false;
protected Boolean periodic = false;
......@@ -53,8 +53,8 @@ public class task {
public Integer getDeadline() {
return this.deadline;
}
public Integer getOffset(){
return this.offset;
public Long getActualat(){
return this.actualat;
}
public Double getStart() {
......@@ -101,8 +101,8 @@ public class task {
this.deadline = deadline;
}
public void setOffset(Integer offset) {
this.offset = offset;
public void setActualat(Long actualat) {
this.actualat = actualat ;
}
public void setStart(Double start) {
......
/****************************************************************************
* Class: task() *
* Parameters: all the task thread parameters *
* Autor: ael-mess *
* Description: represents the parameters required for the tasks thread *
****************************************************************************/
package com.task;
import java.awt.Color;
import java.util.Random;
import java.util.ArrayList;
import java.util.List;
import java.util.Iterator;
public class task {
protected Integer id = null;
protected Integer name = null;
protected Color color = null;
protected Integer cpu_id = null;
protected Integer period = null;
protected Integer deadline = null;
protected Integer lastat = null;
protected Double start = null;
protected Boolean state = false;
protected Boolean periodic = false;
protected List<t_event> events = null;
public Integer getId() {
return this.id;
}
public Integer getName() {
return this.name;
}
public Color getColor() {
return this.color;
}
public String getColorS() {
return "rgb("+this.color.getRed()+","+this.color.getGreen()+","+this.color.getBlue()+")";
}
public Integer getCpu_id() {
return this.cpu_id;
}
public Integer getPeriod() {
return this.period;
}
public Integer getDeadline() {
return this.deadline;
}
public Integer getLastat(){
return this.lastat;
}
public Double getStart() {
return this.start;
}
public Boolean isPeriodic() {
return this.periodic;
}
public Boolean isActivated() {
return this.state;
}
public List<t_event> getEvents() {
return this.events;
}
public void setId(Integer id) {
this.id = id;
}
public void setName(Integer name) {
this.name = name;
}
public void setColor() {
Random randomGenerator = new Random();
int r = randomGenerator.nextInt(256);
int g = randomGenerator.nextInt(256);
int b = randomGenerator.nextInt(256);
this.color = (new Color(r,g,b)).darker();
}
public void setCpu_id(Integer id) {
this.cpu_id = id;
}
public void setPeriod(Integer period) {
this.period = period;
}
public void setDeadline(Integer deadline) {
this.deadline = deadline;
}
public void setLastat(Integer lastat) {
this.lastat = lastat ;
}
public void setStart(Double start) {
this.start = start;
}
public void setPeriodic(Boolean state) {
this.periodic = state;
}
public void setState(Boolean state) {
this.state = state;
}
public void setEvents(List<t_event> events) {
this.events = events;
}
public String description() {
String ret = "id: "+this.getId()+" idx: "+this.getName()+" ("+this.getColor().toString()+this.isActivated()+") cpu id="+this.getCpu_id()+" period="+this.getPeriod()+" deadline="+this.getDeadline()+" start="+this.getStart()+"\n";
ret += "[ ";
for(t_event ev : this.events) ret += ev.description()+", ";
ret += "]";
return ret;
}
// checking if the events are correctly imported (used in task_service)
public void check_events() {
int job = 0, preep = 0;
int job_e = 0, preep_e = 0;
boolean started = false;
Iterator<t_event> it = this.getEvents().iterator();
t_event evt = it.next();
while(it.hasNext()) {
evt = it.next();
if(this.getEvents().get(this.getEvents().indexOf(evt)-1).getType().equals(evt.getType())) System.err.println(" bad time event "+this.getEvents().indexOf(evt)+" for next task");
if(evt.getType().equals(Types.START)) { started = true; job++; }
else if(evt.getType().equals(Types.FINISH)) { started = false; job_e++; }
else if(evt.getType().equals(Types.SWITCH_IN) && started) preep++;
else if(evt.getType().equals(Types.SWITCH_OUT) && started) preep_e++;
}
System.err.println(" tid: "+this.getId()+" idx: "+this.getName()+" cpu="+this.getCpu_id()+" period="+this.getPeriod()+" deadline="+this.getDeadline()+" start="+this.getStart()+"\n jobs:"+job+"/"+job_e+" preemption:"+preep+"/"+preep_e);
it = null;
}
public String getInfo() {
int preem = 0, job = 0;
for(t_event ev : this.events) { if(ev.isPassed()!=null && !ev.isPassed()) preem++; if(ev.getType().equals(Types.FINISH)) job++; }
return " task"+this.getName()+" TID:"+this.getId()+", cpu id:"+this.getCpu_id()+", period:"+this.getPeriod()/1000.0+"ms, deadline:"+this.getDeadline()/1000.0+"ms, start:"+this.getStart()+", jobs:"+job+", missed deadline:"+preem;
}
}
......@@ -105,7 +105,7 @@ public class task_service {
t.setName(((ptask_tracepoint) tr).getIndex());
t.setPeriod(((ptask_tracepoint) tr).getPeriod());
t.setDeadline(((ptask_tracepoint) tr).getDeadline());
t.setOffset(((ptask_tracepoint) tr).getOffset());
t.setActualat(((ptask_tracepoint) tr).getActualat());
t.setColor();
this.setEvents(t);
}
......@@ -167,8 +167,8 @@ public class task_service {
if(t.isActivated()) {
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())<((period+t.getDeadline())/1000000.0)));
else events.add(new t_event(Types.FINISH, tr.getTime().getTime("seconde")));
if(t.getStart() != null) events.add(new t_event(((ptask_tracepoint)tr).getActualat(),Types.FINISH, tr.getTime().getTime("seconde"), (tr.getTime().getTime("seconde")-t.getStart())<((((ptask_tracepoint)tr).getActualat()+t.getDeadline())/1000000.0)));
else events.add(new t_event(((ptask_tracepoint)tr).getActualat(), Types.FINISH, tr.getTime().getTime("seconde")));
t.setPeriodic(true);
}
else if(((ptask_tracepoint) tr).getState().equals("\"e_wait_period\"")) {
......@@ -177,17 +177,18 @@ public class task_service {
t.setPeriodic(true);
}
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")-defwake)<(t.getDeadline()/1000000.0)));
if(t.getStart() != null) events.add(new t_event(Types.FINISH, tr.getTime().getTime("seconde"), (tr.getTime().getTime("seconde")-defwake)<(((ptask_tracepoint)tr).getActualat()+t.getDeadline())/1000000.0));
else events.add(new t_event( Types.FINISH, tr.getTime().getTime("seconde")));
t.setState(false);
}
}
else if(((ptask_tracepoint) tr).getState().equals("\"activation\"")) {
events.add(new t_event(Types.ACTIVATION, tr.getTime().getTime("seconde")));
}
/*else if(((ptask_tracepoint) tr).getState().equals("\"activation\"")) {
events.add(new t_event(((ptask_tracepoint)tr).getActualat(),Types.ACTIVATION, tr.getTime().getTime("seconde")));
}
*/
else if(((ptask_tracepoint) tr).getState().equals("\"e_wait_activation\"")) {
t.setState(true);
if(once) {
......@@ -196,7 +197,7 @@ public class task_service {
}
else period += t.getPeriod();
once = false;
events.add(new t_event(Types.START, tr.getTime().getTime("seconde")));
events.add(new t_event(((ptask_tracepoint)tr).getActualat(),Types.START, tr.getTime().getTime("seconde")));
defwake = tr.getTime().getTime("seconde");
}
}
......
/****************************************************************************
* Class: task_service() *
* Parameters: traces pointer, tasks pointer, and infos *
* Autor: ael-mess *
* Description: truns the traces into tasks, main thread, and os apps *
****************************************************************************/
package com.task;
import com.event.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Iterator;
import java.awt.Color;
import java.lang.NullPointerException;
public class task_service {
protected List<task> tasks = null;
protected List<trace> traces = null;
protected List<Integer> cpu = null;
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, String[] args) throws NullPointerException {
try {
this.traces = traces;
this.tasks = new ArrayList<>();
this.cpu = 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());
}
String ret = "Actions performed in cpu: ";
for(Integer id : this.cpu) ret += id+", ";
System.out.println(ret);
this.setMain_task();
this.setOs_task();
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)");
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 :");
for(task t : this.tasks) System.out.println(t.getInfo());
if(this.tasks.size()==0) throw new NullPointerException("No tasks detected");
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 Boolean Externset(String name, Integer pid) throws NullPointerException {
this.main_task.setName(name);
return this.main_task.getId().equals(pid);
}
// setting the os activity per cpu in this list
private void setOs_task() throws NullPointerException {
this.os = new ArrayList<>();
app proc;
for(Integer id : this.cpu) {
proc = new app();
proc.setStart(this.traces.get(0).getTime().getTime("seconde"));
proc.setId(id);
proc.setCpu_id(id);
proc.setColor();
this.setOs_events(proc, id);
os.add(proc);
}
this.end = this.traces.get(this.traces.size()-1).getTime().getTime("seconde");
}
// setting the main thread in this list
private void setMain_task() throws NullPointerException {
this.main_task = new app();
Iterator<trace> it = this.traces.iterator();
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();
this.setApp_events();
it = null;
}
// setting the tasks threads in this list
private void setTask(trace tr) throws NullPointerException {
task t = new task();
this.tasks.add(t);
t.setId(tr.getTid());
t.setCpu_id(tr.getCpu_id());
t.setName(((ptask_tracepoint) tr).getIndex());
t.setPeriod(((ptask_tracepoint) tr).getPeriod());
t.setDeadline(((ptask_tracepoint) tr).getDeadline());
t.setActualat(((ptask_tracepoint) tr).getActualat());
t.setColor();
this.setEvents(t);
}
public List<Integer> getCpu() {
return this.cpu;
}
public List<Integer> getTids() {
return this.tids;
}
public List<task> getTasks() {
return this.tasks;
}
public app getMain_task() {
return this.main_task;
}
public List<app> getOs_task() {
return this.os;
}
public Double getEnd() {
return this.end;
}
// checking events errors in events importation (used only in debug)
public void check_events() {
t_event evt;
for(task t : this.tasks) t.check_events();
for(app proc : this.os) proc.check_events();
this.main_task.check_events();
}
// setting task events
private void setEvents(task t) throws NullPointerException {
List<t_event> events = new ArrayList<>();
int i = 0, idx = 0;
boolean once = true;
Double period = 0.0;
Double defwake = 0.0;
for(trace tr : this.traces) {
i = 0;
if(t.getId().equals(tr.getTid())) {
if(tr instanceof clone_exit && (((clone_exit) tr).getRet().equals(0))) {
t.setStart(tr.getTime().getTime("seconde"));
idx = i;
}
else if(tr instanceof ptask_tracepoint) {
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 = 0.0;
once = false;
}
i++;
if(t.isActivated()) {
if( ((ptask_tracepoint) tr).getState().equals("\"b_wait_period\"")) {
if(t.getStart() != null) events.add(new t_event(((ptask_tracepoint)tr).getActualat(),Types.FINISH, tr.getTime().getTime("seconde"), (tr.getTime().getTime("seconde")-t.getStart())<((period+t.getDeadline())/1000000.0)));
else events.add(new t_event(((ptask_tracepoint)tr).getActualat(), Types.FINISH, tr.getTime().getTime("seconde")));
t.setPeriodic(true);
}
else if(((ptask_tracepoint) tr).getState().equals("\"e_wait_period\"")) {
events.add(new t_event( Types.START, tr.getTime().getTime("seconde")));
period += t.getPeriod();
t.setPeriodic(true);
}
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")-defwake)<(period+t.getDeadline())/1000000.0));
else events.add(new t_event( Types.FINISH, tr.getTime().getTime("seconde")));
t.setState(false);
}
}
/*else if(((ptask_tracepoint) tr).getState().equals("\"activation\"")) {
events.add(new t_event(((ptask_tracepoint)tr).getActualat(),Types.ACTIVATION, tr.getTime().getTime("seconde")));
}
*/
else if(((ptask_tracepoint) tr).getState().equals("\"e_wait_activation\"")) {
t.setState(true);
if(once) {
t.setStart(tr.getTime().getTime("seconde"));
period = 0.0;
}
else period += t.getPeriod();
once = false;
events.add(new t_event(((ptask_tracepoint)tr).getActualat(),Types.START, tr.getTime().getTime("seconde")));
defwake = tr.getTime().getTime("seconde");
}
}
else if(tr instanceof sched_switch) {
events.add(new t_event(Types.SWITCH_OUT, tr.getTime().getTime("seconde"), ((sched_switch) tr).getNext_tid()));
i++;
}
}
else if(tr instanceof sched_switch && t.getId().equals(((sched_switch) tr).getNext_tid())) {
events.add(new t_event(Types.SWITCH_IN, tr.getTime().getTime("seconde"), ((sched_switch) tr).getPrev_tid()));
i++;
}
}
t.setEvents(events);
}
// setting the os events
private void setOs_events(app proc, Integer id) throws NullPointerException {
List<t_event> events = new ArrayList<>();
for(trace tr : this.traces) if(tr instanceof sched_switch && tr.getCpu_id().equals(id)) {
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(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);
}
// setting the main app events
private void setApp_events() throws NullPointerException {
List<t_event> events = new ArrayList<>();
boolean once = true;
for(trace tr : this.traces) {
if(tr instanceof clone_exit && ((clone_exit) tr).getRet().equals(this.main_task.getId()) && once) {
this.main_task.setStart(tr.getTime().getTime("seconde"));
once = false;
}
else if(tr instanceof sched_switch) {
if(this.main_task.getId().equals(((sched_switch) tr).getNext_tid()))
events.add(new t_event(Types.SWITCH_IN, tr.getTime().getTime("seconde"), ((sched_switch) tr).getPrev_tid(), ((sched_switch) tr).getPrev_comm()));
else if(this.main_task.getId().equals(((sched_switch) tr).getPrev_tid()) && this.main_task.getId().equals(tr.getPid()))
events.add(new t_event(Types.SWITCH_OUT, tr.getTime().getTime("seconde"), ((sched_switch) tr).getNext_tid(), ((sched_switch) tr).getNext_comm()));
}
}
this.main_task.setEvents(events);
}
public String description() {
String ret = "";
for(task ta : this.tasks) ret += ta.description()+"\n";
for(app proc : this.os) ret += proc.description()+"\n";
ret += this.main_task.description()+"\n";
return ret;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment