Minor cleanup in the query-times scanner.
This commit is contained in:
parent
337c6b4c8b
commit
61fcd6f37b
3 changed files with 8 additions and 3 deletions
|
@ -3,6 +3,7 @@ class Criterion
|
||||||
attr_accessor :count
|
attr_accessor :count
|
||||||
attr_accessor :total_time
|
attr_accessor :total_time
|
||||||
def initialize(expr)
|
def initialize(expr)
|
||||||
|
expr = expr.gsub(/\s+/, ' ')
|
||||||
@expression = Regexp.new(expr, Regexp::MULTILINE)
|
@expression = Regexp.new(expr, Regexp::MULTILINE)
|
||||||
@count = 0
|
@count = 0
|
||||||
@total_time = 0.0
|
@total_time = 0.0
|
||||||
|
@ -14,7 +15,7 @@ class Criterion
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s()
|
def to_s()
|
||||||
"#{self.class}: count=#{@count}, total_time=#{format("%.3f", @total_time)}, expression='#{@expression}'"
|
format("%19s: count=%5d, total_time=%9.3f, expression='%s'", self.class, @count, @total_time, @expression)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,10 @@ list of partitioning expressions.
|
||||||
accumulated in the program storage.
|
accumulated in the program storage.
|
||||||
3) The partitioning expressions are tested against each log record, and matches
|
3) The partitioning expressions are tested against each log record, and matches
|
||||||
are recorded.
|
are recorded.
|
||||||
|
Strings of white space are treated as single spaces, both in the
|
||||||
|
partitioning expressions and in the log records. This makes the
|
||||||
|
expressions easier to read, both in the partitions file and in the program
|
||||||
|
output.
|
||||||
4) For each partioning expression, report:
|
4) For each partioning expression, report:
|
||||||
a) the expression
|
a) the expression
|
||||||
b) how many queries matched it
|
b) how many queries matched it
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LogFileParser
|
||||||
|
|
||||||
log_record = LogRecord.new
|
log_record = LogRecord.new
|
||||||
log_record.time = match[1].to_f
|
log_record.time = match[1].to_f
|
||||||
log_record.query = match[3].strip
|
log_record.query = match[3].strip.gsub(/\s+/, ' ')
|
||||||
log_record.stack = []
|
log_record.stack = []
|
||||||
return log_record
|
return log_record
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue