| 3278 | } |
| 3279 | |
| 3280 | void fxCreateProfiler(txMachine* the) |
| 3281 | { |
| 3282 | txProfiler* profiler = the->profiler = c_malloc(sizeof(txProfiler)); |
| 3283 | if (profiler == C_NULL) |
| 3284 | fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT); |
| 3285 | profiler->interval = 1250; |
| 3286 | profiler->former = fxGetMicroSeconds(); |
| 3287 | profiler->when = profiler->former + profiler->interval; |
| 3288 | |
| 3289 | profiler->recordCount = 128; |
| 3290 | profiler->records = c_calloc(1, profiler->recordCount); |
| 3291 | if (profiler->records == C_NULL) |
| 3292 | fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT); |
| 3293 | |
| 3294 | profiler->sampleIndex = 0; |
| 3295 | profiler->sampleSize = (the->stackTop - the->stackBottom) >> 3; |
| 3296 | profiler->samples = (txID*)c_malloc((size_t)(mxProfilerSampleCount * profiler->sampleSize * sizeof(txID))); |
| 3297 | if (profiler->samples == C_NULL) |
| 3298 | fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT); |
| 3299 | |
| 3300 | fxSendProfilerTime(the, "start", profiler->former); |
| 3301 | fxSendProfilerRecord(the, C_NULL, 0, C_NULL); |
| 3302 | fxSendProfilerRecord(the, C_NULL, 1, C_NULL); |
| 3303 | profiler->records[0] = 0x03; |
| 3304 | } |
| 3305 | |
| 3306 | void fxDeleteProfiler(txMachine* the, void* stream) |
| 3307 | { |
no test coverage detected