An electrocardiogram is a test that records the electrical activity of the heart.  ECG is used to measure the rate and regularity of heartbeats as well as the size and position of the chambers, the presence of any damage to the heart, and the effects of drugs or devices used to regulate the heart (such as a pacemaker).