| 153 | } |
| 154 | |
| 155 | void fxCreateProfiler(txMachine* the) |
| 156 | { |
| 157 | txProfiler* profiler = the->profiler = c_malloc(sizeof(txProfiler)); |
| 158 | if (profiler == C_NULL) |
| 159 | fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT); |
| 160 | profiler->interval = (txU4)fxMicrosecondsToTicks(1250); |
| 161 | profiler->former = fxGetTicks(); |
| 162 | profiler->when = profiler->former + profiler->interval; |
| 163 | profiler->start = profiler->former; |
| 164 | #ifdef mxMetering |
| 165 | profiler->interval >>= 1; |
| 166 | profiler->formerMeter = the->meterIndex; |
| 167 | profiler->startMeter = profiler->formerMeter; |
| 168 | #endif |
| 169 | profiler->recordCount = 2; |
| 170 | profiler->records = (txProfilerRecord**)c_calloc(sizeof(txProfilerRecord*), profiler->recordCount); |
| 171 | if (profiler->records == C_NULL) |
| 172 | fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT); |
| 173 | |
| 174 | profiler->sampleCount = 1024; |
| 175 | profiler->sampleIndex = 0; |
| 176 | profiler->samples = (txProfilerSample*)c_malloc((size_t)(profiler->sampleCount * sizeof(txProfilerSample))); |
| 177 | if (profiler->samples == C_NULL) |
| 178 | fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT); |
| 179 | profiler->host = fxNewProfilerRecord(the, 0); |
| 180 | profiler->gc = fxNewProfilerRecord(the, 1); |
| 181 | } |
| 182 | |
| 183 | void fxDeleteProfiler(txMachine* the, void* stream) |
| 184 | { |
nothing calls this directly
no test coverage detected