update sysCall test program and disable MEASURE_SYS_CALLS in ioLib.c (#51)

Reviewed-on: http://13.234.246.121:3000/Neominds/ossl35vx69/pulls/51
Co-authored-by: siddhant <siddhant.singh@neominds.in>
Co-committed-by: siddhant <siddhant.singh@neominds.in>
This commit is contained in:
2026-07-30 20:15:19 +05:30
committed by neelimap
parent 298f09c6b7
commit bc8f6ced74
3 changed files with 34 additions and 10 deletions
@@ -1,6 +1,11 @@
#ifndef SYS_CALL_STAT #ifndef SYS_CALL_STAT
#define SYS_CALL_STAT #define SYS_CALL_STAT
/*
uncomment the line below to measure open, close, read,write system calls for 'enc' command.
*/
/*#define MEASURE_SYS_CALLS*/
#ifdef MEASURE_SYS_CALLS
#include <vxWorks.h> #include <vxWorks.h>
#include <sys/fcntlcom.h> #include <sys/fcntlcom.h>
#include <semLibCommon.h> #include <semLibCommon.h>
@@ -39,3 +44,4 @@ TASK_ID sysCallTaskID;
static SEM_ID sysCallSemID; static SEM_ID sysCallSemID;
UINT32 tsFreq; UINT32 tsFreq;
#endif #endif
#endif
+23 -5
View File
@@ -1,4 +1,5 @@
#include "sysCallStat.h" #include "sysCallStat.h"
#ifdef MEASURE_SYS_CALLS
extern KRNL_API_STATS API_STATS[sysCallMax]; extern KRNL_API_STATS API_STATS[sysCallMax];
/* "enc", "-pbkdf2 -aes-256-cbc -in plain.txt -out cipher.enc -kfile keyfile.key" */ /* "enc", "-pbkdf2 -aes-256-cbc -in plain.txt -out cipher.enc -kfile keyfile.key" */
void clearSysTableData() void clearSysTableData()
@@ -51,16 +52,33 @@ void CaptureSysCallMetrics(const char* cmd, const char* arg)
semDelete(sysCallSemID); semDelete(sysCallSemID);
} }
void displayStats() void displayStats()
{ {
UINT64 openTimeUsec = 0;
UINT64 closeTimeUsec = 0;
UINT64 readTimeUsec = 0;
UINT64 writeTimeUsec = 0;
if (tsFreq == 0)
{
printf("ERROR: tsFreq is zero\n");
return;
}
openTimeUsec = (API_STATS[openCall].execTimeUsec * 1000000ULL) / (UINT64)tsFreq;
closeTimeUsec = (API_STATS[closeCall].execTimeUsec * 1000000ULL) / (UINT64)tsFreq;
readTimeUsec = (API_STATS[readCall].execTimeUsec * 1000000ULL) / (UINT64)tsFreq;
writeTimeUsec = (API_STATS[writeCall].execTimeUsec * 1000000ULL) / (UINT64)tsFreq;
printf("------------------------------------------------------------------\n"); printf("------------------------------------------------------------------\n");
printf("%-15s %-15s %-15s %-20s\n","crypto cmd","system call","Invocations","Total time (USec)"); printf("%-15s %-15s %-15s %-20s\n","crypto cmd","system call","Invocations","Total time (USec)");
printf("------------------------------------------------------------------\n"); printf("------------------------------------------------------------------\n");
printf("%-15s %-15s %-15d %-20lu\n","enc","open",API_STATS[openCall].sysCallCount,((API_STATS[openCall].execTimeUsec)*1000000ULL)/tsFreq); printf("%-15s %-15s %-15u %-20llu\n","enc","open",API_STATS[openCall].sysCallCount,openTimeUsec);
printf("%-15s %-15s %-15d %-20lu\n","enc","close",API_STATS[closeCall].sysCallCount,((API_STATS[closeCall].execTimeUsec)*1000000ULL)/tsFreq); printf("%-15s %-15s %-15u %-20llu\n","enc","close",API_STATS[closeCall].sysCallCount,closeTimeUsec);
printf("%-15s %-15s %-15d %-20lu\n","enc","read",API_STATS[readCall].sysCallCount,((API_STATS[readCall].execTimeUsec)*1000000ULL)/tsFreq ); printf("%-15s %-15s %-15u %-20llu\n","enc","read",API_STATS[readCall].sysCallCount,readTimeUsec);
printf("%-15s %-15s %-15d %-20lu\n","enc","write",API_STATS[writeCall].sysCallCount,((API_STATS[writeCall].execTimeUsec)*1000000ULL)/tsFreq); printf("%-15s %-15s %-15u %-20llu\n","enc","write",API_STATS[writeCall].sysCallCount,writeTimeUsec);
printf("-------------------------------------------------------------------\n"); printf("------------------------------------------------------------------\n");
} }
#endif
+1 -1
View File
@@ -324,7 +324,7 @@ the VxWorks programmer guides.
* uncomment the line below to measure open, close, read * uncomment the line below to measure open, close, read
* and write system calls for 'enc' command. * and write system calls for 'enc' command.
*/ */
#define MEASURE_SYS_CALLS /* #define MEASURE_SYS_CALLS */
#ifdef MEASURE_SYS_CALLS #ifdef MEASURE_SYS_CALLS