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

Ajout de l'offset dans les trace-points pour calculer les dates de réveil des tâches périodiques :

	Parser et Lexer complétés avec ce nouveau champ
	Nouveau champ dans les tasks dans les traces et dans les tasks
	Calcul des dates de réveil dans svggen.java à partir de cet offset

Ajout d'un nouveau trace-point pour les dates de réveil des tâches apériodiques :
	Nouveau type de t_event lors de la création d'event dans task-service (Activation)
	Récupération de la valeur du trace-point, soit la date d'activation de la tâche, afin de mettre à jour la date de réveil dans svggen.java
parent ac50201d
No related branches found
No related tags found
No related merge requests found
......@@ -17,8 +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;
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) {
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) {
BigInteger bigInt = new BigInteger(tim);
this.time = time;
......@@ -32,6 +33,7 @@ public class ptask_tracepoint extends userspace_tracepoint {
this.prio = prio;
this.period = peri;
this.deadline = dd;
this.offset = offset;
}
public String getFlag() {
......@@ -62,7 +64,11 @@ public class ptask_tracepoint extends userspace_tracepoint {
return this.deadline;
}
public Integer getOffset() {
return this.offset;
}
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();
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();
}
}
......@@ -44,8 +44,9 @@ PTASK_TIME : 'ptask_time';
PTASK_PRIORITY : 'ptask_priority';
PTASK_PERIOD : 'ptask_period';
PTASK_DEADLINE : 'ptask_deadline';
PTASK_OFFSET : 'ptask_offset';
PTASK_STATE : QUOT('b_wait_period'|'e_wait_period'|'b_wait_activation'|'e_wait_activation'|'creation')QUOT;
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])|'?.?????????';
......
......@@ -9,16 +9,25 @@ 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 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); }
| 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
{ $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); }
;
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); } ;
......
......@@ -202,7 +202,7 @@ 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;
int period = 0, deadline = 0, offset=0;
Double start = null;
if(!this.percpu) {
if(this.osactive) this.curH = 1 + os.size();
......@@ -212,23 +212,27 @@ public class svggen {
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((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*period+deadline)/1000000.0))*this.scale, (1+this.curH)*this.task_hei, this.curH*this.task_hei);
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);
}
}
else for(t_event t_e : t.getEvents()) if(t_e.getType().equals(Types.START) && deadline!=0) {
for(t_event t_e : t.getEvents()) {
if(t_e.getType().equals(Types.ACTIVATION) && 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.curH++;
}
}
}
else this.curH++;
period = this.tasks.get(0).getPeriod();
this.f.axis(this.width, this.height, period*this.scale/1000000.0);
......
package com.task;
public enum Types { START, FINISH, SWITCH_IN, SWITCH_OUT; }
public enum Types { START, FINISH, SWITCH_IN, SWITCH_OUT, ACTIVATION; }
......@@ -13,6 +13,7 @@ public class t_event {
protected Integer np_tid = null;
protected String np_name = null;
protected Boolean pass = null;
protected Integer offset = null;
//differents construcors for all Types of t_events
......@@ -21,6 +22,12 @@ public class t_event {
this.value = value;
}
public t_event(Integer offset, Types type, Double value) {
this.type = type;
this.value = value;
this.offset = offset;
}
public t_event(Types type, Double value, Boolean pass) {
this.type = type;
this.value = value;
......@@ -52,6 +59,10 @@ public class t_event {
return this.np_tid;
}
public Integer getOffset() {
return this.offset;
}
public String getNp_name() {
return this.np_name;
}
......
......@@ -20,6 +20,7 @@ public class task {
protected Integer cpu_id = null;
protected Integer period = null;
protected Integer deadline = null;
protected Integer offset = null;
protected Double start = null;
protected Boolean state = false;
protected Boolean periodic = false;
......@@ -52,6 +53,9 @@ public class task {
public Integer getDeadline() {
return this.deadline;
}
public Integer getOffset(){
return this.offset;
}
public Double getStart() {
return this.start;
......@@ -97,6 +101,10 @@ public class task {
this.deadline = deadline;
}
public void setOffset(Integer offset) {
this.offset = offset;
}
public void setStart(Double start) {
this.start = start;
}
......
......@@ -105,6 +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.setColor();
this.setEvents(t);
}
......@@ -180,7 +181,13 @@ public class task_service {
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("\"e_wait_activation\"")) {
t.setState(true);
if(once) {
......@@ -193,6 +200,7 @@ public class task_service {
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++;
......@@ -206,6 +214,7 @@ public class task_service {
t.setEvents(events);
}
// setting the os events
private void setOs_events(app proc, Integer id) throws NullPointerException {
List<t_event> events = new ArrayList<>();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment