An electrocardiogram (ECG) is a basic heart test that records the electrical activity of your heart. An ECG is often used to measure: Any damage to your heart rate of heart beating, regularity of heart beating The effects of drugs or devices used to control the heart (such as a pacemaker, CRT device) The size and position of your heart chambers like atria and ventricle