From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,SPF_PASS,T_DKIM_INVALID,T_RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id EAFE31FA7B for ; Tue, 20 Jun 2017 00:09:06 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 5163A120765; Tue, 20 Jun 2017 09:09:04 +0900 (JST) Received: from o1678916x28.outbound-mail.sendgrid.net (o1678916x28.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 2D49F12075C for ; Tue, 20 Jun 2017 09:09:02 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=a0h6mS0HrqF24yveCbvJtH3obPM=; b=Q1DMRgd24CKWg3Nzo8 qqeRbtQHP3RzQCgI4+qJVSbMsHnVPJjoCosAwCu+fiCXt6MwxkznJJm3pPHjCUqd aIcVMcWNT+8vqFzyYTcGiAzmq5LRe32Vb0ALHe89FnBXZIYc6y6EHpmtTVn/1B92 RQrnoZLBzBHuwsR9romWP/S1Q= Received: by filter0971p1mdw1.sendgrid.net with SMTP id filter0971p1mdw1-17517-5948679A-36 2017-06-20 00:08:58.340949646 +0000 UTC Received: from herokuapp.com (ec2-184-72-179-80.compute-1.amazonaws.com [184.72.179.80]) by ismtpd0003p1iad1.sendgrid.net (SG) with ESMTP id a7cyOWkcT8SWxvqfSpEIsA for ; Tue, 20 Jun 2017 00:08:58.337 +0000 (UTC) Date: Tue, 20 Jun 2017 00:08:57 +0000 From: hsbt@ruby-lang.org To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 56758 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 13667 X-Redmine-Issue-Author: burke X-Redmine-Issue-Assignee: mame X-Redmine-Sender: hsbt X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS4CC6MTXrW07vw/f8Eec+gr4GPlw/H6HnDTf7 94TL8yRRHQuXJxhSrPLMMav2oJLk5XBH6sDV1CcLH9VCZkjSYBnmawuBtYmqqeFTN+2G4AiWf3v9MK oXm3a1WQs5ilPmacTI/DwVN0sGgcN+Oc6GE3D3wrF4tbSDvtjgYfOJkhiw== X-ML-Name: ruby-core X-Mail-Count: 81729 Subject: [ruby-core:81729] [Ruby trunk Feature#13667][Assigned] Add Coverage.running? to quickly check if Coverage is enabled. X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #13667 has been updated by hsbt (Hiroshi SHIBATA). Status changed from Open to Assigned Assignee set to mame (Yusuke Endoh) ---------------------------------------- Feature #13667: Add Coverage.running? to quickly check if Coverage is enabled. https://bugs.ruby-lang.org/issues/13667#change-65429 * Author: burke (Burke Libbey) * Status: Assigned * Priority: Normal * Assignee: mame (Yusuke Endoh) * Target version: ---------------------------------------- Since we can't `RubyVM::InstructionSequence#to_binary` when `Coverage` is running, it is useful to be able to ask ruby if coverage is active. This is possible with `Coverage.peek_result`, but not efficient, since it involves quite a bit of data copying. I've used the private symbol `rb_get_coverages` in [bootsnap](https://github.com/Shopify/bootsnap/pull/63) for now but this feels worth exposing publicly. ``` > Benchmark.realtime { 100.times{ Coverage.peek_result } } => 1.3659249999909662 > Benchmark.realtime { 100.times{ Bootsnap::CompileCache::Native.coverage_running? } } => 5.099998088553548e-05 ``` Example usage: ``` class RubyVM::InstructionSequence def load_iseq(path) return nil if defined?(Coverage) && Coverage.running? # ... end end ``` ---Files-------------------------------- 0001-Add-Coverage.enabled-to-quickly-check-if-coverage-is.patch (1.97 KB) -- https://bugs.ruby-lang.org/