fpmas-metamodel 1.0
Loading...
Searching...
No Matches
probe.h
Go to the documentation of this file.
1#pragma once
2
3#include "fpmas.h"
4#include "fpmas/utils/perf.h"
5
15class LoadBalancingProbe : public fpmas::api::model::LoadBalancing {
16 private:
17 // Probes only the load balancing algorithm execution time
18 fpmas::api::utils::perf::Probe& lb_algorithm_probe;
19 fpmas::api::model::LoadBalancing& lb;
20
21 public:
22
31 fpmas::api::utils::perf::Probe& lb_algorithm_probe,
32 fpmas::api::model::LoadBalancing& lb
33 ) :
34 lb_algorithm_probe(lb_algorithm_probe),
35 lb(lb) {
36 }
37
48 fpmas::graph::PartitionMap balance(
49 fpmas::graph::NodeMap<fpmas::model::AgentPtr> node_map,
50 fpmas::api::graph::PartitionMode mode) override;
51
55 fpmas::graph::PartitionMap balance(
56 fpmas::graph::NodeMap<fpmas::model::AgentPtr> node_map
57 ) override {
58 return this->balance(node_map, fpmas::api::graph::PARTITION);
59 }
60};
61
66class GraphBalanceProbe : public fpmas::scheduler::Task {
67 private:
68 // Wrapper for the existing load balancing algorithm, that adds probes
69 LoadBalancingProbe load_balancing_algorithm;
70 fpmas::model::detail::LoadBalancingTask lb_task;
71 // Probes the complete load balancing + distribution process
72 fpmas::api::utils::perf::Probe& graph_balance_probe;
73
74 public:
80 fpmas::scheduler::Job job;
81
94 fpmas::api::model::AgentGraph& graph,
95 fpmas::api::model::LoadBalancing& probed_lb,
96 fpmas::api::utils::perf::Probe& lb_algorithm_probe,
97 fpmas::api::utils::perf::Probe& graph_balance_probe
98 ) :
99 load_balancing_algorithm(lb_algorithm_probe, probed_lb),
100 // The FPMAS LoadBalancingTask will call the
101 // DistributedGraph::balance() method, that implicitly call this
102 // class balance() methods, but also the distribution process,
103 // implicitly feeding the probes
104 lb_task(graph, load_balancing_algorithm),
105 graph_balance_probe(graph_balance_probe),
106 // The job only contains this task
107 job({*this}) {
108 }
109
117 void run() override;
118
119};
120
126class SyncProbeTask : public fpmas::scheduler::Task {
127 private:
128 fpmas::api::utils::perf::Probe& sync_probe;
129 fpmas::model::detail::SynchronizeGraphTask sync_task;
130
131 public:
139 fpmas::api::utils::perf::Probe& sync_probe,
140 fpmas::api::model::AgentGraph& graph);
141
146 void run() override;
147};
148
Definition: probe.h:66
fpmas::scheduler::Job job
Definition: probe.h:80
void run() override
GraphBalanceProbe(fpmas::api::model::AgentGraph &graph, fpmas::api::model::LoadBalancing &probed_lb, fpmas::api::utils::perf::Probe &lb_algorithm_probe, fpmas::api::utils::perf::Probe &graph_balance_probe)
Definition: probe.h:93
Definition: probe.h:15
fpmas::graph::PartitionMap balance(fpmas::graph::NodeMap< fpmas::model::AgentPtr > node_map, fpmas::api::graph::PartitionMode mode) override
LoadBalancingProbe(fpmas::api::utils::perf::Probe &lb_algorithm_probe, fpmas::api::model::LoadBalancing &lb)
Definition: probe.h:30
fpmas::graph::PartitionMap balance(fpmas::graph::NodeMap< fpmas::model::AgentPtr > node_map) override
Definition: probe.h:55
Definition: probe.h:126
void run() override
SyncProbeTask(fpmas::api::utils::perf::Probe &sync_probe, fpmas::api::model::AgentGraph &graph)