geopm 3.1.1.dev410+g40bf96ed
GEOPM - Global Extensible Open Power Manager
Loading...
Searching...
No Matches
Scheduler.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 - 2024 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef SCHEDULER_HPP_INCLUDE
7#define SCHEDULER_HPP_INCLUDE
8
9#include <memory>
10#include <functional>
11#include <sched.h>
12
13namespace geopm
14{
16 {
17 public:
18 Scheduler() = default;
19 virtual ~Scheduler() = default;
20 static std::unique_ptr<Scheduler> make_unique(void);
21 virtual int num_cpu(void) const = 0;
22 virtual int get_cpu(void) const = 0;
23 virtual std::unique_ptr<cpu_set_t, std::function<void(cpu_set_t *)> >
24 proc_cpuset(void) const = 0;
25 virtual std::unique_ptr<cpu_set_t, std::function<void(cpu_set_t *)> >
26 proc_cpuset(int pid) const = 0;
27 virtual std::unique_ptr<cpu_set_t, std::function<void(cpu_set_t *)> >
28 woomp(int pid) const = 0;
29 };
30
31 class SchedulerImp : public Scheduler
32 {
33 public:
35 virtual ~SchedulerImp() = default;
36 virtual int num_cpu(void) const override;
37 virtual int get_cpu(void) const override;
38 virtual std::unique_ptr<cpu_set_t, std::function<void(cpu_set_t *)> >
39 proc_cpuset(void) const override;
40 virtual std::unique_ptr<cpu_set_t, std::function<void(cpu_set_t *)> >
41 proc_cpuset(int pid) const override;
42 virtual std::unique_ptr<cpu_set_t, std::function<void(cpu_set_t *)> >
43 woomp(int pid) const override;
44 private:
45 const int m_num_cpu;
46 };
47}
48
49#endif
Definition Scheduler.hpp:16
virtual std::unique_ptr< cpu_set_t, std::function< void(cpu_set_t *)> > proc_cpuset(int pid) const =0
virtual std::unique_ptr< cpu_set_t, std::function< void(cpu_set_t *)> > proc_cpuset(void) const =0
Scheduler()=default
virtual std::unique_ptr< cpu_set_t, std::function< void(cpu_set_t *)> > woomp(int pid) const =0
virtual int get_cpu(void) const =0
virtual int num_cpu(void) const =0
virtual ~Scheduler()=default
static std::unique_ptr< Scheduler > make_unique(void)
Definition Scheduler.cpp:14
Definition Scheduler.hpp:32
virtual int num_cpu(void) const override
Definition Scheduler.cpp:25
virtual ~SchedulerImp()=default
virtual std::unique_ptr< cpu_set_t, std::function< void(cpu_set_t *)> > proc_cpuset(void) const override
Definition Scheduler.cpp:36
virtual int get_cpu(void) const override
Definition Scheduler.cpp:30
virtual std::unique_ptr< cpu_set_t, std::function< void(cpu_set_t *)> > woomp(int pid) const override
Definition Scheduler.cpp:60
SchedulerImp()
Definition Scheduler.cpp:19
Definition Accumulator.cpp:12