Line data Source code
1 : /*! 2 : * \file 3 : * \brief Class sched::Scheduler. 4 : */ 5 : #ifndef SCHEDULER_HPP__ 6 : #define SCHEDULER_HPP__ 7 : 8 : #include "Runtime/Pipeline/Pipeline.hpp" 9 : #include "Runtime/Sequence/Sequence.hpp" 10 : #include "Tools/Interface/Interface_reset.hpp" 11 : #include <chrono> 12 : #include <iostream> 13 : #include <string> 14 : #include <utility> 15 : #include <vector> 16 : 17 : namespace spu 18 : { 19 : namespace sched 20 : { 21 : struct task_desc_t 22 : { 23 : runtime::Task* tptr; 24 : std::chrono::duration<double, std::nano> exec_duration; 25 : }; 26 : class Scheduler : public tools::Interface_reset 27 : { 28 : private: 29 : runtime::Sequence* sequence; 30 : 31 : protected: 32 : std::vector<task_desc_t> tasks_desc; 33 : std::vector<std::pair<size_t, size_t>> solution; 34 : 35 : Scheduler(runtime::Sequence& sequence); 36 : Scheduler(runtime::Sequence* sequence); 37 : 38 : public: 39 : void profile(const size_t n_exec = 100); 40 : void print_profiling(std::ostream& stream = std::cout); 41 : const std::vector<task_desc_t>& get_profiling(); 42 11 : virtual ~Scheduler() = default; 43 : runtime::Pipeline* generate_pipeline(); 44 : std::vector<std::pair<size_t, size_t>> get_solution(); 45 : virtual void reset() override; 46 : virtual void schedule() = 0; 47 : runtime::Pipeline* instantiate_pipeline(const size_t buffer_size = 1, 48 : const bool active_wait = false, 49 : const bool thread_pining = false, 50 : const std::string& pinning_policy = ""); 51 : std::string perform_threads_mapping() const; 52 : size_t get_n_alloc_ressources() const; 53 : virtual double get_throughput_est() const; // return the estimated number of streams per second 54 : }; 55 : } // namespace sched 56 : } // namespace spu 57 : 58 : #endif // SCHEDULER_HPP__