mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-17 02:07:48 -04:00
Percepio Trace Recorder v4.6.0 (#789)
* * Percepio Trace Recorder v4.6.0 * Add space between inclusion of header and comment * Fix broken posix build - part 1 * Add percepio timer implementation * Remove delted trace recorder header file * Fix Networking demo build * Fix CLI demo * Fix visual studio version number * Fix core header check * Fix more core checks * Fix last of core checks Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Co-authored-by: Alfred Gedeon <alfred2g@hotmail.com>
This commit is contained in:
parent
aa316fc1b4
commit
c568ba8c44
143 changed files with 23823 additions and 16781 deletions
|
@ -51,6 +51,8 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* FreeRTOS kernel includes. */
|
||||
#include "FreeRTOS.h"
|
||||
|
@ -59,6 +61,8 @@
|
|||
/* Local includes. */
|
||||
#include "console.h"
|
||||
|
||||
#include <trcRecorder.h>
|
||||
|
||||
#define ECHO_CLIENT_DEMO 0
|
||||
|
||||
#define mainSELECTED_APPLICATION ECHO_CLIENT_DEMO
|
||||
|
@ -103,6 +107,10 @@ StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
|
|||
/* Notes if the trace is running or not. */
|
||||
static BaseType_t xTraceRunning = pdTRUE;
|
||||
|
||||
static clockid_t cid = CLOCK_THREAD_CPUTIME_ID;
|
||||
|
||||
static uint32_t frequency;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
|
@ -118,7 +126,7 @@ int main( void )
|
|||
configASSERT() is called. */
|
||||
printf( "\r\nTrace started.\r\nThe trace will be dumped to disk if a call to configASSERT() fails.\r\n" );
|
||||
printf( "\r\nThe trace will be dumped to disk if Enter is hit.\r\n" );
|
||||
uiTraceStart();
|
||||
traceSTART();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -284,6 +292,7 @@ static void prvSaveTraceFile( void )
|
|||
#if ( projCOVERAGE_TEST != 1 )
|
||||
{
|
||||
FILE * pxOutputFile;
|
||||
extern RecorderDataType * RecorderDataPtr;
|
||||
|
||||
vTraceStop();
|
||||
|
||||
|
@ -355,3 +364,57 @@ the stack and so not exists after this function exits. */
|
|||
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||
}
|
||||
|
||||
void vTraceTimerReset( void )
|
||||
{
|
||||
int xRet;
|
||||
struct timespec ts;
|
||||
ts.tv_sec = 0;
|
||||
ts.tv_nsec = 0;
|
||||
|
||||
xRet = clock_settime( cid, &ts );
|
||||
if( xRet != 0 )
|
||||
{
|
||||
printf( "Could not reset time: %s\n", strerror( errno ) );
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t uiTraceTimerGetFrequency( void )
|
||||
{
|
||||
struct timespec res;
|
||||
int xRet;
|
||||
|
||||
res.tv_nsec = 0;
|
||||
res.tv_sec = 0;
|
||||
|
||||
xRet = clock_getres( cid, &res );
|
||||
if( xRet == 0 )
|
||||
{
|
||||
// calculate frequency from timer definition
|
||||
frequency = (uint64_t) 1000000000 / res.tv_nsec;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "Could not get clock frequency: %s\n", strerror( errno ) );
|
||||
}
|
||||
return frequency;
|
||||
}
|
||||
|
||||
uint32_t uiTraceTimerGetValue( void )
|
||||
{
|
||||
int xRet;
|
||||
struct timespec tp;
|
||||
uint32_t result = 0;
|
||||
|
||||
xRet = clock_gettime( cid, &tp );
|
||||
if( xRet == 0 )
|
||||
{
|
||||
result = tp.tv_nsec / frequency;
|
||||
result += (tp.tv_sec * 1000000000) / frequency;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "Could not get time: %s\n", strerror( errno ) );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue