innodb_ruby 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/innodb_space +35 -0
- data/lib/innodb/record_describer.rb +18 -0
- data/lib/innodb/version.rb +1 -1
- metadata +2 -2
data/bin/innodb_space
CHANGED
@@ -113,6 +113,35 @@ def space_page_type_regions(space, start_page)
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
+
def space_page_type_summary(space, start_page)
|
117
|
+
# Count of pages encountered; Shouldn't be space.pages since we may skip
|
118
|
+
# some pages due to the start_page parameter.
|
119
|
+
page_count = 0
|
120
|
+
# A Hash of page type => count.
|
121
|
+
page_type = Hash.new(0)
|
122
|
+
space.each_page(start_page) do |page_number, page|
|
123
|
+
page_count += 1
|
124
|
+
page_type[page.type] += 1
|
125
|
+
end
|
126
|
+
|
127
|
+
puts "%-20s%-12s%-12s%-20s" % [
|
128
|
+
"type",
|
129
|
+
"count",
|
130
|
+
"percent",
|
131
|
+
"description",
|
132
|
+
]
|
133
|
+
|
134
|
+
# Sort the page type Hash by count, descending.
|
135
|
+
page_type.sort { |a, b| b[1] <=> a[1] }.each do |type, type_count|
|
136
|
+
puts "%-20s%-12i%-12.2f%-20s" % [
|
137
|
+
type,
|
138
|
+
type_count,
|
139
|
+
100.0 * (type_count.to_f / page_count.to_f),
|
140
|
+
Innodb::Page::PAGE_TYPE[type][:description],
|
141
|
+
]
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
116
145
|
def space_lists(space)
|
117
146
|
print_lists(space.page(0).each_list)
|
118
147
|
end
|
@@ -547,6 +576,10 @@ The following modes are supported:
|
|
547
576
|
provide an overall view of the space and allocations within it. A starting
|
548
577
|
page number can be provided with the --page/-p argument.
|
549
578
|
|
579
|
+
space-page-type-summary
|
580
|
+
Summarize all pages by type. A starting page number can be provided with
|
581
|
+
the --page/-p argument.
|
582
|
+
|
550
583
|
space-indexes
|
551
584
|
Summarize all indexes (actually each segment of the indexes) to show
|
552
585
|
the number of pages used and allocated, and the segment fill factor.
|
@@ -721,6 +754,8 @@ ARGV.each do |mode|
|
|
721
754
|
space_index_pages_free_plot(space, name, @options.pages.first || 0)
|
722
755
|
when "space-page-type-regions"
|
723
756
|
space_page_type_regions(space, @options.pages.first || 0)
|
757
|
+
when "space-page-type-summary"
|
758
|
+
space_page_type_summary(space, @options.pages.first || 0)
|
724
759
|
when "space-lists"
|
725
760
|
space_lists(space)
|
726
761
|
when "space-list-iterate"
|
@@ -109,4 +109,22 @@ class Innodb::RecordDescriber
|
|
109
109
|
def row(name, *type)
|
110
110
|
add_field :row, name, type
|
111
111
|
end
|
112
|
+
|
113
|
+
def generate_class(name="Describer_#{object_id}")
|
114
|
+
str = "class #{name}\n"
|
115
|
+
str << " type %s\n" % [
|
116
|
+
description[:type].inspect
|
117
|
+
]
|
118
|
+
[:key, :row].each do |group|
|
119
|
+
description[group].each do |item|
|
120
|
+
str << " %s %s, %s\n" % [
|
121
|
+
group,
|
122
|
+
item[:name].inspect,
|
123
|
+
item[:type].map { |s| s.inspect }.join(", "),
|
124
|
+
]
|
125
|
+
end
|
126
|
+
end
|
127
|
+
str << "end\n"
|
128
|
+
str
|
129
|
+
end
|
112
130
|
end
|
data/lib/innodb/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: innodb_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bindata
|