diff options
| author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-05-16 12:43:28 -0400 |
|---|---|---|
| committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-05-16 12:43:28 -0400 |
| commit | 403e13383f4b6813d27d4ec4067a29a552893de4 (patch) | |
| tree | 64670c0f1031db689351f9b258df1543dfcd4e20 /native/src/blocking | |
| parent | 4bfee51d6ae7356b3f6cb2cee74123a684b4d593 (diff) | |
C++: Break out the P-OMLP code into own file
Part of refactoring sharedres.cpp.
Diffstat (limited to 'native/src/blocking')
| -rw-r--r-- | native/src/blocking/part-omlp.cpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/native/src/blocking/part-omlp.cpp b/native/src/blocking/part-omlp.cpp new file mode 100644 index 0000000..c527b46 --- /dev/null +++ b/native/src/blocking/part-omlp.cpp | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | #include "sharedres.h" | ||
| 2 | #include "blocking.h" | ||
| 3 | |||
| 4 | #include "stl-helper.h" | ||
| 5 | |||
| 6 | BlockingBounds* part_omlp_bounds(const ResourceSharingInfo& info) | ||
| 7 | { | ||
| 8 | // split everything by partition | ||
| 9 | Clusters clusters; | ||
| 10 | |||
| 11 | split_by_cluster(info, clusters); | ||
| 12 | |||
| 13 | // split each partition by resource | ||
| 14 | ClusterResources resources; | ||
| 15 | |||
| 16 | split_by_resource(clusters, resources); | ||
| 17 | |||
| 18 | // sort each contention set by request length | ||
| 19 | sort_by_request_length(resources); | ||
| 20 | |||
| 21 | // We need for each task the maximum request span. We also need the | ||
| 22 | // maximum direct blocking from remote partitions for each request. We | ||
| 23 | // can determine both in one pass. | ||
| 24 | |||
| 25 | unsigned int i; | ||
| 26 | |||
| 27 | // direct blocking results | ||
| 28 | BlockingBounds* _results = new BlockingBounds(info); | ||
| 29 | BlockingBounds& results = *_results; | ||
| 30 | |||
| 31 | for (i = 0; i < info.get_tasks().size(); i++) | ||
| 32 | { | ||
| 33 | const TaskInfo& tsk = info.get_tasks()[i]; | ||
| 34 | Interference bterm; | ||
| 35 | |||
| 36 | foreach(tsk.get_requests(), jt) | ||
| 37 | { | ||
| 38 | const RequestBound& req = *jt; | ||
| 39 | |||
| 40 | Interference blocking; | ||
| 41 | |||
| 42 | blocking = np_fifo_per_resource( | ||
| 43 | tsk, resources, 1, | ||
| 44 | req.get_resource_id(), req.get_num_requests()); | ||
| 45 | |||
| 46 | // add in blocking term | ||
| 47 | bterm += blocking; | ||
| 48 | |||
| 49 | // Keep track of maximum request span. | ||
| 50 | // Is this already a single-issue request? | ||
| 51 | if (req.get_num_requests() != 1) | ||
| 52 | // nope, need to recompute | ||
| 53 | blocking = np_fifo_per_resource( | ||
| 54 | tsk, resources, 1, | ||
| 55 | req.get_resource_id(), 1); | ||
| 56 | |||
| 57 | // The span includes our own request. | ||
| 58 | blocking.total_length += req.get_request_length(); | ||
| 59 | blocking.count += 1; | ||
| 60 | |||
| 61 | // Update max. request span. | ||
| 62 | results.raise_request_span(i, blocking); | ||
| 63 | } | ||
| 64 | |||
| 65 | results[i] = bterm; | ||
| 66 | } | ||
| 67 | |||
| 68 | charge_arrival_blocking(info, results); | ||
| 69 | |||
| 70 | return _results; | ||
| 71 | } | ||
