gdunlap/sched-sim.hg

annotate sim.h @ 17:03ad237559b4

Fix-up options, scheduler list
author George Dunlap <george.dunlap@eu.citrix.com>
date Fri Jul 16 11:58:53 2010 +0100 (2010-07-16)
parents 1d7310217c5a
children
rev   line source
gdunlap@0 1 #ifndef __SIM_H
gdunlap@0 2 #define __SIM_H
gdunlap@0 3
gdunlap@0 4 #include "stats.h"
gdunlap@1 5 #include "workload.h"
gdunlap@2 6 #include "sched.h"
gdunlap@0 7
gdunlap@0 8 enum runstate {
gdunlap@0 9 RUNSTATE_RUNNING,
gdunlap@0 10 RUNSTATE_RUNNABLE,
gdunlap@0 11 RUNSTATE_BLOCKED
gdunlap@0 12 };
gdunlap@0 13
gdunlap@0 14 enum {
gdunlap@0 15 STATE_RUN,
gdunlap@0 16 STATE_PREEMPT,
gdunlap@0 17 STATE_WAKE,
gdunlap@0 18 STATE_BLOCK,
gdunlap@0 19 STATE_MAX
gdunlap@0 20 };
gdunlap@0 21
gdunlap@0 22 struct vm
gdunlap@0 23 {
gdunlap@0 24 /* Public */
gdunlap@0 25 int vid;
gdunlap@0 26
gdunlap@0 27 enum runstate runstate;
gdunlap@0 28 int processor;
gdunlap@0 29
gdunlap@0 30 void *private;
gdunlap@0 31
gdunlap@0 32 /* State: i.e., runstate. Phase: "runnable" or "blocked". A single "runnable" phase may go through
gdunlap@0 33 * several "runnable" and "running" states. */
gdunlap@0 34 int state_start_time;
gdunlap@0 35 int time_this_phase;
gdunlap@0 36 int was_preempted;
gdunlap@0 37
gdunlap@0 38 struct {
gdunlap@0 39 struct cycle_summary state[STATE_MAX];
gdunlap@0 40 } stats;
gdunlap@0 41
gdunlap@0 42 int phase_index;
gdunlap@0 43 const struct sim_phase *e; /* Shortcut pointer to workload->list[phase_index] */
gdunlap@0 44 const struct vm_workload *workload;
gdunlap@0 45
gdunlap@0 46 };
gdunlap@0 47
gdunlap@1 48 #define MAX_PCPU 16
gdunlap@0 49 struct global_pcpu_data {
gdunlap@1 50 int count, idle;
gdunlap@0 51 struct pcpu {
gdunlap@0 52 int pid;
gdunlap@1 53 int idle; /* Indicates may be woken up if work appears */
gdunlap@0 54 struct vm* current;
gdunlap@0 55 } pcpus[MAX_PCPU];
gdunlap@0 56 };
gdunlap@0 57 extern struct global_pcpu_data P;
gdunlap@0 58
gdunlap@1 59
gdunlap@1 60 #ifdef VM_DATA_PUBLIC
gdunlap@1 61 struct global_vm_data {
gdunlap@1 62 int count;
gdunlap@1 63 struct vm vms[MAX_VMS];
gdunlap@1 64 };
gdunlap@1 65 extern struct global_vm_data V;
gdunlap@1 66 #endif
gdunlap@1 67
gdunlap@0 68 struct vm* vm_from_vid(int vid);
gdunlap@0 69 #define current(_pid) (P.pcpus[(_pid)].current)
gdunlap@0 70 void sim_sched_timer(int time, int pid);
gdunlap@0 71 void sim_runstate_change(int now, struct vm *v, int new_runstate);
gdunlap@0 72
gdunlap@0 73 #endif /* __SIM_H */
gdunlap@0 74