-
-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement GC.{measure_total_time, total_time} and update GC.stat to u…
…pdate provided hash
- Loading branch information
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require_relative '../../spec_helper' | ||
|
||
ruby_version_is "3.1" do | ||
describe "GC.measure_total_time" do | ||
before :each do | ||
@default = GC.measure_total_time | ||
end | ||
|
||
after :each do | ||
GC.measure_total_time = @default | ||
end | ||
|
||
it "can set and get a boolean value" do | ||
original = GC.measure_total_time | ||
GC.measure_total_time = !original | ||
GC.measure_total_time.should == !original | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require_relative '../../spec_helper' | ||
|
||
ruby_version_is "3.1" do | ||
describe "GC.total_time" do | ||
it "returns an Integer" do | ||
GC.total_time.should be_kind_of(Integer) | ||
end | ||
|
||
it "increases as collections are run" do | ||
time_before = GC.total_time | ||
GC.start | ||
GC.total_time.should > time_before | ||
end | ||
end | ||
end |
5185a7a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bjfish @eregon
JFYI,
core/gc/total_time_spec.rb:12
is intermittently failing on Windows mingw or ucrt in Ruby master, and also ruby-loco builds. When it fails, the two values are equal. I don't know if this is a problem, if Windows has a resolution / rounding issue with nanoseconds, etc... Note thatRUBY_PLATFORM.include? 'mingw'
is true for both. Also, mswin builds haven't failed (?)5185a7a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a log or output?
Maybe
GC.total_time
doesn't work on Windows.In any case I think best to report this to CRuby.
5185a7a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See ruby/ruby#5193 or ruby/ruby@ac8647b