s (#1023)
This commit is contained in:
parent
9597215ad9
commit
1ad5b55dbb
|
@ -487,7 +487,9 @@ static bool isKnownCommand(char command) {
|
||||||
|| command == TS_GET_LOGGER_BUFFER
|
|| command == TS_GET_LOGGER_BUFFER
|
||||||
|| command == TS_GET_TEXT
|
|| command == TS_GET_TEXT
|
||||||
|| command == TS_CRC_CHECK_COMMAND
|
|| command == TS_CRC_CHECK_COMMAND
|
||||||
|| command == TS_GET_FIRMWARE_VERSION;
|
|| command == TS_GET_FIRMWARE_VERSION
|
||||||
|
|| command == TS_PERF_TRACE_BEGIN
|
||||||
|
|| command == TS_PERF_TRACE_GET_BUFFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function runs indefinitely
|
// this function runs indefinitely
|
||||||
|
@ -855,6 +857,8 @@ int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomin
|
||||||
case TS_PERF_TRACE_BEGIN:
|
case TS_PERF_TRACE_BEGIN:
|
||||||
#if ENABLE_PERF_TRACE
|
#if ENABLE_PERF_TRACE
|
||||||
perfTraceEnable();
|
perfTraceEnable();
|
||||||
|
sendOkResponse(tsChannel, TS_CRC);
|
||||||
|
|
||||||
#endif /* ENABLE_PERF_TRACE */
|
#endif /* ENABLE_PERF_TRACE */
|
||||||
break;
|
break;
|
||||||
case TS_PERF_TRACE_GET_BUFFER:
|
case TS_PERF_TRACE_GET_BUFFER:
|
||||||
|
|
|
@ -47,13 +47,19 @@ void perfEventImpl(PE event, EPhase phase, uint8_t data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t timestamp = getTimeNowLowerNt();
|
// todo: why doesn't getTimeNowLowerNt() work here?
|
||||||
|
// It returns 0 like we're in a unit test
|
||||||
|
uint32_t timestamp = port_rt_get_counter_value();
|
||||||
|
|
||||||
size_t idx;
|
size_t idx;
|
||||||
|
|
||||||
// Critical section: reserve index under lock
|
// Critical section: disable interrupts to reserve an index.
|
||||||
|
// We could lock, but this gets called a LOT - so locks could
|
||||||
|
// significantly alter the results of the measurement.
|
||||||
|
// In addition, if we want to trace lock/unlock events, we can't
|
||||||
|
// be locking ourselves from the trace functionality.
|
||||||
{
|
{
|
||||||
bool wasLocked = lockAnyContext();
|
__disable_irq();
|
||||||
|
|
||||||
idx = s_nextIdx++;
|
idx = s_nextIdx++;
|
||||||
if (s_nextIdx >= TRACE_BUFFER_LENGTH) {
|
if (s_nextIdx >= TRACE_BUFFER_LENGTH) {
|
||||||
|
@ -61,9 +67,7 @@ void perfEventImpl(PE event, EPhase phase, uint8_t data)
|
||||||
s_isTracing = false;
|
s_isTracing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wasLocked) {
|
__enable_irq();
|
||||||
unlockAnyContext();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We can safely write data out of the lock, our spot is reserved
|
// We can safely write data out of the lock, our spot is reserved
|
||||||
|
|
Loading…
Reference in New Issue