Print accounting information in heartbeat messages.

Implements ticket 5526.
Tweak/cleanup 5526 fix.
Merge branch 'ticket5526'