From daec89e0cae4b4f87cd263d385eca353c04f3f0d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 18 Sep 2010 09:08:00 +0000 Subject: use runtime cache line size detection Modern glibc can easily return the L1 cache line size with sysconf(3), so we'll use that and avoid paying a size penalty on CPUs with smaller cache lines than 128 (every modern x86 except the idiotic P4). Additionally, if we detect a single CPU machine, avoid paying any padding penalty at all. On machines without the non-portable glibc sysconf(3) enhancements, we'll continue to operate on the assumption of an enormous 128 byte cache line size. --- test/test_raindrops.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') diff --git a/test/test_raindrops.rb b/test/test_raindrops.rb index 93885ef..aab1f14 100644 --- a/test/test_raindrops.rb +++ b/test/test_raindrops.rb @@ -4,6 +4,12 @@ require 'raindrops' class TestRaindrops < Test::Unit::TestCase + def test_raindrop_size + assert_kind_of Integer, Raindrops::SIZE + assert Raindrops::SIZE > 0 + puts "Raindrops::SIZE = #{Raindrops::SIZE}" + end + def test_size rd = Raindrops.new(4) assert_equal 4, rd.size -- cgit v1.2.3-24-ge0c7