Skip to content

benchmark: remove cycle counter #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 3 additions & 23 deletions benchmark/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,25 +179,12 @@
mbedtls_printf( "FAILED: -0x%04x\r\n", -ret );
#endif

static unsigned long mbedtls_timing_hardclock( void )
{
static int dwt_started = 0;

if( dwt_started == 0 )
{
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
}

return( DWT->CYCCNT );
}

static volatile int alarmed;
static void alarm() { alarmed = 1; }

#define TIME_AND_TSC( TITLE, CODE ) \
do { \
unsigned long i, j, tsc; \
unsigned long i; \
Timeout t; \
\
mbedtls_printf( HEADER_FORMAT, TITLE ); \
Expand All @@ -207,15 +194,8 @@ do { \
CODE; \
} \
\
tsc = mbedtls_timing_hardclock(); \
for( j = 0; j < 1024; j++ ) \
{ \
CODE; \
} \
\
mbedtls_printf( "%9lu KB/s, %9lu cycles/byte\r\n", \
i * BUFSIZE / 1024, \
( mbedtls_timing_hardclock() - tsc ) / ( j * BUFSIZE ) ); \
mbedtls_printf( "%9lu KB/s\r\n", \
i * BUFSIZE / 1024 ); \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are changing prints we should also update examples log file for CI to pass https://github.com/ARMmbed/mbed-os-example-tls/blob/master/tests/benchmark.log

} while( 0 )

#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && defined(MBEDTLS_MEMORY_DEBUG)
Expand Down