gdunlap/sched-sim.hg

changeset 6:403bd7680df6

Add runstate printing, script to run and parse
author George Dunlap <gdunlap@xensource.com>
date Mon Oct 19 20:15:18 2009 +0100 (2009-10-19)
parents 18f3d6e25ffc
children e274ac3f81ff
files run.sh simulator.c
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/run.sh	Mon Oct 19 20:15:18 2009 +0100
     1.3 @@ -0,0 +1,8 @@
     1.4 +#!/bin/bash
     1.5 +./simulator --scheduler=credit01 --workload=Sx3 > /tmp/1
     1.6 +for C in credit runtime; do 
     1.7 +    for I in 0 1 2 ; do 
     1.8 +	grep -a "^$C v$I" /tmp/1 | awk '{print $3 " " $4;}' > /tmp/1.$C.$I.csv 
     1.9 +    done
    1.10 +    ygraph -c /tmp/1.$C.*.csv & 
    1.11 +done
     2.1 --- a/simulator.c	Mon Oct 19 20:14:47 2009 +0100
     2.2 +++ b/simulator.c	Mon Oct 19 20:15:18 2009 +0100
     2.3 @@ -258,6 +258,14 @@ void sim_sched_timer(int time, int pid)
     2.4      sim_insert_event(sim.now + time, EVT_TIMER, pid, 1);
     2.5  }
     2.6  
     2.7 +void dump_running(int now, struct vm *v)
     2.8 +{
     2.9 +    printf("runtime v%d %d %llu\n",
    2.10 +           v->vid,
    2.11 +           now,
    2.12 +           v->stats.state[RUNSTATE_RUNNING].cycles);
    2.13 +}
    2.14 +
    2.15  void sim_runstate_change(int now, struct vm *v, int new_runstate)
    2.16  {
    2.17      int ostate, nstate;
    2.18 @@ -288,6 +296,10 @@ void sim_runstate_change(int now, struct
    2.19  
    2.20      update_cycles(&v->stats.state[ostate], stime);
    2.21  
    2.22 +    if ( v->runstate == RUNSTATE_RUNNING
    2.23 +         || new_runstate == RUNSTATE_RUNNING )
    2.24 +        dump_running(now, v);
    2.25 +
    2.26  
    2.27      if ( v->runstate == RUNSTATE_RUNNING
    2.28           && new_runstate == RUNSTATE_RUNNABLE )