hook up TS commands
This commit is contained in:
parent
d76670d946
commit
fe82bc8468
|
@ -850,6 +850,14 @@ int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomin
|
|||
}
|
||||
|
||||
break;
|
||||
case TS_PERF_TRACE_BEGIN:
|
||||
perfTraceEnable();
|
||||
break;
|
||||
case TS_PERF_TRACE_GET_BUFFER:
|
||||
{
|
||||
auto trace = perfTraceGetBuffer();
|
||||
sr5SendResponse(tsChannel, TS_CRC, trace.Buffer, trace.Size);
|
||||
}
|
||||
#endif /* EFI_TOOTH_LOGGER */
|
||||
default:
|
||||
tunerStudioError("ERROR: ignoring unexpected command");
|
||||
|
|
|
@ -73,6 +73,10 @@ typedef struct {
|
|||
#define TS_SET_LOGGER_MODE 'l'
|
||||
#define TS_GET_LOGGER_BUFFER 'L'
|
||||
|
||||
// Performance tracing
|
||||
#define TS_PERF_TRACE_BEGIN 'r'
|
||||
#define TS_PERF_TRACE_GET_BUFFER 'b'
|
||||
|
||||
#define TS_SINGLE_WRITE_COMMAND 'W' // 0x57 pageValueWrite
|
||||
#define TS_CHUNK_WRITE_COMMAND 'C' // 0x43 pageChunkWrite
|
||||
#define TS_BURN_COMMAND 'B' // 0x42 burnCommand
|
||||
|
|
|
@ -81,12 +81,13 @@ void perfEventInstantGlobal(PE event, uint8_t data) {
|
|||
perfEventImpl(event, EPhase::InstantGlobal, data);
|
||||
}
|
||||
|
||||
size_t perfTraceEnable() {
|
||||
void perfTraceEnable() {
|
||||
s_isTracing = true;
|
||||
|
||||
return sizeof(s_traceBuffer);
|
||||
}
|
||||
|
||||
const uint8_t* getTraceBuffer() {
|
||||
return reinterpret_cast<const uint8_t*>(s_traceBuffer);
|
||||
const TraceBufferResult perfTraceGetBuffer() {
|
||||
// stop tracing if you try to get the buffer early
|
||||
s_isTracing = false;
|
||||
|
||||
return {reinterpret_cast<const uint8_t*>(s_traceBuffer), sizeof(s_traceBuffer)};
|
||||
}
|
||||
|
|
|
@ -67,9 +67,16 @@ inline void perfEventInstantGlobal(PE event) {
|
|||
}
|
||||
|
||||
// Enable one buffer's worth of perf tracing, and retrieve the buffer size in bytes
|
||||
size_t perfTraceEnable();
|
||||
void perfTraceEnable();
|
||||
|
||||
struct TraceBufferResult
|
||||
{
|
||||
const uint8_t* const Buffer;
|
||||
const size_t Size;
|
||||
};
|
||||
|
||||
// Retrieve the trace buffer
|
||||
const uint8_t* getTraceBuffer();
|
||||
const TraceBufferResult perfTraceGetBuffer();
|
||||
|
||||
class ScopePerf
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue