| 3242 | static void fxSendProfilerTime(txMachine* the, txString name, txMicroseconds when); |
| 3243 | |
| 3244 | void fxCheckProfiler(txMachine* the, txSlot* frame) |
| 3245 | { |
| 3246 | txProfiler* profiler = the->profiler; |
| 3247 | if (!profiler) |
| 3248 | return; |
| 3249 | txMicroseconds when = profiler->when; |
| 3250 | txMicroseconds time = fxGetMicroSeconds(); |
| 3251 | if (when <= time) { |
| 3252 | txSize sampleIndex = profiler->sampleIndex; |
| 3253 | txSize sampleSize = profiler->sampleSize; |
| 3254 | txID* samples = profiler->samples + (sampleIndex * sampleSize); |
| 3255 | txU4 interval = profiler->interval; |
| 3256 | profiler->deltas[sampleIndex] = (txU4)(time - profiler->former); |
| 3257 | profiler->former = time; |
| 3258 | profiler->when = time + interval - (time % interval); |
| 3259 | if (!frame) { |
| 3260 | frame = the->frame; |
| 3261 | if (frame) |
| 3262 | *samples++ = 1; |
| 3263 | } |
| 3264 | while (frame) { |
| 3265 | txID id = fxFrameToProfilerID(the, frame); |
| 3266 | if (id) |
| 3267 | *samples++ = id; |
| 3268 | frame = frame->next; |
| 3269 | } |
| 3270 | *samples++ = 0; |
| 3271 | sampleIndex++; |
| 3272 | if (sampleIndex == mxProfilerSampleCount) { |
| 3273 | fxSendProfilerSamples(the, profiler); |
| 3274 | sampleIndex = 0; |
| 3275 | } |
| 3276 | profiler->sampleIndex = sampleIndex; |
| 3277 | } |
| 3278 | } |
| 3279 | |
| 3280 | void fxCreateProfiler(txMachine* the) |
| 3281 | { |
no test coverage detected