File Coverage

lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v2/Memory.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod 0 8 0.0
total 24 32 75.0


line stmt bran cond sub pod time code
1             package Mojo::IOLoop::ReadWriteProcess::CGroup::v2::Memory;
2              
3 15     15   93 use Mojo::Base -base;
  15         41  
  15         94  
4              
5             use constant {
6 15         6219 CURRENT_INTERFACE => 'memory.current',
7             LOW_INTERFACE => 'memory.low',
8             HIGH_INTERFACE => 'memory.high',
9             MAX_INTERFACE => 'memory.max',
10             EVENTS_INTERFACE => 'memory.events',
11             STAT_INTERFACE => 'memory.stat',
12             SWAP_CURRENT_INTERFACE => 'memory.swap.current',
13             SWAP_MAX_INTERFACE => 'memory.swap.max',
14 15     15   2544 };
  15         29  
15              
16              
17             has cgroup => sub { Mojo::IOLoop::ReadWriteProcess::CGroup::v2->new };
18              
19 1     1 0 188 sub current { shift->cgroup->_list(CURRENT_INTERFACE) }
20 1     1 0 200 sub swap_current { shift->cgroup->_list(SWAP_CURRENT_INTERFACE) }
21 2     2 0 1010 sub low { shift->cgroup->_setget(LOW_INTERFACE, @_) }
22 2     2 0 1083 sub high { shift->cgroup->_setget(HIGH_INTERFACE, @_) }
23 2     2 0 991 sub max { shift->cgroup->_setget(MAX_INTERFACE, @_) }
24 2     2 0 1081 sub swap_max { shift->cgroup->_setget(SWAP_MAX_INTERFACE, @_) }
25 1     1 0 192 sub events { shift->cgroup->_list(EVENTS_INTERFACE) }
26 1     1 0 191 sub stat { shift->cgroup->_list(STAT_INTERFACE) }
27              
28             1;
29              
30             =encoding utf-8
31              
32             =head1 NAME
33              
34             Mojo::IOLoop::ReadWriteProcess::CGroup::v2::Memory - CGroups v2 Memory Controller
35              
36             =head1 SYNOPSIS
37              
38             use Mojo::IOLoop::ReadWriteProcess::CGroup::v2;
39              
40             my $cgroup = Mojo::IOLoop::ReadWriteProcess::CGroup::v2->new( name => "test" );
41              
42             $cgroup->memory->current;
43              
44             =head1 DESCRIPTION
45              
46             This module uses features that are only available on Linux kernels.
47              
48             =head1 METHODS
49              
50             L inherits all methods from L and implements
51             the following new ones.
52              
53             =head1 LICENSE
54              
55             Copyright (C) Ettore Di Giacinto.
56              
57             This library is free software; you can redistribute it and/or modify
58             it under the same terms as Perl itself.
59              
60             =head1 AUTHOR
61              
62             Ettore Di Giacinto Eedigiacinto@suse.comE
63              
64             =cut