ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:81726] [Ruby trunk Feature#13667] Add Coverage.running? to quickly check if Coverage is enabled.
       [not found] <redmine.issue-13667.20170619193914@ruby-lang.org>
@ 2017-06-19 19:39 ` burke
  2017-06-20  0:08 ` [ruby-core:81729] [Ruby trunk Feature#13667][Assigned] " hsbt
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: burke @ 2017-06-19 19:39 UTC (permalink / raw)
  To: ruby-core

Issue #13667 has been reported by burke (Burke Libbey).

----------------------------------------
Feature #13667: Add Coverage.running? to quickly check if Coverage is enabled.
https://bugs.ruby-lang.org/issues/13667

* Author: burke (Burke Libbey)
* Status: Open
* Priority: Normal
* Assignee: 
* 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/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:81729] [Ruby trunk Feature#13667][Assigned] Add Coverage.running? to quickly check if Coverage is enabled.
       [not found] <redmine.issue-13667.20170619193914@ruby-lang.org>
  2017-06-19 19:39 ` [ruby-core:81726] [Ruby trunk Feature#13667] Add Coverage.running? to quickly check if Coverage is enabled burke
@ 2017-06-20  0:08 ` hsbt
  2017-08-25  0:56 ` [ruby-core:82462] [Ruby trunk Feature#13667] " mame
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: hsbt @ 2017-06-20  0:08 UTC (permalink / raw)
  To: 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/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:82462] [Ruby trunk Feature#13667] Add Coverage.running? to quickly check if Coverage is enabled.
       [not found] <redmine.issue-13667.20170619193914@ruby-lang.org>
  2017-06-19 19:39 ` [ruby-core:81726] [Ruby trunk Feature#13667] Add Coverage.running? to quickly check if Coverage is enabled burke
  2017-06-20  0:08 ` [ruby-core:81729] [Ruby trunk Feature#13667][Assigned] " hsbt
@ 2017-08-25  0:56 ` mame
  2017-08-25  1:04 ` [ruby-core:82465] " spiketeika
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: mame @ 2017-08-25  0:56 UTC (permalink / raw)
  To: ruby-core

Issue #13667 has been updated by mame (Yusuke Endoh).


Sorry for the late reply.  I'm positive for this proposal.

There is the same request #13838, which reminds me of this ticket.  That issue proposes `Coverage.enabled?`.  I'm unsure, but `running?` seems a bit better to me because the starting API is not `Coverage.enabled = true` but `Coverage.start`.

Any opinions?  If there is no strong objection, I will choose `running?`.

----------------------------------------
Feature #13667: Add Coverage.running? to quickly check if Coverage is enabled.
https://bugs.ruby-lang.org/issues/13667#change-66272

* 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/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:82465] [Ruby trunk Feature#13667] Add Coverage.running? to quickly check if Coverage is enabled.
       [not found] <redmine.issue-13667.20170619193914@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2017-08-25  0:56 ` [ruby-core:82462] [Ruby trunk Feature#13667] " mame
@ 2017-08-25  1:04 ` spiketeika
  2017-09-02 14:11 ` [ruby-core:82635] [Ruby trunk Feature#13667][Feedback] " mame
  2019-01-21  8:23 ` [ruby-core:91204] [Ruby trunk Feature#13667] " mame
  5 siblings, 0 replies; 6+ messages in thread
From: spiketeika @ 2017-08-25  1:04 UTC (permalink / raw)
  To: ruby-core

Issue #13667 has been updated by yui-knk (Kaneko Yuichiro).


I also think `running?` is better. And I feel `#test_coverage_running?` is good enough :)


----------------------------------------
Feature #13667: Add Coverage.running? to quickly check if Coverage is enabled.
https://bugs.ruby-lang.org/issues/13667#change-66275

* 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/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:82635] [Ruby trunk Feature#13667][Feedback] Add Coverage.running? to quickly check if Coverage is enabled.
       [not found] <redmine.issue-13667.20170619193914@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2017-08-25  1:04 ` [ruby-core:82465] " spiketeika
@ 2017-09-02 14:11 ` mame
  2019-01-21  8:23 ` [ruby-core:91204] [Ruby trunk Feature#13667] " mame
  5 siblings, 0 replies; 6+ messages in thread
From: mame @ 2017-09-02 14:11 UTC (permalink / raw)
  To: ruby-core

Issue #13667 has been updated by mame (Yusuke Endoh).

Status changed from Closed to Feedback

I applied the patch proposed.  After that, however, I'm now considering reverting it.

I noticed that this feature may be dangerous.  By using this, we can easily write a program that changes its behavior only under coverage measurement.  It brings difficulties to testing with coverage measurement.  I don't see such a bad program released into the wild.

Could you elaborate your use case that beats the disadvantage?  If any, I will remain the feature, but otherwise, I will revert it.

----------------------------------------
Feature #13667: Add Coverage.running? to quickly check if Coverage is enabled.
https://bugs.ruby-lang.org/issues/13667#change-66462

* Author: burke (Burke Libbey)
* Status: Feedback
* 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/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:91204] [Ruby trunk Feature#13667] Add Coverage.running? to quickly check if Coverage is enabled.
       [not found] <redmine.issue-13667.20170619193914@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2017-09-02 14:11 ` [ruby-core:82635] [Ruby trunk Feature#13667][Feedback] " mame
@ 2019-01-21  8:23 ` mame
  5 siblings, 0 replies; 6+ messages in thread
From: mame @ 2019-01-21  8:23 UTC (permalink / raw)
  To: ruby-core

Issue #13667 has been updated by mame (Yusuke Endoh).

Status changed from Feedback to Closed

I have forgotten why the status of this ticket is feedback :-)  Anyway, it is already released, so there is no change to remove it.  Closing.

----------------------------------------
Feature #13667: Add Coverage.running? to quickly check if Coverage is enabled.
https://bugs.ruby-lang.org/issues/13667#change-76441

* Author: burke (Burke Libbey)
* Status: Closed
* 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/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-01-21  8:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-13667.20170619193914@ruby-lang.org>
2017-06-19 19:39 ` [ruby-core:81726] [Ruby trunk Feature#13667] Add Coverage.running? to quickly check if Coverage is enabled burke
2017-06-20  0:08 ` [ruby-core:81729] [Ruby trunk Feature#13667][Assigned] " hsbt
2017-08-25  0:56 ` [ruby-core:82462] [Ruby trunk Feature#13667] " mame
2017-08-25  1:04 ` [ruby-core:82465] " spiketeika
2017-09-02 14:11 ` [ruby-core:82635] [Ruby trunk Feature#13667][Feedback] " mame
2019-01-21  8:23 ` [ruby-core:91204] [Ruby trunk Feature#13667] " mame

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).