Class: RuntimeProfiler::TextReport
- Inherits:
-
Object
- Object
- RuntimeProfiler::TextReport
- Defined in:
- lib/runtime_profiler/text_report.rb
Constant Summary collapse
- COUNT_WIDTH =
5
- DURATION_WIDTH =
22
- TOTAL_RUNTIME_WIDTH =
20
- FULL_DETAILS_TEMPLATE =
<<-EOT.strip_heredoc \e[1mPROFILING REPORT\e[22m ---------------- \e[1mAPI RUNTIME\e[22m Total Runtime : %s ms Database Runtime : %s ms View Runtime : %s ms \e[1mMETHOD CALLS\e[22m SLOWEST : %s (%s ms) MOSTLY CALLED : %s (%s number of calls in %s ms) \e[1mSQL CALLS\e[22m Total : %s Total Unique : %s \e[1mSLOWEST\e[22m Total Runtime : %s ms SQL : %s Source : %s \e[1mMOSTLY CALLED\e[22m Total Calls : %s Total Runtime : %s ms SQL : %s Sources : %s EOT
- METHODS_DETAILS_TEMPLATE =
<<-EOT.strip_heredoc \e[1mPROFILING REPORT\e[22m ---------------- \e[1mAPI RUNTIME\e[22m Total Runtime : %s ms Database Runtime : %s ms View Runtime : %s ms \e[1mMETHOD CALLS\e[22m SLOWEST : %s (%s ms) MOSTLY CALLED : %s (%s number of calls in %s ms) EOT
- SQLS_DETAILS_TEMPLATE =
<<-EOT.strip_heredoc \e[1mPROFILING REPORT\e[22m ---------------- \e[1mAPI RUNTIME\e[22m Total Runtime : %s ms Database Runtime : %s ms View Runtime : %s ms \e[1mSQL CALLS\e[22m Total : %s Total Unique : %s \e[1mSLOWEST\e[22m Total Runtime : %s ms SQL : %s Source : %s \e[1mMOSTLY CALLED\e[22m Total Calls : %s Total Runtime : %s ms SQL : %s Sources : %s EOT
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(json_file, options) ⇒ TextReport
constructor
A new instance of TextReport.
- #print ⇒ Object
Constructor Details
#initialize(json_file, options) ⇒ TextReport
Returns a new instance of TextReport.
88 89 90 91 |
# File 'lib/runtime_profiler/text_report.rb', line 88 def initialize(json_file, ) self.data = JSON.parse(File.read(json_file)) self. = end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
86 87 88 |
# File 'lib/runtime_profiler/text_report.rb', line 86 def data @data end |
#options ⇒ Object
Returns the value of attribute options.
86 87 88 |
# File 'lib/runtime_profiler/text_report.rb', line 86 def @options end |
Instance Method Details
#print ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/runtime_profiler/text_report.rb', line 93 def print print_summary if .details == 'full' if only_methods? print_instrumented_methods elsif only_sqls? print_instrumented_sql_calls else print_instrumented_methods print_instrumented_sql_calls end end end |