diff options
| author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-05-16 13:10:50 -0400 |
|---|---|---|
| committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-05-17 09:29:05 -0400 |
| commit | 7cd7212e7273c9c137e4bb1825d2b9f3842c882d (patch) | |
| tree | e73b650eaed2868b12cb9c7c2150456e989d7a01 /native | |
| parent | 5cb503377c18b1c099c5b1a5375ece53fe25258e (diff) | |
C++: move shared RW locking defs into own file
Part of refactoring sharedres.cpp.
Diffstat (limited to 'native')
| -rw-r--r-- | native/include/blocking.h | 31 | ||||
| -rw-r--r-- | native/include/rw-blocking.h | 35 | ||||
| -rw-r--r-- | native/src/blocking/rw-phase-fair.cpp | 1 | ||||
| -rw-r--r-- | native/src/blocking/rw-task-fair.cpp | 1 | ||||
| -rw-r--r-- | native/src/sharedres.cpp | 2 |
5 files changed, 39 insertions, 31 deletions
diff --git a/native/include/blocking.h b/native/include/blocking.h index 0734d9d..b70f1a6 100644 --- a/native/include/blocking.h +++ b/native/include/blocking.h | |||
| @@ -82,37 +82,6 @@ Interference bound_blocking_all_clusters( | |||
| 82 | unsigned long interval, | 82 | unsigned long interval, |
| 83 | const TaskInfo* exclude_tsk); | 83 | const TaskInfo* exclude_tsk); |
| 84 | 84 | ||
| 85 | void split_by_type(const ContentionSet& requests, | ||
| 86 | ContentionSet& reads, | ||
| 87 | ContentionSet& writes); | ||
| 88 | void split_by_type(const Resources& resources, | ||
| 89 | Resources &reads, | ||
| 90 | Resources &writes); | ||
| 91 | void split_by_type(const ClusterResources& per_cluster, | ||
| 92 | ClusterResources &reads); | ||
| 93 | void split_by_type(const ClusterResources& per_cluster, | ||
| 94 | ClusterResources &reads, | ||
| 95 | ClusterResources &writes); | ||
| 96 | |||
| 97 | struct RWCount { | ||
| 98 | unsigned int res_id; | ||
| 99 | unsigned int num_reads; | ||
| 100 | unsigned int num_writes; | ||
| 101 | unsigned int rlength; | ||
| 102 | unsigned int wlength; | ||
| 103 | |||
| 104 | RWCount(unsigned int id) : res_id(id), | ||
| 105 | num_reads(0), | ||
| 106 | num_writes(0), | ||
| 107 | rlength(0), | ||
| 108 | wlength(0) | ||
| 109 | {} | ||
| 110 | }; | ||
| 111 | |||
| 112 | typedef std::vector<RWCount> RWCounts; | ||
| 113 | |||
| 114 | void merge_rw_requests(const TaskInfo &tsk, RWCounts &counts); | ||
| 115 | |||
| 116 | extern const unsigned int UNLIMITED; | 85 | extern const unsigned int UNLIMITED; |
| 117 | 86 | ||
| 118 | #endif | 87 | #endif |
diff --git a/native/include/rw-blocking.h b/native/include/rw-blocking.h new file mode 100644 index 0000000..d4463f7 --- /dev/null +++ b/native/include/rw-blocking.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | #ifndef RW_BLOCKING_H | ||
| 2 | #define RW_BLOCKING_H | ||
| 3 | |||
| 4 | void split_by_type(const ContentionSet& requests, | ||
| 5 | ContentionSet& reads, | ||
| 6 | ContentionSet& writes); | ||
| 7 | void split_by_type(const Resources& resources, | ||
| 8 | Resources &reads, | ||
| 9 | Resources &writes); | ||
| 10 | void split_by_type(const ClusterResources& per_cluster, | ||
| 11 | ClusterResources &reads); | ||
| 12 | void split_by_type(const ClusterResources& per_cluster, | ||
| 13 | ClusterResources &reads, | ||
| 14 | ClusterResources &writes); | ||
| 15 | |||
| 16 | struct RWCount { | ||
| 17 | unsigned int res_id; | ||
| 18 | unsigned int num_reads; | ||
| 19 | unsigned int num_writes; | ||
| 20 | unsigned int rlength; | ||
| 21 | unsigned int wlength; | ||
| 22 | |||
| 23 | RWCount(unsigned int id) : res_id(id), | ||
| 24 | num_reads(0), | ||
| 25 | num_writes(0), | ||
| 26 | rlength(0), | ||
| 27 | wlength(0) | ||
| 28 | {} | ||
| 29 | }; | ||
| 30 | |||
| 31 | typedef std::vector<RWCount> RWCounts; | ||
| 32 | |||
| 33 | void merge_rw_requests(const TaskInfo &tsk, RWCounts &counts); | ||
| 34 | |||
| 35 | #endif RW_BLOCKING_H | ||
diff --git a/native/src/blocking/rw-phase-fair.cpp b/native/src/blocking/rw-phase-fair.cpp index 65b85b4..d7705d7 100644 --- a/native/src/blocking/rw-phase-fair.cpp +++ b/native/src/blocking/rw-phase-fair.cpp | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #include "sharedres.h" | 1 | #include "sharedres.h" |
| 2 | #include "blocking.h" | 2 | #include "blocking.h" |
| 3 | #include "rw-blocking.h" | ||
| 3 | 4 | ||
| 4 | #include "stl-helper.h" | 5 | #include "stl-helper.h" |
| 5 | 6 | ||
diff --git a/native/src/blocking/rw-task-fair.cpp b/native/src/blocking/rw-task-fair.cpp index ea0b102..bb27c14 100644 --- a/native/src/blocking/rw-task-fair.cpp +++ b/native/src/blocking/rw-task-fair.cpp | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #include "sharedres.h" | 1 | #include "sharedres.h" |
| 2 | #include "blocking.h" | 2 | #include "blocking.h" |
| 3 | #include "rw-blocking.h" | ||
| 3 | 4 | ||
| 4 | #include "stl-helper.h" | 5 | #include "stl-helper.h" |
| 5 | 6 | ||
diff --git a/native/src/sharedres.cpp b/native/src/sharedres.cpp index 00d7932..a91bfdf 100644 --- a/native/src/sharedres.cpp +++ b/native/src/sharedres.cpp | |||
| @@ -428,6 +428,8 @@ Interference np_fifo_per_resource( | |||
| 428 | &tsk); | 428 | &tsk); |
| 429 | } | 429 | } |
| 430 | 430 | ||
| 431 | #include "rw-blocking.h" | ||
| 432 | |||
| 431 | void merge_rw_requests(const TaskInfo &tsk, RWCounts &counts) | 433 | void merge_rw_requests(const TaskInfo &tsk, RWCounts &counts) |
| 432 | { | 434 | { |
| 433 | foreach(tsk.get_requests(), req) | 435 | foreach(tsk.get_requests(), req) |
