macro to compute the efficiency