come code to measure error rate