Solaris Entropy statistics

I exchanged an email or two with Andy Tucker regarding Solaris 9 entropy pools, and found out that entropy statistics are available through mdb’s (modular debugger) “rnd_stats” dcmd:

$ uname -a
SunOS winnie 5.9 Generic_117171-14 sun4u sparc SUNW,Ultra-5_10

$ mdb -k

Loading modules: [ unix krtld genunix ip lofs nfs random ptm ]

> ::rnd_stats
Random number generator statistics:
    8192 bits of entropy estimate
       0 bytes generated for /dev/random
 5998456 bytes generated for /dev/urandom
 2277764 bits of entropy added to the pool
   94006 bits of entropy extracted from the pool
 4849216 bytes added to the random pool
     240 bytes extracted from the random pool

With Solaris 10, you can use the “swrand_stats” and “rnd_stats” dcmds to get entropy statistics:

$ uname -a
SunOS sparky 5.10 s10_69 i86pc i386 i86pc

$ mdb -k

Loading modules: [ unix krtld genunix specfs dtrace ufs ip sctp uhci usba nca random lofs sppp nfs crypto ptm ]

> ::swrand_stats                      
Software-based Random number generator statistics:
    8192 bits of entropy estimate
  861095 bits of entropy added to the pool
    8480 bits of entropy extracted from the pool
 2318888 bytes added to the random pool
    1060 bytes extracted from the random pool

> ::rnd_stats
Random number device statistics:
       0 bytes generated for /dev/random
       0 bytes read from /dev/random cache
      36 bytes generated for /dev/urandom

I wish there was a way to tell if an application blocked because of a depleted pool in Solaris 9 ( dtrace may solve this problem in Solaris 10).