# File lib/new_relic/agent/method_tracer_helpers.rb, line 38
      def trace_execution_scoped_footer(state, t0, first_name, metric_names, expected_frame, options, t1=Time.now.to_f)
        log_errors(:trace_method_execution_footer) do
          if expected_frame
            stack = state.traced_method_stack
            create_metrics = options.has_key?(:metric) ? options[:metric] : true
            frame = stack.pop_frame(state, expected_frame, first_name, t1, create_metrics)
            if create_metrics
              duration = t1 - t0
              exclusive = duration - frame.children_time

              if duration < MAX_ALLOWED_METRIC_DURATION
                if duration < 0
                  ::NewRelic::Agent.logger.log_once(:warn, "metric_duration_negative:#{first_name}",
                    "Metric #{first_name} has negative duration: #{duration} s")
                end

                if exclusive < 0
                  ::NewRelic::Agent.logger.log_once(:warn, "metric_exclusive_negative:#{first_name}",
                    "Metric #{first_name} has negative exclusive time: duration = #{duration} s, child_time = #{frame.children_time}")
                end

                record_metrics(state, first_name, metric_names, duration, exclusive, options)
              else
                ::NewRelic::Agent.logger.log_once(:warn, "too_huge_metric:#{first_name}",
                  "Ignoring metric #{first_name} with unacceptably large duration: #{duration} s")
              end
            end
          end
        end
      end