An electrocardiogram (ECG) is a test that records the electrical activity of the heart to assess its health and identify any irregularities such as hypertrophy or previous heart attacks. The ECG measures the time and strength of electrical impulses through the heart using ten electrodes placed on the patient, providing a non-invasive and immediate analysis useful for diagnosing various heart conditions. The ECG waveform is made up of three key components: the P wave, QRS complex, and T wave, reflecting the heart's depolarization and repolarization processes during cardiac cycles.