Use ActiveSupport to instrument the execution of the subsequent chain.
356027
def instrument
      proc do
        publish_start

        if ActiveSupport::Notifications.notifier.listening?("coach.middleware.finish")
          instrument_deprecated { call }
        else
          ActiveSupport::Notifications.
            instrument("finish_middleware.coach", middleware_event) { call }
        end
      end
    end
188629
public void executeInstrumentation() throws IOException {
        errors.clear();

        // Iterate over all entries in the classes list
        for (File f : this.classFiles) {
            try {
                if (!f.canRead() || !f.canWrite()) {
                    throw new IOException(f + " can not be replaced");
                }
                instrumentClassFile(f);
            } catch (Exception e) {
                e.printStackTrace();
                errors.add(e);
            }
        }

        // Iterate over all entries in the jar list
        for (File f : this.jarFiles) {
            try {
                instrumentZipFile(f);
            } catch (Exception e) {
                e.printStackTrace();
                errors.add(e);
            }
        }

        // Chain the first exception and report the error count
        if (!errors.isEmpty()) {
            Throwable t = errors.get(0);
            IOException ioe = new IOException(errors.size() + " errors occurred");
            ioe.initCause(t);
            throw ioe;
        }
    }
1201388
void requestExecution() {
        for (;;) {
            State currentState = state.get();
            switch (currentState) {
                case INACTIVE:
                    if (state.compareAndSet(State.INACTIVE, State.RUNNING)) {
                        scheduleExecution();
                        return;
                    }
                    break;
                case RUNNING:
                    if (state.compareAndSet(State.RUNNING, State.REQUESTED)) {
                        return;
                    }
                    break;
                default:
                    //someone else already requested execution
                    return;
            }
        }
    }
1211166
def subscribe(self, py3_module, trigger_action, subsystem):
        
        if self.pyudev_available:
            # lazy load the udev monitor
            if self.udev_observer is None:
                self._setup_pyudev_monitoring()
            if trigger_action not in ON_TRIGGER_ACTIONS:
                self.py3_wrapper.log(
                    "module %s: invalid action %s on udev events subscription"
                    % (py3_module.module_full_name, trigger_action)
                )
                return False
            self.udev_consumers[subsystem].append((py3_module, trigger_action))
            self.py3_wrapper.log(
                "module %s subscribed to udev events on %s"
                % (py3_module.module_full_name, subsystem)
            )
            return True
        else:
            self.py3_wrapper.log(
                "pyudev module not installed: module %s not subscribed to events on %s"
                % (py3_module.module_full_name, subsystem)
            )
            return False
1252783
def pass_requiredremotesupply_v1(self):
    """"""
    flu = self.sequences.fluxes.fastaccess
    sen = self.sequences.senders.fastaccess
    sen.s[0] += flu.requiredremotesupply
114400
function(rpc_method, fn) {
        rpc.on(rpc_method, _.partial(moduleEventWrap, rpc_method, fn));
    }
1062135
def execute(self, state, successors=None, arguments=None, ret_to=None):
        
        # fill out all the fun stuff we don't want to frontload
        if self.addr is None and not state.regs.ip.symbolic:
            self.addr = state.addr
        if self.arch is None:
            self.arch = state.arch
        if self.project is None:
            self.project = state.project
        if self.cc is None:
            if self.arch.name in DEFAULT_CC:
                self.cc = DEFAULT_CC[self.arch.name](self.arch)
            else:
                raise SimProcedureError('There is no default calling convention for architecture %s.'
                                        ' You must specify a calling convention.' % self.arch.name)

        inst = copy.copy(self)
        inst.state = state
        inst.successors = successors
        inst.ret_to = ret_to
        inst.inhibit_autoret = False

        # check to see if this is a syscall and if we should override its return value
        override = None
        if inst.is_syscall:
            state.history.recent_syscall_count = 1
            if len(state.posix.queued_syscall_returns):
                override = state.posix.queued_syscall_returns.pop(0)

        if callable(override):
            try:
                r = override(state, run=inst)
            except TypeError:
                r = override(state)
            inst.use_state_arguments = True

        elif override is not None:
            r = override
            inst.use_state_arguments = True

        else:
            # get the arguments

            # If the simprocedure is related to a Java function call the appropriate setup_args methos
            # TODO: should we move this?
            if self.is_java:
                sim_args = self._setup_args(inst, state, arguments)
                self.use_state_arguments = False

            # handle if this is a continuation from a return
            elif inst.is_continuation:
                if state.callstack.top.procedure_data is None:
                    raise SimProcedureError("Tried to return to a SimProcedure in an inapplicable stack frame!")

                saved_sp, sim_args, saved_local_vars, saved_lr = state.callstack.top.procedure_data
                state.regs.sp = saved_sp
                if saved_lr is not None:
                    state.regs.lr = saved_lr
                inst.arguments = sim_args
                inst.use_state_arguments = True
                inst.call_ret_expr = state.registers.load(state.arch.ret_offset, state.arch.bytes, endness=state.arch.register_endness)
                for name, val in saved_local_vars:
                    setattr(inst, name, val)
            else:
                if arguments is None:
                    inst.use_state_arguments = True
                    sim_args = [ inst.arg(_) for _ in range(inst.num_args) ]
                    inst.arguments = sim_args
                else:
                    inst.use_state_arguments = False
                    sim_args = arguments[:inst.num_args]
                    inst.arguments = arguments

            # run it
            l.debug("Executing %s%s%s%s%s with %s, %s", *(inst._describe_me() + (sim_args, inst.kwargs)))
            r = getattr(inst, inst.run_func)(*sim_args, **inst.kwargs)

        if inst.returns and inst.is_function and not inst.inhibit_autoret:
            inst.ret(r)

        return inst
888435
static <T> Subscriber<T> wrap(
            Subscriber<T> downstream, List<RunnableInstrumenter> instrumentations) {
        if (downstream instanceof FlowableSubscriber) {
            return new RxInstrumentedFlowableSubscriber<>(downstream, instrumentations);
        }
        return new RxInstrumentedSubscriber<>(downstream, instrumentations);
    }
293220
public void execute() {
        state = State.Running;
        for (Subscription sub : subscriptions) {
           sub.publish(this, message);
        }
        state = State.Finished;
        // This part is necessary to support the feature of publishing a DeadMessage or FilteredMessage
        // in case that the original message has not made it to any listener.
        // This happens if subscriptions are empty (due to GC of weak listeners or explicit desubscription)
        // or if configured filters do not let a message pass. The flag is set by the dispatchers.
        // META: This seems to be a suboptimal design
        if (!dispatched) {
            if (!isFilteredMessage() && !isDeadMessage()) {
                runtime.getProvider().publish(new FilteredMessage(message));
            } else if (!isDeadMessage()) {
                runtime.getProvider().publish(new DeadMessage(message));
            }

        }
    }
1282564
def execute(self):
        
        stack = self._stack
        callbacks = self._callbacks
        self._stack = []
        self._callbacks = []

        deferred = []

        build = self._nested_future

        pipe = self._pipeline(self.connection_name)
        for item, args, kwargs, ref in stack:
            f = getattr(pipe, item)
            deferred.append(build(f(*args, **kwargs), ref))

        inject_callbacks = getattr(self.parent, '_inject_callbacks')
        inject_callbacks(deferred + callbacks)
407834
def activate(self, *, filter_func=None):
        '''
        
        '''

        if self.active:
            raise RuntimeError("Type safety check already active")

        self.__module_finder = ModuleFinder(Validator.decorate)
        if filter_func is not None:
            self.__module_finder.set_filter(filter_func)
        self.__module_finder.install()
922827
def instrument(type, name, opts = {})
      txn     = ::HeimdallApm::TransactionManager.current
      segment = ::HeimdallApm::Segment.new(type, name)
      txn.start_segment(segment)

      # TODO: maybe yield the segment here to have the block pass additional
      # informations
      yield
    ensure
      txn.stop_segment
    end
364318
def subscribe(self, callback, existing=True):
        
        if callback in self.callbacks:
            return
        self.callbacks.append(callback)
        if not existing:
            return
        for dist in self:
            callback(dist)
234644
function(cb) {
      //console.log('tx running for ' + scope);
      // me.not_ready_ = true;
      // transaction should be active now
      var tx = me.mu_tx_.getTx();
      me.r_no_++;
      req.setTx(tx, me.getLabel() + 'R' + me.r_no_);
    }
284585
def do_execute(self):
        
        self.first_active.input = self.input
        result = self._director.execute()
        if result is None:
            self._output.append(self.input)
        return result
1218386
def _complete_execution(self, g):
        """"""

        # Triggered via completion callback.
        #
        # Runs in its own greenlet, so take care to forward the
        # exception, if any, to fail the entire transfer in event of
        # trouble.
        assert g.ready()
        self.greenlets.remove(g)

        placed = UserCritical(msg='placeholder bogus exception',
                              hint='report a bug')

        if g.successful():
            try:
                segment = g.get()

                if not segment.explicit:
                    segment.mark_done()
            except BaseException as e:
                # Absorb and forward exceptions across the channel.
                placed = e
            else:
                placed = None
        else:
            placed = g.exception

        self.wait_change.put(placed)
850914
def subscribe
      security_transgression_unless @thread.can_subscribe?(@user)

      @thread.errors.add(:base, t('commontator.subscription.errors.already_subscribed')) \
        unless @thread.subscribe(@user)

      respond_to do |format|
        format.html { redirect_to @thread }
        format.js { render :subscribe }
      end

    end