Based on my experience, I think the answer is 'the motor'.
- The total distance ridden (22,000 km) reset to zero when my motor (Performance Line CX) was replaced.
- Later when the Kiox display (by then reading 3,000 km; instead of 25,000 km) was replaced there was no change in the displayed total distance (of the new motor).