411 Commits
Author SHA1 Message Date
Matt Valentine-House 01fe91202c Replace GC.stat scope: with a process: keyword
Recently we added some keys to GC.stat in order to measure the GC
performance of Ractor local GC and the associated global GC.

This commit refactors some of those terms: "global" was used in two
places with different meanings which could get confusing.

When it was passed to GC.stat as scope: :global it meant "Give me
aggregate stats for all the GCs running in this process".

Whereas inside the output of GC.stat, global referred to the number of
"global" GCs that are run. That is: stop-the-world GCs that run on
every ractor heap in the process.

Also the global_gc_count that GC.stat reports for a Ractor ignored
global GCs that other Ractors started, even though they swept its heap.

In this commit we fix this confusing behaviour, and make the GC.stat
output more consistent.

We've replaced the scope: parameter to GC.stat with the boolean
process: keyword arg. The default is process: false which means
GC.stat will return stats for the Ractor that executes the code (the
main Ractor if no other Ractors have been created). process: true will
return aggregate stats over all the Ractors in the process (including
dead ones).

Inside GC.stat(process: false), count and global_gc_count now
include every global GC that has swept that Ractor's heap. So Ractor
local gc count == count - global_gc_count.

heap_marked_slots now counts only the marked objects in that Ractor's
own heap. Before, the Ractor that started a global GC counted the
marked objects of every heap, and the other Ractors reported 0.

We also provide a new key global_gc_invocation_count that is the
number of global GCs that have been triggered by the Ractor in question.

We've also moved some keys related to the global page pool out of the
default GC.stat output and into GC.stat(process: true), because they
are process-wide and not Ractor specific.
2026-10-23 17:05:54 +01:00
Matt Valentine-House 6cc4ec3405 Add a per-Ractor GC timing example 2026-09-25 12:18:01 +01:00
Nobuyoshi Nakada 9ef2153cdf Fix condition, 0 is truethy in Ruby [ci skip] 2026-04-03 13:08:06 +09:00
Orgad Shaneh 0f3c6ca480 [ruby/openssl] c_rehash: fix hash_name output for small hashes
The hash lookup is done by 8-character hash.

https://github.com/ruby/openssl/commit/fedb57255c
2025-09-17 12:25:39 +00:00
Hiroshi SHIBATA 9503a77da2 DRb has been extracted as bundled gems 2025-07-04 13:01:39 +09:00
Takashi Kokubun d06ec25be4 Revert "* remove trailing spaces. [ci skip]"
This reverts commit 6062c904ae.

tompng said animation becomes weird if you remove trailing spaces.
We fixed auto-style instead
https://github.com/ruby/git.ruby-lang.org/commit/a8635a4cd93c8adc2e1b48b6ae8fa3fcd3bb4b34.
2025-04-18 06:48:30 +09:00
git 6062c904ae * remove trailing spaces. [ci skip] 2025-04-17 10:59:30 +00:00
Yusuke Endoh 25efd09c71 sample/trick2025/: adds the top-five entries of TRICK 2025
See https://github.com/tric/trick2025 for TRICK 2025.
2025-04-17 19:59:19 +09:00
Hiroshi SHIBATA 721891688b Migrate win32ole as bundled gems 2025-01-16 12:35:21 +09:00
git 78fb1ab84b * remove trailing spaces. [ci skip] 2024-10-16 18:22:44 +00:00
Kevin Newton 9251971335 [ruby/prism] Add a sample for multiplexing constants
https://github.com/ruby/prism/commit/e265dc5862
2024-10-16 18:22:35 +00:00
Kevin Newton 550ae745f6 [ruby/prism] Relocation
https://github.com/ruby/prism/commit/5ea6042408
2024-10-16 15:56:01 +00:00
Kevin Newton d012f6d49f [ruby/prism] Add sample for generating tags
https://github.com/ruby/prism/commit/7c9ca47ac5
2024-08-12 18:44:18 +00:00
Kevin Newton c4a021ef96 [ruby/prism] Move sample files under sample/prism
https://github.com/ruby/prism/commit/9e9b069404
2024-07-16 19:26:28 +00:00
Kevin Newton 78d7b470ec [ruby/prism] Add some code samples
https://github.com/ruby/prism/commit/f5c883af56
2024-06-06 14:15:55 +00:00
Kevin Newton b0059980d0 [ruby/prism] Add some samples for using prism APIs
https://github.com/ruby/prism/commit/6a4fe21088
2024-06-06 14:15:50 +00:00
Nobuyoshi Nakada 3ad54239b5 [ruby/win32ole] [DOC] Move sample to toplevel
https://github.com/ruby/win32ole/commit/70ea60c4d2
2024-01-28 15:25:36 +00:00
Hiroshi SHIBATA 9f02680015 Removed sample code for net-imap. net-imap is alread extracted as bundled gems 2024-01-16 17:09:35 +09:00
Hiroshi SHIBATA 4b6936aa04 Unbundled samples for getoptlong 2024-01-16 17:07:10 +09:00
Yusuke Endoh b6704201a3 Add all-ruby-quine as a sample code
This sample code works on all release versions of Ruby, from Ruby 0.49.
2023-02-27 11:20:42 +09:00
Thomas R. KollandNobuyoshi Nakada f03dd4ee77 Refactor dir.rb sample (#6977) [ci skip]
* Refactor dir.rb sample

The original (1998) sample with a for-loop and use of case/when isn't what we'd write nowadays

* [DOC] Update sample/dir.rb [ci skip]

Do not leave a `Dir` opened.

* [DOC] Update sample/dir.rb [ci skip]

Fix ArgumentError.

---------

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-02-15 12:41:53 +09:00
Yusuke Endoh af4cd997a1 sample/trick2022/03-mame/entry.rb: remove trailing spaces 2022-12-24 03:19:45 +09:00
Yusuke Endoh e8b0180974 sample/trick2022/: adds the top-three entries of TRICK 2022
See https://github.com/tric/trick2022 for TRICK 2022.
2022-12-24 03:19:45 +09:00
Nobuyoshi Nakada 0b767d743f Use io/console to avoid stty error [ci skip] 2022-12-05 19:23:16 +09:00
Nobuyoshi Nakada d752cf7601 Use class methods of File over Kernel.open and IO.read 2022-12-01 02:28:49 +09:00
Yusuke Endoh 267452e6fe Sync TRICK 2018 (02-mame)
https://github.com/tric/trick2018/pull/5
2022-11-05 23:18:32 +09:00
Yudai Takada 3bceae0fad Fix typo in README (#5925)
"iteretor" -> "iterator"
2022-05-20 14:45:46 -07:00
Hiroshi SHIBATA f7539d5758 [ruby/getoptlong] ruby/ruby used sample, not examples
https://github.com/ruby/getoptlong/commit/39faa7b390
2022-05-09 07:13:55 +09:00
Nobuyoshi Nakada 40e7aefeba Remove obsolete Fixnum and Bignum 2021-12-28 18:35:03 +09:00
Nobuyoshi Nakada e9a13332e8 Fix typos [ci skip] 2021-11-03 19:11:45 +09:00
Kevin Newton f4b88959d5 Clean up lambda output from exyacc.rb
The `lambda_body` grammar rule has a `"}"`, which is throwing off the `exyacc.rb` regular expressions. This changes the regular expression to account for `"}"` as well, which makes the output of `ruby sample/exyacc.rb < parse.y` change by the following diff:

```diff
632,634d631
< 		    ", &@3);
< 			$$ = $2;
< 		    }
```

Which makes it closer to a valid EBNF.
2021-08-25 18:23:56 -07:00
Nobuyoshi Nakada 9eae8cdefb Prefer qualified names under Thread 2021-06-29 11:41:10 +09:00
Kenichi Kamiya ec4a41c4dd [Doc] Fix a typo s/interseting/interesting/ 2021-03-22 15:33:32 +09:00
Kazuki Yamaguchi 7f0b3fb906 [ruby/openssl] sample: update obsolete API use
https://github.com/ruby/openssl/commit/dafa851c0d
2021-03-16 19:37:06 +09:00
Kazuki Yamaguchi e35d3623de [ruby/openssl] sample: avoid "include OpenSSL"
It is not a common practice and should not be done since it causes name
clash: for example, Digest and Random are provided by other standard
libraries of Ruby.

Fixes: https://github.com/ruby/openssl/issues/419

https://github.com/ruby/openssl/commit/6a6444984b
2021-03-16 19:37:06 +09:00
Kazuki Yamaguchi 10d360847b [ruby/openssl] pkey: prefer PKey.read over PKey::RSA.new in docs
https://github.com/ruby/openssl/commit/cf92a3ffba
2021-03-16 19:16:10 +09:00
Sutou Kouhei a4a6cb036e Remove samples for test-unit
They are no longer needed.
2021-01-17 06:08:21 +09:00
Sutou Kouhei f2767cf091 Move rss samples to ruby/rss 2021-01-17 06:07:54 +09:00
Yusuke Endoh a8fc72f5a8 sample/trick2015/kinaba/entry.rb: The constant "Data" has been removed
Instead, use "Proc" as a 4-letter constant.
2020-12-24 01:51:46 +09:00
Kazuhiro NISHIYAMA 144b11e03e Fix warning: instance variable @head not initialized and remove unused instance variable 2020-12-19 15:24:09 +09:00
Hiroshi SHIBATA 05cc58c2eb webrick was removed from ruby repo 2020-12-10 18:06:25 +09:00
Kazuhiro NISHIYAMA 3353baac3d Use own mutex instead of Thread.exclusive
ref [Feature #17125]
2020-08-27 14:37:03 +09:00
Kazuhiro NISHIYAMA 946cd6c534 Use https instead of http 2020-07-28 19:51:54 +09:00
Bart de Water 0b2c70eaa1 [ruby/openssl] Look up digest by name instead of constant
https://github.com/ruby/openssl/commit/b28fb2f05c
2020-05-13 15:47:51 +09:00
Nobuyoshi Nakada db16629008 Fixed misspellings
Fixed misspellings reported at [Bug #16437], only in ruby and rubyspec.
2019-12-20 09:32:42 +09:00
David Rodríguez f48655d04d Remove unneeded exec bits from some files
I noticed that some files in rubygems were executable, and I could think
of no reason why they should be.

In general, I think ruby files should never have the executable bit set
unless they include a shebang, so I run the following command over the
whole repo:

```bash
find . -name '*.rb' -type f -executable -exec bash -c 'grep -L "^#!" $1 || chmod -x $1' _ {} \;
```
2019-11-09 21:36:30 +09:00
Kazuhiro NISHIYAMA cc8116b03e Fix a typo [ci skip] 2019-11-01 18:33:58 +09:00
Jeremy Evans 71d97a5ef8 Fix sample/drb/http0serv.rb
Previously, trying to use this would result in:

undefined method `uri' for #<DRb::HTTP0::ServerSide:0x00000aec9f1637f8> (NoMethodError)

Also, use a relative require to load sample/drb/http0.rb.

Fixes [Bug #13431]
2019-08-25 10:56:47 -07:00
Kenichi Kamiya 8882986d97 Drop duplicated sample code (#2389) [ci skip]
* Drop duplicated sample code

* Drop another style sample

https://github.com/ruby/ruby/pull/2389#issuecomment-522489520

* Update sample list
2019-08-19 18:43:23 +09:00
Kenichi Kamiya 9b330200f8 Remove unused variable to suppress warning (#2388) [ci skip]
```
sample/observ.rb:30: warning: assigned but unused variable - clock
```
2019-08-19 18:16:45 +09:00