Class: Roby::EventLogging::IOEventLogger::TimepointGroupDisplay
- Defined in:
- lib/roby/event_logging/io_event_logger.rb
Instance Attribute Summary collapse
-
#matcher ⇒ Object
Returns the value of attribute matcher.
-
#skip ⇒ Object
Returns the value of attribute skip.
-
#start_times ⇒ Object
Returns the value of attribute start_times.
-
#stats ⇒ Object
Returns the value of attribute stats.
Instance Method Summary collapse
-
#message(name, _time) ⇒ Object
Return the statistics message for the given timepoint.
-
#push(name, time) ⇒ Object
Add a group start event.
-
#update(name, time) ⇒ Object
Add a group end event.
Instance Attribute Details
#matcher ⇒ Object
Returns the value of attribute matcher
110 111 112 |
# File 'lib/roby/event_logging/io_event_logger.rb', line 110 def matcher @matcher end |
#skip ⇒ Object
Returns the value of attribute skip
110 111 112 |
# File 'lib/roby/event_logging/io_event_logger.rb', line 110 def skip @skip end |
#start_times ⇒ Object
Returns the value of attribute start_times
110 111 112 |
# File 'lib/roby/event_logging/io_event_logger.rb', line 110 def start_times @start_times end |
#stats ⇒ Object
Returns the value of attribute stats
110 111 112 |
# File 'lib/roby/event_logging/io_event_logger.rb', line 110 def stats @stats end |
Instance Method Details
#message(name, _time) ⇒ Object
Return the statistics message for the given timepoint
145 146 147 148 149 150 151 152 153 |
# File 'lib/roby/event_logging/io_event_logger.rb', line 145 def (name, _time) return unless (msg_stats = stats[name]) format( TIMEPOINT_GROUP_FORMAT, name: name, duration: msg_stats.last_duration, stats: msg_stats.to_s ) end |
#push(name, time) ⇒ Object
Add a group start event
The event is queued (hence "pushed") to properly handle recursive calls
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/roby/event_logging/io_event_logger.rb', line 117 def push(name, time) if skip > 0 self.skip -= 1 return end unless (msg_stats = stats[name]) msg_stats = TimepointGroupStats.new( fifo: [], ref: Time.now, total: 0, min_duration: Float::INFINITY, max_duration: 0, sample_count: 0, mean: 0, sum_squares: 0 ) stats[name] = msg_stats end msg_stats.fifo.push(time) end |
#update(name, time) ⇒ Object
Add a group end event
137 138 139 140 141 142 |
# File 'lib/roby/event_logging/io_event_logger.rb', line 137 def update(name, time) return unless (msg_stats = stats[name]) return unless (start_t = msg_stats.fifo.pop) msg_stats.update(time - start_t) end |