Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions benchmark/config/wolfhsm_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
#ifndef WOLFHSM_CFG_H_
#define WOLFHSM_CFG_H_

#include "port/posix/posix_time.h"

#define WOLFHSM_CFG_PORT_GETTIME posixGetTime

#define WOLFHSM_CFG_ENABLE_CLIENT
#define WOLFHSM_CFG_ENABLE_SERVER

Expand Down
21 changes: 1 addition & 20 deletions benchmark/wh_bench_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
#include <stdint.h>
#include <string.h> /* For memset, memcpy */

#if defined(WOLFHSM_CFG_TEST_POSIX)
#include <sys/time.h> /* For gettimeofday and struct timeval */
#endif

#include "wolfhsm/wh_settings.h"
#include "wolfhsm/wh_error.h"
#include "wh_bench_ops.h"
Expand All @@ -47,22 +43,7 @@ static uint64_t _benchGetTimeUsDefault(void);
/* Default implementation for getting current time in microseconds */
static uint64_t _benchGetTimeUsDefault(void)
{
uint64_t timeUs = 0;

#if defined(WOLFHSM_CFG_TEST_POSIX)
struct timeval tv;
gettimeofday(&tv, NULL);
timeUs = (uint64_t)tv.tv_sec * 1000000 + (uint64_t)tv.tv_usec;
#else
/* Default implementation - should be overridden for actual platform */
/* This is just a placeholder that returns a monotonically increasing value
*/
static uint64_t fakeTime = 0;
fakeTime += 1000; /* Increment by a fake 1ms each call */
timeUs = fakeTime;
#endif

return timeUs;
return WH_GETTIME_US();
}
#endif /* !(WOLFHSM_CFG_BENCH_CUSTOM_TIME_FUNC) */

Expand Down
4 changes: 4 additions & 0 deletions examples/posix/wh_posix_client/wolfhsm_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
#ifndef WOLFHSM_CFG_H_
#define WOLFHSM_CFG_H_

#include "port/posix/posix_time.h"

#define WOLFHSM_CFG_PORT_GETTIME posixGetTime

/** wolfHSM settings */
#define WOLFHSM_CFG_ENABLE_CLIENT
#define WOLFHSM_CFG_HEXDUMP
Expand Down
4 changes: 4 additions & 0 deletions examples/posix/wh_posix_server/wolfhsm_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
#ifndef WOLFHSM_CFG_H_
#define WOLFHSM_CFG_H_

#include "port/posix/posix_time.h"

#define WOLFHSM_CFG_PORT_GETTIME posixGetTime

/** wolfHSM settings. Simple overrides to show they work */
#define WOLFHSM_CFG_ENABLE_SERVER

Expand Down
Loading
Loading