| 26 | |
| 27 | |
| 28 | void profile_enter( OBJECT * rulename, profile_frame * frame ) |
| 29 | { |
| 30 | if ( DEBUG_PROFILE ) |
| 31 | { |
| 32 | double start = profile_clock(); |
| 33 | profile_info * p; |
| 34 | |
| 35 | if ( !profile_hash && rulename ) |
| 36 | profile_hash = hashinit( sizeof( profile_info ), "profile" ); |
| 37 | |
| 38 | if ( rulename ) |
| 39 | { |
| 40 | int found; |
| 41 | p = (profile_info *)hash_insert( profile_hash, rulename, &found ); |
| 42 | if ( !found ) |
| 43 | { |
| 44 | p->name = rulename; |
| 45 | p->cumulative = 0; |
| 46 | p->net = 0; |
| 47 | p->num_entries = 0; |
| 48 | p->stack_count = 0; |
| 49 | p->memory = 0; |
| 50 | } |
| 51 | } |
| 52 | else |
| 53 | { |
| 54 | p = &profile_other; |
| 55 | } |
| 56 | |
| 57 | p->num_entries += 1; |
| 58 | p->stack_count += 1; |
| 59 | |
| 60 | frame->info = p; |
| 61 | |
| 62 | frame->caller = profile_stack; |
| 63 | profile_stack = frame; |
| 64 | |
| 65 | frame->entry_time = profile_clock(); |
| 66 | frame->overhead = 0; |
| 67 | frame->subrules = 0; |
| 68 | |
| 69 | /* caller pays for the time it takes to play with the hash table */ |
| 70 | if ( frame->caller ) |
| 71 | frame->caller->overhead += frame->entry_time - start; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | |
| 76 | void profile_memory( size_t mem ) |
no test coverage detected