| 106 | static txU8 fxTicksToMicroseconds(txU8 ticks); |
| 107 | |
| 108 | void fxCheckProfiler(txMachine* the, txSlot* frame) |
| 109 | { |
| 110 | txProfiler* profiler = the->profiler; |
| 111 | if (!profiler) |
| 112 | return; |
| 113 | txU8 when = profiler->when; |
| 114 | txU8 time = fxGetTicks(); |
| 115 | if (when < time) { |
| 116 | txProfilerRecord* callee = C_NULL; |
| 117 | txProfilerRecord* record = C_NULL; |
| 118 | if (frame) { |
| 119 | record = fxFrameToProfilerRecord(the, frame); |
| 120 | frame = frame->next; |
| 121 | } |
| 122 | else { |
| 123 | frame = the->frame; |
| 124 | if (frame) |
| 125 | record = profiler->gc; |
| 126 | } |
| 127 | if (record) { |
| 128 | callee = record; |
| 129 | while (frame) { |
| 130 | txProfilerRecord* parent = fxFrameToProfilerRecord(the, frame); |
| 131 | if (parent) { |
| 132 | fxInsertProfilerCallee(the, parent, callee->recordID); |
| 133 | callee = parent; |
| 134 | } |
| 135 | frame = frame->next; |
| 136 | } |
| 137 | } |
| 138 | if (callee) |
| 139 | fxInsertProfilerCallee(the, profiler->host, callee->recordID); |
| 140 | else |
| 141 | record = profiler->host; |
| 142 | txU4 interval = profiler->interval; |
| 143 | record->hitCount++; |
| 144 | #ifdef mxMetering |
| 145 | fxPushProfilerSample(the, record->recordID, (txU4)(time - profiler->former), (txU4)(the->meterIndex - profiler->formerMeter)); |
| 146 | profiler->formerMeter = the->meterIndex; |
| 147 | #else |
| 148 | fxPushProfilerSample(the, record->recordID, (txU4)(time - profiler->former)); |
| 149 | #endif |
| 150 | profiler->former = time; |
| 151 | profiler->when = time + interval - (time % interval); |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | void fxCreateProfiler(txMachine* the) |
| 156 | { |
nothing calls this directly
no test coverage detected