Hearthbeat Sensor

Does anyone know the program code to calculate BPM?
like the video on this link ...

Does anyone know the program code to calculate BPM?

Have you bothered to google anything?