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:
Erik Tamlin 2022-11-03 21:58:38 +01:00 committed by GitHub
parent aa316fc1b4
commit c568ba8c44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
143 changed files with 23823 additions and 16781 deletions

View file

@ -58,6 +58,7 @@
#include <signal.h>
#include <errno.h>
#include <sys/select.h>
#include <time.h>
/* FreeRTOS kernel includes. */
#include "FreeRTOS.h"
@ -66,6 +67,10 @@
/* Local includes. */
#include "console.h"
#if ( projCOVERAGE_TEST != 1 )
#include <trcRecorder.h>
#endif
#define BLINKY_DEMO 0
#define FULL_DEMO 1
@ -140,6 +145,9 @@ StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
static BaseType_t xTraceRunning = pdTRUE;
#endif
static clockid_t cid = CLOCK_THREAD_CPUTIME_ID;
static uint32_t frequency;
/*-----------------------------------------------------------*/
int main( void )
@ -161,7 +169,6 @@ int main( void )
#if ( TRACE_ON_ENTER == 1 )
printf( "\r\nThe trace will be dumped to disk if Enter is hit.\r\n" );
#endif
uiTraceStart();
}
#endif /* if ( projCOVERAGE_TEST != 1 ) */
@ -352,6 +359,7 @@ static void prvSaveTraceFile( void )
#if ( projCOVERAGE_TEST != 1 )
{
FILE * pxOutputFile;
extern RecorderDataType* RecorderDataPtr;
vTraceStop();
@ -437,3 +445,58 @@ void handle_sigint( int signal )
exit( 2 );
}
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;
}