add measurement code