aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2012-05-16 12:43:28 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2012-05-16 12:43:28 -0400
commit403e13383f4b6813d27d4ec4067a29a552893de4 (patch)
tree64670c0f1031db689351f9b258df1543dfcd4e20
parent4bfee51d6ae7356b3f6cb2cee74123a684b4d593 (diff)
C++: Break out the P-OMLP code into own file
Part of refactoring sharedres.cpp.
-rw-r--r--native/Makefile2
-rw-r--r--native/include/blocking.h8
-rw-r--r--native/src/blocking/part-omlp.cpp71
-rw-r--r--native/src/sharedres.cpp75
4 files changed, 84 insertions, 72 deletions
diff --git a/native/Makefile b/native/Makefile
index 3a697db..b22fc9e 100644
--- a/native/Makefile
+++ b/native/Makefile
@@ -54,7 +54,7 @@ vpath %.cpp src src/edf src/blocking
54EDF_OBJ = baker.o baruah.o gfb.o bcl.o bcl_iterative.o rta.o ffdbf.o gedf.o load.o cpu_time.o 54EDF_OBJ = baker.o baruah.o gfb.o bcl.o bcl_iterative.o rta.o ffdbf.o gedf.o load.o cpu_time.o
55SCHED_OBJ = sim.o schedule_sim.o 55SCHED_OBJ = sim.o schedule_sim.o
56CORE_OBJ = tasks.o 56CORE_OBJ = tasks.o
57SYNC_OBJ = sharedres.o dpcp.o mpcp.o fmlp_plus.o global-omlp.o global-fmlp.o 57SYNC_OBJ = sharedres.o dpcp.o mpcp.o fmlp_plus.o global-omlp.o part-omlp.o global-fmlp.o
58 58
59# #### Targets #### 59# #### Targets ####
60 60
diff --git a/native/include/blocking.h b/native/include/blocking.h
index 49ea23e..c4b4775 100644
--- a/native/include/blocking.h
+++ b/native/include/blocking.h
@@ -41,6 +41,14 @@ Interference bound_blocking(const ContentionSet& cont,
41 const TaskInfo* exclude_tsk, 41 const TaskInfo* exclude_tsk,
42 unsigned int min_priority = 0); 42 unsigned int min_priority = 0);
43 43
44Interference np_fifo_per_resource(
45 const TaskInfo& tsk, const ClusterResources& clusters,
46 unsigned int procs_per_cluster,
47 unsigned int res_id, unsigned int issued,
48 int dedicated_irq = NO_CPU);
49
50void charge_arrival_blocking(const ResourceSharingInfo& info,
51 BlockingBounds& bounds);
44 52
45extern const unsigned int UNLIMITED; 53extern const unsigned int UNLIMITED;
46 54
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
6BlockingBounds* 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}
diff --git a/native/src/sharedres.cpp b/native/src/sharedres.cpp
index 4520ccb..02815dc 100644
--- a/native/src/sharedres.cpp
+++ b/native/src/sharedres.cpp
@@ -451,8 +451,8 @@ static Interference max_local_request_span(const TaskInfo &tsk,
451 return span; 451 return span;
452} 452}
453 453
454static void charge_arrival_blocking(const ResourceSharingInfo& info, 454void charge_arrival_blocking(const ResourceSharingInfo& info,
455 BlockingBounds& bounds) 455 BlockingBounds& bounds)
456{ 456{
457 unsigned int i = 0; 457 unsigned int i = 0;
458 const TaskInfos& tasks = info.get_tasks(); 458 const TaskInfos& tasks = info.get_tasks();
@@ -496,11 +496,11 @@ static ClusterLimits np_fifo_limits(
496 return limits; 496 return limits;
497} 497}
498 498
499static Interference np_fifo_per_resource( 499Interference np_fifo_per_resource(
500 const TaskInfo& tsk, const ClusterResources& clusters, 500 const TaskInfo& tsk, const ClusterResources& clusters,
501 unsigned int procs_per_cluster, 501 unsigned int procs_per_cluster,
502 unsigned int res_id, unsigned int issued, 502 unsigned int res_id, unsigned int issued,
503 int dedicated_irq = NO_CPU) 503 int dedicated_irq)
504{ 504{
505 const unsigned long interval = tsk.get_response(); 505 const unsigned long interval = tsk.get_response();
506 ClusterLimits limits = np_fifo_limits(tsk, clusters, procs_per_cluster, 506 ClusterLimits limits = np_fifo_limits(tsk, clusters, procs_per_cluster,
@@ -553,73 +553,6 @@ static Interference bound_blocking(const LimitedContentionSet &lcs, unsigned int
553 return inter; 553 return inter;
554} 554}
555 555
556BlockingBounds* part_omlp_bounds(const ResourceSharingInfo& info)
557{
558 // split everything by partition
559 Clusters clusters;
560
561 split_by_cluster(info, clusters);
562
563 // split each partition by resource
564 ClusterResources resources;
565
566 split_by_resource(clusters, resources);
567
568 // sort each contention set by request length
569 sort_by_request_length(resources);
570
571 // We need for each task the maximum request span. We also need the
572 // maximum direct blocking from remote partitions for each request. We
573 // can determine both in one pass.
574
575 unsigned int i;
576
577 // direct blocking results
578 BlockingBounds* _results = new BlockingBounds(info);
579 BlockingBounds& results = *_results;
580
581 for (i = 0; i < info.get_tasks().size(); i++)
582 {
583 const TaskInfo& tsk = info.get_tasks()[i];
584 Interference bterm;
585
586 foreach(tsk.get_requests(), jt)
587 {
588 const RequestBound& req = *jt;
589
590 Interference blocking;
591
592 blocking = np_fifo_per_resource(
593 tsk, resources, 1,
594 req.get_resource_id(), req.get_num_requests());
595
596 // add in blocking term
597 bterm += blocking;
598
599 // Keep track of maximum request span.
600 // Is this already a single-issue request?
601 if (req.get_num_requests() != 1)
602 // nope, need to recompute
603 blocking = np_fifo_per_resource(
604 tsk, resources, 1,
605 req.get_resource_id(), 1);
606
607 // The span includes our own request.
608 blocking.total_length += req.get_request_length();
609 blocking.count += 1;
610
611 // Update max. request span.
612 results.raise_request_span(i, blocking);
613 }
614
615 results[i] = bterm;
616 }
617
618 charge_arrival_blocking(info, results);
619
620 return _results;
621}
622
623 556
624BlockingBounds* clustered_omlp_bounds(const ResourceSharingInfo& info, 557BlockingBounds* clustered_omlp_bounds(const ResourceSharingInfo& info,
625 unsigned int procs_per_cluster, 558 unsigned int procs_per_cluster,