Each of the PKCS#11 engine check_new_*() functions contain a predicate which decides if there is a cache hit or miss for particular key. These functions should return a value to indicate which of the 2 possible events happened. With modifications done in CR 6602801 (split check_new_*() into public/private where possible) we will be able to observe cache utilization in a fine-grained view:
root:fluke:/export/home# dtrace -s cache-observe.d -p `pgrep httpd`
entries created so far = 0
entries owned by threads = 0
entries created so far = 7
entries owned by threads = 0
entries created so far = 7
entries owned by threads = 0
entries created so far = 10
entries owned by threads = 0
entries created so far = 10
entries owned by threads = 2
^C
Cache statistics:
Consumers of cache entries:
libcrypto.so.0.9.8`pk11_RSA_sign 33
libcrypto.so.0.9.8`pk11_DH_generate_key 33
libcrypto.so.0.9.8`pk11_DH_compute_key 33
libcrypto.so.0.9.8`pk11_rand_bytes 66
libcrypto.so.0.9.8`pk11_RSA_verify 67
libcrypto.so.0.9.8`pk11_rand_add 132
libcrypto.so.0.9.8`pk11_digest_init 6240
Total | RSA_pub | RSA_priv | DSA_pub | DSA_priv | DH
Hits: 30 | 5 | 25 | 0 | 0 | 0
Misses: 103 | 62 | 8 | 0 | 0 | 33