Hi Korey,

I didn't see where you were using this feature, so I don't know if it
would work, but it would be much cleaner just to add another enum
value to the Event::Priority enum than to treat it like an integer and
add an offset to it.  With what you're doing here, you've got no
control over how large an offset someone might add, or how that might
interact with the other priority values that are for things outside
the CPU.

If that's not straightforward, let me know...

Thanks,

Steve

On Thu, Oct 1, 2009 at 1:08 PM, Korey Sewell <[email protected]> wrote:
> # HG changeset patch
> # User Korey Sewell <[email protected]>
> # Date 1254427253 14400
> # Node ID 93e33fd780edd3a4f1641e446495807d36b9c588
> # Parent  a829497e6ff5fd1962764b0c4717a32cbce5b7d9
> inorder: add event priority offset
> allow for events to schedule themselves later if desired. this is important
> because of cases like where you need to activate a thread only after the 
> previous
> thread has been deactivated. The ordering there has to be enforced
>
> diff --git a/src/cpu/inorder/cpu.cc b/src/cpu/inorder/cpu.cc
> --- a/src/cpu/inorder/cpu.cc
> +++ b/src/cpu/inorder/cpu.cc
> @@ -83,8 +83,10 @@
>  }
>
>  InOrderCPU::CPUEvent::CPUEvent(InOrderCPU *_cpu, CPUEventType e_type,
> -                             Fault fault, ThreadID _tid, DynInstPtr inst)
> -    : Event(CPU_Tick_Pri), cpu(_cpu)
> +                               Fault fault, ThreadID _tid, DynInstPtr inst,
> +                               unsigned event_pri_offset)
> +    : Event(Event::Priority((unsigned int)CPU_Tick_Pri + event_pri_offset)),
> +      cpu(_cpu)
>  {
>     setEvent(e_type, fault, _tid, inst);
>  }
> @@ -597,13 +599,14 @@
>  void
>  InOrderCPU::scheduleCpuEvent(CPUEventType c_event, Fault fault,
>                              ThreadID tid, DynInstPtr inst,
> -                             unsigned delay)
> +                             unsigned delay, unsigned event_pri_offset)
>  {
> -    CPUEvent *cpu_event = new CPUEvent(this, c_event, fault, tid, inst);
> +    CPUEvent *cpu_event = new CPUEvent(this, c_event, fault, tid, inst,
> +                                       event_pri_offset);
>
>     if (delay >= 0) {
> -        DPRINTF(InOrderCPU, "Scheduling CPU Event (%s) for cycle %i.\n",
> -                eventNames[c_event], curTick + delay);
> +        DPRINTF(InOrderCPU, "Scheduling CPU Event (%s) for cycle %i, 
> [tid:%i].\n",
> +                eventNames[c_event], curTick + delay, tid);
>         mainEventQueue.schedule(cpu_event,curTick + delay);
>     } else {
>         cpu_event->process();
> diff --git a/src/cpu/inorder/cpu.hh b/src/cpu/inorder/cpu.hh
> --- a/src/cpu/inorder/cpu.hh
> +++ b/src/cpu/inorder/cpu.hh
> @@ -203,7 +203,7 @@
>       public:
>         /** Constructs a CPU event. */
>         CPUEvent(InOrderCPU *_cpu, CPUEventType e_type, Fault fault,
> -                 ThreadID _tid, DynInstPtr inst);
> +                 ThreadID _tid, DynInstPtr inst, unsigned event_pri_offset);
>
>         /** Set Type of Event To Be Scheduled */
>         void setEvent(CPUEventType e_type, Fault _fault, ThreadID _tid,
> @@ -231,7 +231,7 @@
>
>     /** Schedule a CPU Event */
>     void scheduleCpuEvent(CPUEventType cpu_event, Fault fault, ThreadID tid,
> -                          DynInstPtr inst, unsigned delay = 0);
> +                          DynInstPtr inst, unsigned delay = 0, unsigned 
> event_pri_offset = 0);
>
>   public:
>     /** Interface between the CPU and CPU resources. */
> _______________________________________________
> m5-dev mailing list
> [email protected]
> http://m5sim.org/mailman/listinfo/m5-dev
>
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to