Class: MistApi::StatsMxedgeMemoryStat

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/stats_mxedge_memory_stat.rb

Overview

Memory usage

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(active = SKIP, available = SKIP, buffers = SKIP, cached = SKIP, free = SKIP, inactive = SKIP, swap_cached = SKIP, swap_free = SKIP, swap_total = SKIP, total = SKIP, usage = SKIP) ⇒ StatsMxedgeMemoryStat

Returns a new instance of StatsMxedgeMemoryStat.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 101

def initialize(active = SKIP, available = SKIP, buffers = SKIP,
               cached = SKIP, free = SKIP, inactive = SKIP,
               swap_cached = SKIP, swap_free = SKIP, swap_total = SKIP,
               total = SKIP, usage = SKIP)
  @active = active unless active == SKIP
  @available = available unless available == SKIP
  @buffers = buffers unless buffers == SKIP
  @cached = cached unless cached == SKIP
  @free = free unless free == SKIP
  @inactive = inactive unless inactive == SKIP
  @swap_cached = swap_cached unless swap_cached == SKIP
  @swap_free = swap_free unless swap_free == SKIP
  @swap_total = swap_total unless swap_total == SKIP
  @total = total unless total == SKIP
  @usage = usage unless usage == SKIP
end

Instance Attribute Details

#activeInteger

The amount of memory, in kilobytes, that has been used more recently and is usually not reclaimed unless absolutely necessary.

Returns:

  • (Integer)


15
16
17
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 15

def active
  @active
end

#availableInteger

An estimate of how much memory is available for starting new applications, without swapping.

Returns:

  • (Integer)


20
21
22
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 20

def available
  @available
end

#buffersInteger

The amount, in kilobytes, of temporary storage for raw disk blocks.

Returns:

  • (Integer)


24
25
26
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 24

def buffers
  @buffers
end

#cachedInteger

The amount of physical RAM, in kilobytes, used as cache memory.

Returns:

  • (Integer)


28
29
30
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 28

def cached
  @cached
end

#freeInteger

The amount of physical RAM, in kilobytes, left unused by the system

Returns:

  • (Integer)


32
33
34
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 32

def free
  @free
end

#inactiveInteger

The amount of memory, in kilobytes, that has been used less recently and is more eligible to be reclaimed for other purposes.

Returns:

  • (Integer)


37
38
39
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 37

def inactive
  @inactive
end

#swap_cachedInteger

The amount of memory, in kilobytes, that has once been moved into swap, then back into the main memory, but still also remains in the swapfile.

Returns:

  • (Integer)


42
43
44
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 42

def swap_cached
  @swap_cached
end

#swap_freeInteger

The total amount of swap free, in kilobytes.

Returns:

  • (Integer)


46
47
48
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 46

def swap_free
  @swap_free
end

#swap_totalInteger

The total amount of swap available, in kilobytes.

Returns:

  • (Integer)


50
51
52
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 50

def swap_total
  @swap_total
end

#totalInteger

Total amount of usable RAM, in kilobytes, which is physical RAM minus a number of reserved bits and the kernel binary code

Returns:

  • (Integer)


55
56
57
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 55

def total
  @total
end

#usageInteger

Total amount of usable RAM, in kilobytes, which is physical RAM minus a number of reserved bits and the kernel binary code

Returns:

  • (Integer)


60
61
62
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 60

def usage
  @usage
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 119

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  active = hash.key?('active') ? hash['active'] : SKIP
  available = hash.key?('available') ? hash['available'] : SKIP
  buffers = hash.key?('buffers') ? hash['buffers'] : SKIP
  cached = hash.key?('cached') ? hash['cached'] : SKIP
  free = hash.key?('free') ? hash['free'] : SKIP
  inactive = hash.key?('inactive') ? hash['inactive'] : SKIP
  swap_cached = hash.key?('swap_cached') ? hash['swap_cached'] : SKIP
  swap_free = hash.key?('swap_free') ? hash['swap_free'] : SKIP
  swap_total = hash.key?('swap_total') ? hash['swap_total'] : SKIP
  total = hash.key?('total') ? hash['total'] : SKIP
  usage = hash.key?('usage') ? hash['usage'] : SKIP

  # Create object from extracted values.
  StatsMxedgeMemoryStat.new(active,
                            available,
                            buffers,
                            cached,
                            free,
                            inactive,
                            swap_cached,
                            swap_free,
                            swap_total,
                            total,
                            usage)
end

.namesObject

A mapping from model property names to API property names.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 63

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['active'] = 'active'
  @_hash['available'] = 'available'
  @_hash['buffers'] = 'buffers'
  @_hash['cached'] = 'cached'
  @_hash['free'] = 'free'
  @_hash['inactive'] = 'inactive'
  @_hash['swap_cached'] = 'swap_cached'
  @_hash['swap_free'] = 'swap_free'
  @_hash['swap_total'] = 'swap_total'
  @_hash['total'] = 'total'
  @_hash['usage'] = 'usage'
  @_hash
end

.nullablesObject

An array for nullable fields



97
98
99
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 97

def self.nullables
  []
end

.optionalsObject

An array for optional fields



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 80

def self.optionals
  %w[
    active
    available
    buffers
    cached
    free
    inactive
    swap_cached
    swap_free
    swap_total
    total
    usage
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



158
159
160
161
162
163
164
165
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 158

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} active: #{@active.inspect}, available: #{@available.inspect}, buffers:"\
  " #{@buffers.inspect}, cached: #{@cached.inspect}, free: #{@free.inspect}, inactive:"\
  " #{@inactive.inspect}, swap_cached: #{@swap_cached.inspect}, swap_free:"\
  " #{@swap_free.inspect}, swap_total: #{@swap_total.inspect}, total: #{@total.inspect},"\
  " usage: #{@usage.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



150
151
152
153
154
155
# File 'lib/mist_api/models/stats_mxedge_memory_stat.rb', line 150

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} active: #{@active}, available: #{@available}, buffers: #{@buffers}, cached:"\
  " #{@cached}, free: #{@free}, inactive: #{@inactive}, swap_cached: #{@swap_cached},"\
  " swap_free: #{@swap_free}, swap_total: #{@swap_total}, total: #{@total}, usage: #{@usage}>"
end