gdunlap/sched-sim.hg

view sim.h @ 2:1d7310217c5a

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