File: Memory.pm

package info (click to toggle)
libmojo-ioloop-readwriteprocess-perl 1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 540 kB
  • sloc: perl: 4,655; sh: 101; makefile: 2
file content (64 lines) | stat: -rw-r--r-- 1,827 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package Mojo::IOLoop::ReadWriteProcess::CGroup::v2::Memory;

use Mojo::Base -base;

use constant {
  CURRENT_INTERFACE      => 'memory.current',
  LOW_INTERFACE          => 'memory.low',
  HIGH_INTERFACE         => 'memory.high',
  MAX_INTERFACE          => 'memory.max',
  EVENTS_INTERFACE       => 'memory.events',
  STAT_INTERFACE         => 'memory.stat',
  SWAP_CURRENT_INTERFACE => 'memory.swap.current',
  SWAP_MAX_INTERFACE     => 'memory.swap.max',
};


has cgroup => sub { Mojo::IOLoop::ReadWriteProcess::CGroup::v2->new };

sub current      { shift->cgroup->_list(CURRENT_INTERFACE) }
sub swap_current { shift->cgroup->_list(SWAP_CURRENT_INTERFACE) }
sub low          { shift->cgroup->_setget(LOW_INTERFACE,      @_) }
sub high         { shift->cgroup->_setget(HIGH_INTERFACE,     @_) }
sub max          { shift->cgroup->_setget(MAX_INTERFACE,      @_) }
sub swap_max     { shift->cgroup->_setget(SWAP_MAX_INTERFACE, @_) }
sub events       { shift->cgroup->_list(EVENTS_INTERFACE) }
sub stat         { shift->cgroup->_list(STAT_INTERFACE) }

1;

=encoding utf-8

=head1 NAME

Mojo::IOLoop::ReadWriteProcess::CGroup::v2::Memory - CGroups v2 Memory Controller

=head1 SYNOPSIS

    use Mojo::IOLoop::ReadWriteProcess::CGroup::v2;

    my $cgroup = Mojo::IOLoop::ReadWriteProcess::CGroup::v2->new( name => "test" );

    $cgroup->memory->current;

=head1 DESCRIPTION

This module uses features that are only available on Linux kernels.

=head1 METHODS

L<Mojo::IOLoop::ReadWriteProcess::CGroup::v2::Memory> inherits all methods from L<Mojo::Base> and implements
the following new ones.

=head1 LICENSE

Copyright (C) Ettore Di Giacinto.

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=head1 AUTHOR

Ettore Di Giacinto E<lt>edigiacinto@suse.comE<gt>

=cut