Class: MetadataAnalysis

Inherits:
Object
  • Object
show all
Includes:
ThinpXML
Defined in:
lib/thinp_xml/thinp/analysis.rb

Defined Under Namespace

Classes: Unit

Constant Summary

Constants included from ThinpXML

ThinpXML::DEVICE_FIELDS, ThinpXML::MAPPING_FIELDS, ThinpXML::SUPERBLOCK_FIELDS, ThinpXML::THINP_TOOLS_VERSION, ThinpXML::UNIFORM_REGEX

Instance Method Summary collapse

Methods included from ThinpXML

#compare_devs, #compare_thins, #expand_mappings, field_names, #get_device, #parse_distribution, #read_xml, tools_are_installed, #write_xml

Constructor Details

#initialize(md) ⇒ MetadataAnalysis

Returns a new instance of MetadataAnalysis.



12
13
14
# File 'lib/thinp_xml/thinp/analysis.rb', line 12

def initialize(md)
  @md = md
end

Instance Method Details

#block_length_histogramsObject



16
17
18
19
20
21
22
# File 'lib/thinp_xml/thinp/analysis.rb', line 16

def block_length_histograms
  @md.devices.each do |dev|
    puts "device #{dev.dev_id}"
    block_length_histogram(dev)
    puts ""
  end
end

#fragmentationsObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/thinp_xml/thinp/analysis.rb', line 24

def fragmentations
  @md.devices.each do |dev|
    puts "device #{dev.dev_id}"
    printf("  %10s %10s %10s %10s\n",
           'io size', 'seeks/io', 'distance/seek', 'distance/io')
    puts "  -------------------------------------------------"

    power = 0
    loop do
      io_size = 8 * 4 ** power

      r = fragmentation(dev, @md.superblock.data_block_size, io_size)
      break if r.nil?
      seeks, dist = r

      printf("  %10s\t%.3f\t%s\t\t%s\n",
             segments_to_human(io_size),
             seeks, segments_to_human(dist.to_i),
             segments_to_human(seeks * dist.to_i))

      power += 1
    end
  end
end