Collect metrics

All the ```read_*_stats``` calls to C methods and the return codes are checked properly.