Add checking code that kmalloc gave large enough allocation.
Per-thread stat collection framework.