Class: GroongaQueryLog::Command::AnalyzeLoad
- Inherits:
-
GroongaQueryLog::CommandLine
- Object
- GroongaQueryLog::CommandLine
- GroongaQueryLog::Command::AnalyzeLoad
- Defined in:
- lib/groonga-query-log/command/analyze-load.rb
Instance Method Summary collapse
-
#initialize ⇒ AnalyzeLoad
constructor
A new instance of AnalyzeLoad.
-
#run(arguments) ⇒ Object
Executes load command analyzer for Groonga’s query logs.
Constructor Details
#initialize ⇒ AnalyzeLoad
Returns a new instance of AnalyzeLoad.
25 26 27 28 |
# File 'lib/groonga-query-log/command/analyze-load.rb', line 25 def initialize @pending_entry = nil end |
Instance Method Details
#run(arguments) ⇒ Object
Executes load command analyzer for Groonga’s query logs. “groonga-query-log-analyze-load” command run this method.
If only paths of query log files are specified, this method prints a result of them to console.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/groonga-query-log/command/analyze-load.rb', line 45 def run(arguments) begin log_paths = @option_parser.parse!(arguments) rescue OptionParser::InvalidOption => error $stderr.puts(error) return false end begin open_output do |output| report_header(output) parse(log_paths) do |statistic| report_statistic(output, statistic) end if @pending_entry report_entry(output, @pending_entry) @pending_entry = nil end end rescue Interrupt rescue Error $stderr.puts($!.) return false end true end |