Merge: lib: introduce module hash_debug
authorJean Privat <jean@pryen.org>
Wed, 13 Aug 2014 20:31:00 +0000 (16:31 -0400)
committerJean Privat <jean@pryen.org>
Wed, 13 Aug 2014 20:31:00 +0000 (16:31 -0400)
commit65ac64339855bfed747fddca23b8cf1f8987dfa7
treec34c9c3e4650a38b77282fe1fb281afee932c980
parent9e60f6f73e0f5167cf0e33ceaac30c0f4c78779b
parentc91e6009d952ba81a56277655aa902b59f2d0bd7
Merge: lib: introduce module hash_debug

Nit-exclusivity thanks to class refinements, intrude imports and the control of the main function.

Inject behavior analysis to hash-collections (HashMap, HashSet, etc.)
Accesses to hash collections are instrumented, and statistics are automatically displayed at the end of the program.

This module helps to detect, and track bad behavior on hash-collections, especially collisions.

Simple usage:

1. compile your program with `-m hash_debug`
2. execute your program.

Advanced usage:

import `hash_debug` and use the functions `Sys::show_hash_stats` and `Sys::clear_hash_stats` at strategic points.

You can also use some dynamic call-graph tools (like valgrind) and look at callers of `HashCollection::gt_collide` and `HashCollection::st_collide`.

Pull-Request: #664
Reviewed-by: Frédéric Vachon <fredvac@gmail.com>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>