Which sentence includes a gerund?

The author has been writing mysteries for twenty years.

Good writing comes from dedication and practice.

When she is reading mysteries, Hayley loses track of time.

Sonia was writing a poem when her phone rang.