Deleted Added
sdiff udiff text old ( 11800:54436a1784dc ) new ( 11990:5fad911cc326 )
full compact
1/*
2 * Copyright (c) 2000-2005 The Regents of The University of Michigan
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * Copyright (c) 2013 Mark D. Hill and David A. Wood
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are

--- 53 unchanged lines hidden (view full) ---

62extern Tick simQuantum;
63
64//! Current number of allocated main event queues.
65extern uint32_t numMainEventQueues;
66
67//! Array for main event queues.
68extern std::vector<EventQueue *> mainEventQueue;
69
70#ifndef SWIG
71//! The current event queue for the running thread. Access to this queue
72//! does not require any locking from the thread.
73
74extern __thread EventQueue *_curEventQueue;
75
76#endif
77
78//! Current mode of execution: parallel / serial
79extern bool inParallelMode;
80
81//! Function for returning eventq queue for the provided
82//! index. The function allocates a new queue in case one
83//! does not exist for the index, provided that the index
84//! is with in bounds.
85EventQueue *getEventQueue(uint32_t index);

--- 265 unchanged lines hidden (view full) ---

351 /// Get the event priority
352 Priority priority() const { return _priority; }
353
354 //! If this is part of a GlobalEvent, return the pointer to the
355 //! Global Event. By default, there is no GlobalEvent, so return
356 //! NULL. (Overridden in GlobalEvent::BarrierEvent.)
357 virtual BaseGlobalEvent *globalEvent() { return NULL; }
358
359#ifndef SWIG
360 void serialize(CheckpointOut &cp) const override;
361 void unserialize(CheckpointIn &cp) override;
362#endif
363};
364
365#ifndef SWIG
366inline bool
367operator<(const Event &l, const Event &r)
368{
369 return l.when() < r.when() ||
370 (l.when() == r.when() && l.priority() < r.priority());
371}
372
373inline bool

--- 22 unchanged lines hidden (view full) ---

396 return l.when() == r.when() && l.priority() == r.priority();
397}
398
399inline bool
400operator!=(const Event &l, const Event &r)
401{
402 return l.when() != r.when() || l.priority() != r.priority();
403}
404#endif
405
406/**
407 * Queue of events sorted in time order
408 *
409 * Events are scheduled (inserted into the event queue) using the
410 * schedule() method. This method either inserts a <i>synchronous</i>
411 * or <i>asynchronous</i> event.
412 *

--- 71 unchanged lines hidden (view full) ---

484 //! Function for adding events to the async queue. The added events
485 //! are added to main event queue later. Threads, other than the
486 //! owning thread, should call this function instead of insert().
487 void asyncInsert(Event *event);
488
489 EventQueue(const EventQueue &);
490
491 public:
492#ifndef SWIG
493 /**
494 * Temporarily migrate execution to a different event queue.
495 *
496 * An instance of this class temporarily migrates execution to a
497 * different event queue by releasing the current queue, locking
498 * the new queue, and updating curEventQueue(). This can, for
499 * example, be useful when performing IO across thread event
500 * queues when timing is not crucial (e.g., during fast

--- 43 unchanged lines hidden (view full) ---

544 ~ScopedRelease()
545 {
546 eq.lock();
547 }
548
549 private:
550 EventQueue &eq;
551 };
552#endif
553
554 EventQueue(const std::string &n);
555
556 virtual const std::string name() const { return objName; }
557 void name(const std::string &st) { objName = st; }
558
559 //! Schedule the given event on this queue. Safe to call from any
560 //! thread.

--- 99 unchanged lines hidden (view full) ---

660 */
661 void checkpointReschedule(Event *event);
662
663 virtual ~EventQueue() { }
664};
665
666void dumpMainQueue();
667
668#ifndef SWIG
669class EventManager
670{
671 protected:
672 /** A pointer to this object's event queue */
673 EventQueue *eventq;
674
675 public:
676 EventManager(EventManager &em) : eventq(em.eventq) {}

--- 96 unchanged lines hidden (view full) ---

773 const std::string
774 name() const
775 {
776 return object->name() + ".wrapped_event";
777 }
778
779 const char *description() const { return "EventWrapped"; }
780};
781#endif
782
783#endif // __SIM_EVENTQ_HH__