| 3141 | } |
| 3142 | |
| 3143 | void fxSampleInstrumentation(txMachine* the, txInteger count, txInteger* values) |
| 3144 | { |
| 3145 | txInteger xsInstrumentValues[xsInstrumentCount]; |
| 3146 | xsInstrumentValues[0] = the->currentChunksSize; |
| 3147 | xsInstrumentValues[1] = the->maximumChunksSize; |
| 3148 | xsInstrumentValues[2] = the->currentHeapCount * sizeof(txSlot); |
| 3149 | xsInstrumentValues[3] = the->maximumHeapCount * sizeof(txSlot); |
| 3150 | xsInstrumentValues[4] = (mxPtrDiff(the->stackTop - the->stackPeak)) * sizeof(txSlot); |
| 3151 | xsInstrumentValues[5] = (mxPtrDiff(the->stackTop - the->stackBottom)) * sizeof(txSlot); |
| 3152 | xsInstrumentValues[6] = the->garbageCollectionCount; |
| 3153 | xsInstrumentValues[7] = the->keyIndex - the->keyOffset - the->keyholeCount; |
| 3154 | xsInstrumentValues[8] = the->loadedModulesCount; |
| 3155 | xsInstrumentValues[9] = the->peakParserSize; |
| 3156 | xsInstrumentValues[10] = the->floatingPointOps; |
| 3157 | xsInstrumentValues[11] = the->promisesSettledCount; |
| 3158 | |
| 3159 | txInteger i, j = 0; |
| 3160 | #ifdef mxDebug |
| 3161 | if (fxIsConnected(the)) { |
| 3162 | fxEchoStart(the); |
| 3163 | fxEcho(the, "<samples>"); |
| 3164 | for (i = 0; i < count; i++, j++) { |
| 3165 | if (j) |
| 3166 | fxEcho(the, ","); |
| 3167 | fxEchoInteger(the, values[i]); |
| 3168 | } |
| 3169 | for (i = 0; i < xsInstrumentCount; i++, j++) { |
| 3170 | if (j) |
| 3171 | fxEcho(the, ","); |
| 3172 | fxEchoInteger(the, xsInstrumentValues[i]); |
| 3173 | } |
| 3174 | fxEcho(the, "</samples>"); |
| 3175 | fxEchoStop(the); |
| 3176 | return; |
| 3177 | } |
| 3178 | #endif |
| 3179 | #ifndef mxNoConsole |
| 3180 | j = 0; |
| 3181 | c_printf("instruments: "); |
| 3182 | for (i = 0; i < count; i++, j++) { |
| 3183 | if (j) |
| 3184 | c_printf(","); |
| 3185 | c_printf("%d", (int)values[i]); |
| 3186 | } |
| 3187 | for (i = 0; i < xsInstrumentCount; i++, j++) { |
| 3188 | if (j) |
| 3189 | c_printf(","); |
| 3190 | c_printf("%d", (int)xsInstrumentValues[i]); |
| 3191 | } |
| 3192 | c_printf("\n"); |
| 3193 | #elif pebble |
| 3194 | j = 0; |
| 3195 | modLog_transmit("instruments: "); |
| 3196 | for (i = 0; i < count; i++, j++) { |
| 3197 | if (j) |
| 3198 | modLog_transmit(","); |
| 3199 | char tmp[10]; |
| 3200 | fxIntegerToString(the, (int)values[i], tmp, sizeof(tmp)); |
no test coverage detected