Automatic analysis of pacemaker function in long-term ECG recordings