SST/macro
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
sstmac
backends
native
event_map.h
Go to the documentation of this file.
1
/*
2
* This file is part of SST/macroscale:
3
* The macroscale architecture simulator from the SST suite.
4
* Copyright (c) 2009 Sandia Corporation.
5
* This software is distributed under the BSD License.
6
* Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7
* the U.S. Government retains certain rights in this software.
8
* For more information, see the LICENSE file in the top
9
* SST/macroscale directory.
10
*/
11
12
#ifndef SSTMAC_BACKENDS_NATIVE_EVENTMAP_H_INCLUDED
13
#define SSTMAC_BACKENDS_NATIVE_EVENTMAP_H_INCLUDED
14
15
#include <
sstmac/common/sstmac_config.h
>
16
17
#include <
sstmac/backends/native/event_container.h
>
18
#include <
sstmac/common/sst_event.h
>
19
#include <
sstmac/common/timestamp.h
>
20
#include <
sstmac/common/event_scheduler.h
>
21
#include <cassert>
22
#include <map>
23
24
namespace
sstmac
{
25
namespace
native {
26
27
/**
28
* An event manager that relies on the eventcontainer template base class
29
* to manage events with a multimap template parameter.
30
*/
31
class
event_map
:
32
public
event_container
33
{
34
35
public
:
36
event_map
(
parallel_runtime
* rt) :
event_container
(rt){}
37
38
~event_map
()
throw
();
39
40
void
41
clear
(
timestamp
zero_time =
timestamp
(0));
42
43
void
44
cancel_all_messages
(
event_loc_id
mod);
45
46
bool
47
empty
()
const
{
48
return
queue_
.empty();
49
}
50
51
protected
:
52
friend
class
multithreaded_event_container
;
53
54
event_queue_entry
*
55
pop_next_event
();
56
57
void
58
add_event
(
event_queue_entry
* ev);
59
60
protected
:
61
struct
event_compare
{
62
bool
operator()
(
event_queue_entry
* lhs,
event_queue_entry
* rhs) {
63
bool
neq = lhs->
time
() != rhs->
time
();
64
if
(neq)
return
lhs->
time
() < rhs->
time
();
65
66
neq = lhs->
src_location
() != rhs->
src_location
();
67
if
(neq)
return
lhs->
src_location
() < rhs->
src_location
();
68
69
#if SSTMAC_SANITY_CHECK
70
assert(lhs->
seqnum
() != rhs->
seqnum
());
71
#endif
72
return
lhs->
seqnum
() < rhs->
seqnum
();
73
}
74
};
75
typedef
std::set<event_queue_entry*, event_compare>
queue_t
;
76
queue_t
queue_
;
77
78
};
79
80
}
81
}
// end of namespace sstmac
82
83
#endif
84
sstmac::native::event_map::~event_map
~event_map()
sstmac::event_queue_entry::seqnum
uint32_t seqnum() const
Definition:
sst_event.h:113
sstmac::native::event_map::cancel_all_messages
void cancel_all_messages(event_loc_id mod)
sst_event.h
sstmac::native::event_map::queue_t
std::set< event_queue_entry *, event_compare > queue_t
Definition:
event_map.h:75
sstmac::native::event_map::event_compare
Definition:
event_map.h:61
sstmac::native::event_map::event_map
event_map(parallel_runtime *rt)
Definition:
event_map.h:36
timestamp.h
sstmac::native::event_map::clear
void clear(timestamp zero_time=timestamp(0))
Clear all events and set time back to a zero of your choice.
sstmac::native::event_container
An event manager base class using standard containers.
Definition:
event_container.h:33
sstmac::event_loc_id
Definition:
event_location.h:9
sstmac::event_queue_entry::time
timestamp time() const
Definition:
sst_event.h:98
sstmac::native::event_map
An event manager that relies on the eventcontainer template base class to manage events with a multim...
Definition:
event_map.h:31
sstmac::native::multithreaded_event_container
Definition:
multithreaded_event_container.h:39
sstmac::timestamp
A basic container for time (subject to future transplant).
Definition:
timestamp.h:29
sstmac::native::event_map::add_event
void add_event(event_queue_entry *ev)
Called by schedule. Child class must implement.
sstmac::native::event_map::pop_next_event
event_queue_entry * pop_next_event()
sstmac
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
Definition:
parallel_runtime.h:18
sstmac::parallel_runtime
Definition:
parallel_runtime.h:20
event_scheduler.h
sstmac::native::event_map::queue_
queue_t queue_
Definition:
event_map.h:76
sstmac::native::event_map::empty
bool empty() const
Definition:
event_map.h:47
event_container.h
sstmac::native::event_map::event_compare::operator()
bool operator()(event_queue_entry *lhs, event_queue_entry *rhs)
Definition:
event_map.h:62
sstmac::event_queue_entry::src_location
event_loc_id src_location() const
Definition:
sst_event.h:123
sstmac::event_queue_entry
Definition:
sst_event.h:67
sstmac_config.h
Generated by
1.8.11