17 #ifndef __CGROUPS_HPP__ 18 #define __CGROUPS_HPP__ 27 #include <sys/types.h> 73 const std::string& baseHierarchy,
74 const std::string& subsystem,
75 const std::string&
cgroup);
84 const std::string&
cgroup =
"",
85 const std::string& control =
"");
200 const std::string&
cgroup,
201 bool recursive =
false);
221 const std::string&
cgroup =
"/");
232 const std::string& hierarchy,
233 const std::string& cgroup,
247 const std::string& hierarchy,
248 const std::string& cgroup,
249 const std::string& control);
263 const std::string& hierarchy,
264 const std::string& cgroup,
265 const std::string& control,
266 const std::string& value);
280 const std::string& hierarchy,
281 const std::string& cgroup,
282 const std::string& control);
291 const std::string& hierarchy,
292 const std::string& cgroup);
301 const std::string& hierarchy,
302 const std::string& cgroup);
315 const std::string& hierarchy,
316 const std::string& cgroup,
330 const std::string& hierarchy,
331 const std::string& cgroup,
347 const std::string& hierarchy,
348 const std::string& cgroup,
349 const std::string& control,
370 const std::string& hierarchy,
371 const std::string& cgroup =
"/");
379 const std::string& hierarchy,
380 const std::string& cgroup,
402 const std::string& hierarchy,
403 const std::string& cgroup,
404 const std::string&
file);
420 constexpr
Device(dev_t device) : value(device) {}
421 unsigned int getMajor()
const;
422 unsigned int getMinor()
const;
426 return value == that.value;
431 return value != that.value;
434 inline operator dev_t()
const {
return value; }
475 const std::string& hierarchy,
476 const std::string& cgroup);
480 const std::string& hierarchy,
481 const std::string& cgroup);
485 const std::string& hierarchy,
486 const std::string& cgroup);
490 const std::string& hierarchy,
491 const std::string& cgroup);
498 const std::string& hierarchy,
499 const std::string& cgroup);
507 const std::string& hierarchy,
508 const std::string& cgroup);
515 const std::string& hierarchy,
516 const std::string& cgroup);
523 const std::string& hierarchy,
524 const std::string& cgroup);
531 const std::string& hierarchy,
532 const std::string& cgroup);
540 const std::string& hierarchy,
541 const std::string& cgroup);
549 const std::string& hierarchy,
550 const std::string& cgroup);
558 const std::string& hierarchy,
559 const std::string& cgroup);
566 const std::string& hierarchy,
567 const std::string& cgroup);
574 const std::string& hierarchy,
575 const std::string& cgroup);
582 const std::string& hierarchy,
583 const std::string& cgroup);
591 const std::string& hierarchy,
592 const std::string& cgroup);
603 const std::string& hierarchy,
604 const std::string& cgroup);
611 const std::string& hierarchy,
612 const std::string& cgroup);
626 case Operation::TOTAL:
627 return stream <<
"Total";
629 return stream <<
"Read";
631 return stream <<
"Write";
632 case Operation::SYNC:
633 return stream <<
"Sync";
634 case Operation::ASYNC:
635 return stream <<
"Async";
636 case Operation::DISCARD:
637 return stream <<
"Discard";
646 if (value.
device.isSome()) {
647 stream << value.
device.get() <<
' ';
651 stream << value.
op.
get() <<
' ';
654 return stream << value.
value;
672 const std::string& hierarchy,
673 const std::string& cgroup,
680 const std::string& hierarchy,
681 const std::string& cgroup);
687 const std::string& hierarchy,
688 const std::string& cgroup,
695 const std::string& hierarchy,
696 const std::string& cgroup);
702 const std::string& hierarchy,
703 const std::string& cgroup,
739 const std::string& hierarchy,
740 const std::string& cgroup);
757 const std::string& hierarchy,
758 const std::string& cgroup);
764 const std::string& hierarchy,
765 const std::string& cgroup,
774 const std::string& hierarchy,
775 const std::string& cgroup);
783 const std::string& hierarchy,
784 const std::string& cgroup,
791 const std::string& hierarchy,
792 const std::string& cgroup);
798 const std::string& hierarchy,
799 const std::string& cgroup,
806 const std::string& hierarchy,
807 const std::string& cgroup);
813 const std::string& hierarchy,
814 const std::string& cgroup);
820 const std::string& hierarchy,
821 const std::string& cgroup);
830 const std::string& hierarchy,
831 const std::string& cgroup);
839 const std::string& hierarchy,
840 const std::string& cgroup);
846 const std::string& hierarchy,
847 const std::string& cgroup);
853 const std::string& hierarchy,
854 const std::string& cgroup);
876 class CounterProcess;
890 const std::string& hierarchy,
891 const std::string& cgroup,
904 Counter(
const std::string& hierarchy,
905 const std::string& cgroup,
949 std::ostream& stream,
953 std::ostream& stream,
957 std::ostream& stream,
961 std::ostream& stream,
981 const std::string& hierarchy,
982 const std::string& cgroup);
987 const std::string& hierarchy,
988 const std::string& cgroup,
994 const std::string& hierarchy,
995 const std::string& cgroup,
1013 const std::string& hierarchy,
1014 const std::string& cgroup);
1023 const std::string& hierarchy,
1024 const std::string& cgroup);
1035 const std::string& hierarchy,
1036 const std::string& cgroup);
1042 const std::string& hierarchy,
1043 const std::string& cgroup,
1044 const uint32_t handle);
1074 return static_cast<size_t>(level);
1080 #endif // __CGROUPS_HPP__ const short READ
A possible event while polling.
Definition: io.hpp:34
Try< Nothing > isolate(const std::string &hierarchy, const std::string &cgroup, pid_t pid)
Try< std::vector< Value > > sectors(const std::string &hierarchy, const std::string &cgroup)
std::ostream & operator<<(std::ostream &stream, const Entry &entry)
bool mknod
Definition: cgroups.hpp:941
Try< Nothing > enable(const std::string &hierarchy, const std::string &cgroup)
Try< bool > memsw_limit_in_bytes(const std::string &hierarchy, const std::string &cgroup, const Bytes &limit)
Definition: cgroups.hpp:919
Option< unsigned int > minor
Definition: cgroups.hpp:934
Try< std::vector< Value > > io_serviced(const std::string &hierarchy, const std::string &cgroup)
Try< bool > busy(const std::string &subsystems)
Try< std::vector< Value > > io_wait_time(const std::string &hierarchy, const std::string &cgroup)
Definition: cgroups.hpp:923
const int ALL
Definition: diagnosis.hpp:52
Option< Operation > op
Definition: cgroups.hpp:465
Try< Bytes > max_usage_in_bytes(const std::string &hierarchy, const std::string &cgroup)
process::Future< bool > cleanup(const std::string &hierarchy)
Try< std::vector< Value > > io_queued_recursive(const std::string &hierarchy, const std::string &cgroup)
Try< Bytes > memsw_usage_in_bytes(const std::string &hierarchy, const std::string &cgroup)
Try< std::vector< Value > > time_recursive(const std::string &hierarchy, const std::string &cgroup)
Definition: cgroups.hpp:39
Definition: type_utils.hpp:619
bool write
Definition: cgroups.hpp:940
result_type operator()(const argument_type &level) const
Definition: cgroups.hpp:1071
Operation
Definition: cgroups.hpp:444
uint64_t value
Definition: cgroups.hpp:466
cgroups::memory::pressure::Level argument_type
Definition: cgroups.hpp:1069
const Duration system
Definition: cgroups.hpp:727
const unsigned int THREAD_ASSIGN_RETRIES
Definition: cgroups.hpp:48
unsigned int getMinor() const
Definition: duration.hpp:32
Definition: cgroups.hpp:868
process::Future< uint64_t > listen(const std::string &hierarchy, const std::string &cgroup, const std::string &control, const Option< std::string > &args=Option< std::string >::none())
Try< bool > access(const std::string &path, int how)
Definition: access.hpp:28
bool isSome() const
Definition: option.hpp:116
Try< std::vector< Value > > io_queued(const std::string &hierarchy, const std::string &cgroup)
Definition: cgroups.hpp:937
Try< std::vector< Value > > sectors_recursive(const std::string &hierarchy, const std::string &cgroup)
Try< std::vector< Value > > io_service_bytes(const std::string &hierarchy, const std::string &cgroup)
DWORD pid_t
Definition: windows.hpp:181
Definition: cgroups.hpp:866
Definition: cgroups.hpp:867
Try< std::vector< Value > > io_service_time(const std::string &hierarchy, const std::string &cgroup)
URI file(const std::string &path)
Creates a file URI with the given path on the local host.
Definition: file.hpp:33
Type
Definition: cgroups.hpp:925
Definition: cgroups.hpp:417
Try< Nothing > unmount(const std::string &hierarchy)
Try< Nothing > disable(const std::string &hierarchy, const std::string &cgroup)
Definition: duration.hpp:207
Try< Nothing > verify(const std::string &hierarchy, const std::string &cgroup="", const std::string &control="")
const short WRITE
A possible event while polling.
Definition: io.hpp:40
Try< Nothing > cfs_period_us(const std::string &hierarchy, const std::string &cgroup, const Duration &duration)
Selector selector
Definition: cgroups.hpp:944
Try< std::vector< Value > > io_service_bytes_recursive(const std::string &hierarchy, const std::string &cgroup)
Try< Nothing > limit_in_bytes(const std::string &hierarchy, const std::string &cgroup, const Bytes &limit)
Result< std::string > cgroup(const std::string &hierarchyName, pid_t pid)
Try< ImageManifest > parse(const std::string &value)
Definition: parse.hpp:36
const Duration FREEZE_RETRY_INTERVAL
Definition: cgroups.hpp:44
const T & get() const &
Definition: option.hpp:119
process::Future< Nothing > destroy(const std::string &hierarchy, const std::string &cgroup="/")
Definition: cgroups.hpp:462
Try< hashmap< std::string, uint64_t > > stat(const std::string &hierarchy, const std::string &cgroup, const std::string &file)
Try< std::vector< Value > > io_merged(const std::string &hierarchy, const std::string &cgroup)
Try< std::vector< Value > > io_wait_time_recursive(const std::string &hierarchy, const std::string &cgroup)
#define UNREACHABLE()
Definition: unreachable.hpp:22
Try< std::vector< Entry > > list(const std::string &hierarchy, const std::string &cgroup)
Try< bool > mounted(const std::string &hierarchy, const std::string &subsystems="")
Option< unsigned int > major
Definition: cgroups.hpp:933
Try< Nothing > cfs_quota_us(const std::string &hierarchy, const std::string &cgroup, const Duration &duration)
Result< Process > process(pid_t pid)
Definition: freebsd.hpp:30
Try< std::vector< Value > > io_serviced_recursive(const std::string &hierarchy, const std::string &cgroup)
bool operator==(const Path &left, const Path &right)
Definition: path.hpp:481
constexpr Device(dev_t device)
Definition: cgroups.hpp:420
Try< Nothing > mount(const std::string &hierarchy, const std::string &subsystems, int retry=0)
bool read
Definition: cgroups.hpp:939
bool operator!=(const Device &that) const
Definition: cgroups.hpp:429
Access access
Definition: cgroups.hpp:945
Try< std::set< pid_t > > processes(const std::string &hierarchy, const std::string &cgroup)
Try< Bytes > usage_in_bytes(const std::string &hierarchy, const std::string &cgroup)
Definition: cgroups.hpp:883
Try< Nothing > classid(const std::string &hierarchy, const std::string &cgroup, const uint32_t handle)
process::Future< Nothing > freeze(const std::string &hierarchy, const std::string &cgroup)
Try< uint32_t > type(const std::string &path)
Try< Nothing > allow(const std::string &hierarchy, const std::string &cgroup, const Entry &entry)
Level
Definition: cgroups.hpp:864
Try< std::vector< Value > > io_merged_recursive(const std::string &hierarchy, const std::string &cgroup)
Option< Device > device
Definition: cgroups.hpp:464
Try< std::set< std::string > > hierarchies()
Definition: cgroups.hpp:724
Try< std::string > prepare(const std::string &baseHierarchy, const std::string &subsystem, const std::string &cgroup)
Try< Nothing > create(const std::string &hierarchy, const std::string &cgroup, bool recursive=false)
Try< Nothing > kill(const std::string &hierarchy, const std::string &cgroup, int signal)
size_t result_type
Definition: cgroups.hpp:1067
Result< std::string > hierarchy(const std::string &subsystems)
Try< Memory > memory()
Definition: freebsd.hpp:78
const Duration user
Definition: cgroups.hpp:726
bool exists(const std::string &hierarchy, const std::string &cgroup)
Try< Nothing > assign(const std::string &hierarchy, const std::string &cgroup, pid_t pid)
Type type
Definition: cgroups.hpp:932
Try< Nothing > write(const std::string &hierarchy, const std::string &cgroup, const std::string &control, const std::string &value)
Try< std::set< pid_t > > threads(const std::string &hierarchy, const std::string &cgroup)
Try< Nothing > deny(const std::string &hierarchy, const std::string &cgroup, const Entry &entry)
Try< std::vector< Value > > io_service_time_recursive(const std::string &hierarchy, const std::string &cgroup)
Try< Nothing > soft_limit_in_bytes(const std::string &hierarchy, const std::string &cgroup, const Bytes &limit)
Try< std::vector< Value > > time(const std::string &hierarchy, const std::string &cgroup)
Try< std::set< std::string > > subsystems()
Try< std::string > read(const std::string &hierarchy, const std::string &cgroup, const std::string &control)
bool operator==(const Device &that) const
Definition: cgroups.hpp:424
unsigned int getMajor() const
Try< uint64_t > shares(const std::string &hierarchy, const std::string &cgroup)
Definition: future.hpp:58
process::Future< Nothing > thaw(const std::string &hierarchy, const std::string &cgroup)