instrument function entries and exits