tracks the timing hit type
 @param block [#call] block is executed and time recorded
508854
def track!(&block)
      if block_given?
        start_at = Time.now
        block.call
        end_at = Time.now

        self.options.time = (end_at - start_at).to_i*1000
      end

      super
    end
835563
def run_deferred(top_level_context)
      deferred_blocks = self.deferred_blocks
      @deferred_blocks = nil

      deferred_blocks.each do |target, block|
        context(target, &block)
      end

      if @deferred_blocks
        run_deferred(top_level_context)
      end
    end
728441
def add(hash, &func)
      raise ArgumentError.new('Expecting hash of arguments') unless hash.is_a?(Hash)
      raise ArgumentError.new('A period must be provided for timed action') unless hash[:period]
      raise ArgumentError.new('Block must be provided') unless block_given?
      raise ArgumentError.new('Block must accept data value') if hash[:data] && func.arity == 0
      args = {:once => false, :data => nil, :owner => nil}.merge(hash)
      action = Action.new(args.merge(:timer => self), &func)
      @add_lock.synchronize{ @new_actions << action }
      wakeup if running?
      action
    end
379178
private function trackBlocks(Collection $collection, array $blocks)
    {
        $version = $collection->getVersionID();
        $buffer = 0;

        foreach ($blocks as $block) {

            if ($block instanceof Controller) {
                $controller = $block;
                $block = $controller->getBlockObject();
            }

            if ($block->getBlockTypeHandle() == BLOCK_HANDLE_STACK_PROXY) {
                if (!$controller) {
                    $controller = $block->getController();
                }

                $this->persist(
                    $controller->getStackID(),
                    $collection->getCollectionID(),
                    $version,
                    $block->getBlockID());
                $buffer++;
            }

            if ($buffer > 2) {
                $this->manager->flush();
                $buffer = 0;
            }
        }

        if ($buffer) {
            // Sometimes you just need an extra flush...
            $this->manager->flush();
        }
    }
232996
def state_run_block(channel)
      debug :run_block
      channel[:state] = nil
      blk = channel[:block]
      channel[:block] = nil
      begin
        instance_eval &blk
      rescue => ex
        channel[:exception] = ex
      end
      channel[:state] = :exit
    end
446864
def run_callbacks(action_name, &block)
      filter_callbacks(:before, action_name).each { |hook| send hook[:callback] }
      yield if block_given?
      filter_callbacks(:after, action_name).each { |hook| send hook[:callback] }
    end
327347
function BlockData(index, buf, cb, count) {
  this.index = index;
  this.buf = buf;
  this.cb = cb;
  this.count = count | 0;
}
242645
private void resetSketchBlockSendTimeout() {
        TimerTask onTimeout = new TimerTask() {
            @Override
            public void run() {
                sendNextSketchBlock();
            }
        };

        stopSketchBlockSendTimeout();
        sketchBlockSendTimeout = new Timer();
        sketchBlockSendTimeout.schedule(onTimeout, SKETCH_BLOCK_SEND_INTERVAL);
    }
1368155
def do_heavy_work(self, block):
        

        destinations = self.destinations()
        ''' FIXME currently we return block whether it was correctly processed or not because MailSenders are chained
            and not doing that would mean other wouldn't be able to try.'''
        if not set(destinations).issubset(block.destinations):
            self.log.debug("Block not for any of the associated destinations: %s", destinations)
        else:
            try:
                self.do_send(block)
                # mark the block as sent by this sender
                block.send_destinations.extend(destinations)

                verif_data = self.verification_data()
                if verif_data is not None:
                    for destination in destinations:
                        block.destinations_verif_data[destination] = verif_data
            except SendingError:
                self.log.exception("Failed to send block (%s) to destination (%s)", block, destinations)
        return block
185921
public void record(ByteBuffer block, int offset) {
    if (this.data == null) {
      // TODO: remove cast to int when large ByteBuffer support is
      // implemented in Java.
      this.data = ByteBuffer.allocate((int) this.length);
    }

    int pos = block.position();
    this.data.position(offset);
    this.data.put(block);
    block.position(pos);
  }
354834
def track(component, exception, packet = nil)
      if @exception_stats
        component = component.class.name.split("::").last.snake_case unless component.is_a?(String)
        @exception_stats.track(component, exception, packet)
      end
      true
    end
103938
def on_complete(&block)
      on do |_, value, reason|
        block.call(reason == nil, value, reason)
      end
    end
358764
def block(*, name = None, metric = call_default, count = 1):
    
    t = time.time()
    try:
        yield
    finally:
        metric(name, count, time.time() - t)
1122605
def _start_watching_blocks(self):
        '''
        
        '''
        if sum(map(len, (self.solid_watchers, self.block_watchers))) == 1:
            eth.filter('latest').watch(self._new_block)
249050
def read_block(self, block):
        
        self.seek(block.file_offset)
        return self._fhandle.read(block.size)
1165588
public function runBlock($block, $closure, $type)
    {
        return Filters::run($this, 'runBlock', [$block, $closure, $type], function ($next, $block, $closure, $type) {
            return call_user_func_array($closure, []);
        });
    }
120151
def trigger(self, source, actions, event_args):
		
		type = BlockType.TRIGGER
		return self.action_block(source, actions, type, event_args=event_args)