added timing code to each pipeline stage