Add func begin and leave trace