Sample framework

A proposal to fix #41.

Please review and test on your systems.

Feedback is appreciated (also for *benchmark mode*).