update system call measurement test program related files. (#49)
Reviewed-on: http://13.234.246.121:3000/Neominds/ossl35vx69/pulls/49 Co-authored-by: siddhant <siddhant.singh@neominds.in> Co-committed-by: siddhant <siddhant.singh@neominds.in>
This commit is contained in:
@@ -33,7 +33,8 @@ void displayStats();
|
|||||||
void clearSysTableData();
|
void clearSysTableData();
|
||||||
void sysCallMeasurementTask();
|
void sysCallMeasurementTask();
|
||||||
void CaptureSysCallMetrics();
|
void CaptureSysCallMetrics();
|
||||||
int measurementFlag;
|
extern void sysCallMsrSetData (int flag, TASK_ID tID);
|
||||||
|
extern void sysCallMsrGetData (int* flag, TASK_ID* tID);
|
||||||
TASK_ID sysCallTaskID;
|
TASK_ID sysCallTaskID;
|
||||||
static SEM_ID sysCallSemID;
|
static SEM_ID sysCallSemID;
|
||||||
UINT32 tsFreq;
|
UINT32 tsFreq;
|
||||||
|
|||||||
@@ -14,11 +14,10 @@ void clearSysTableData()
|
|||||||
|
|
||||||
void sysCallMeasurementTask(const char* cmd, const char* arg)
|
void sysCallMeasurementTask(const char* cmd, const char* arg)
|
||||||
{
|
{
|
||||||
measurementFlag = 1;
|
sysCallMsrSetData (1, sysCallTaskID);
|
||||||
shellCmdExec (cmd, arg);
|
shellCmdExec (cmd, arg);
|
||||||
measurementFlag=0;
|
|
||||||
semBGive(sysCallSemID);
|
semBGive(sysCallSemID);
|
||||||
measurementFlag = 0;
|
sysCallMsrSetData (0, 0);
|
||||||
displayStats();
|
displayStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,10 +56,10 @@ void displayStats()
|
|||||||
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);
|
printf("%-15s %-15s %-15d %-20lu\n","enc","open",API_STATS[openCall].sysCallCount,((API_STATS[openCall].execTimeUsec)*1000000ULL)/tsFreq);
|
||||||
printf("%-15s %-15s %-15d %-20lu\n","enc","close",API_STATS[closeCall].sysCallCount,API_STATS[closeCall].execTimeUsec);
|
printf("%-15s %-15s %-15d %-20lu\n","enc","close",API_STATS[closeCall].sysCallCount,((API_STATS[closeCall].execTimeUsec)*1000000ULL)/tsFreq);
|
||||||
printf("%-15s %-15s %-15d %-20lu\n","enc","read",API_STATS[readCall].sysCallCount,API_STATS[readCall].execTimeUsec );
|
printf("%-15s %-15s %-15d %-20lu\n","enc","read",API_STATS[readCall].sysCallCount,((API_STATS[readCall].execTimeUsec)*1000000ULL)/tsFreq );
|
||||||
printf("%-15s %-15s %-15d %-20lu\n","enc","write",API_STATS[writeCall].sysCallCount,API_STATS[writeCall].execTimeUsec);
|
printf("%-15s %-15s %-15d %-20lu\n","enc","write",API_STATS[writeCall].sysCallCount,((API_STATS[writeCall].execTimeUsec)*1000000ULL)/tsFreq);
|
||||||
printf("-------------------------------------------------------------------\n");
|
printf("-------------------------------------------------------------------\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -324,12 +324,9 @@ 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
|
||||||
extern int measurementFlag;
|
|
||||||
extern TASK_ID sysCallTaskID;
|
|
||||||
extern UINT32 tsFreq;
|
|
||||||
|
|
||||||
enum kernelAPI
|
enum kernelAPI
|
||||||
{
|
{
|
||||||
@@ -346,6 +343,46 @@ typedef struct
|
|||||||
unsigned long int execTimeUsec;
|
unsigned long int execTimeUsec;
|
||||||
}KRNL_API_STATS;
|
}KRNL_API_STATS;
|
||||||
KRNL_API_STATS API_STATS[sysCallMax];
|
KRNL_API_STATS API_STATS[sysCallMax];
|
||||||
|
|
||||||
|
int measurementFlag;
|
||||||
|
TASK_ID sysCallTaskID;
|
||||||
|
|
||||||
|
void sysCallMsrGetData (int* flag, TASK_ID* tID);
|
||||||
|
void sysCallMsrSetData (int flag, TASK_ID tID);
|
||||||
|
|
||||||
|
void sysCallMsrStart(UINT32* startTick, int sysCallIdx)
|
||||||
|
{
|
||||||
|
sysTimestampEnable();
|
||||||
|
if ((measurementFlag && (sysCallTaskID == taskIdSelf())))
|
||||||
|
{
|
||||||
|
*startTick = sysTimestamp();
|
||||||
|
API_STATS[sysCallIdx].sysCallCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sysCallMsrEnd(UINT32* startTick, UINT32* endTick, int sysCallIdx)
|
||||||
|
{
|
||||||
|
if ((measurementFlag && (sysCallTaskID == taskIdSelf())))
|
||||||
|
{
|
||||||
|
*endTick = sysTimestamp();
|
||||||
|
UINT32 diffTick = *endTick - *startTick;
|
||||||
|
API_STATS[sysCallIdx].execTimeUsec += diffTick;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sysCallMsrSetData (int flag, TASK_ID tID)
|
||||||
|
{
|
||||||
|
measurementFlag = flag;
|
||||||
|
sysCallTaskID = tID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void sysCallMsrGetData (int* flag, TASK_ID* tID)
|
||||||
|
{
|
||||||
|
*flag = measurementFlag;
|
||||||
|
*tID = sysCallTaskID;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* this tells core I/O if the system is configured for PSE52 */
|
/* this tells core I/O if the system is configured for PSE52 */
|
||||||
@@ -618,30 +655,15 @@ int open
|
|||||||
int mode /* mode of file to create (UNIX chmod style) */
|
int mode /* mode of file to create (UNIX chmod style) */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifdef MEASURE_SYS_CALLS
|
#ifdef MEASURE_SYS_CALLS
|
||||||
sysTimestampEnable();
|
UINT32 startTick=0, endTick=0;
|
||||||
UINT32 startTick = 0, endTick = 0, diffTick = 0;
|
sysCallMsrStart(&startTick, openCall);
|
||||||
UINT64 timeUs = 0;
|
|
||||||
UINT32 freq = tsFreq;
|
|
||||||
char toMeasure = (measurementFlag && (sysCallTaskID == taskIdSelf()));
|
|
||||||
|
|
||||||
if (toMeasure)
|
|
||||||
{
|
|
||||||
startTick = sysTimestamp();
|
|
||||||
(API_STATS[openCall].sysCallCount)++;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int result = ioCreateOrOpen(name, flags, mode, FALSE);
|
int result = ioCreateOrOpen(name, flags, mode, FALSE);
|
||||||
|
|
||||||
#ifdef MEASURE_SYS_CALLS
|
#ifdef MEASURE_SYS_CALLS
|
||||||
if (toMeasure)
|
sysCallMsrEnd(&startTick, &endTick, openCall);
|
||||||
{
|
|
||||||
endTick = sysTimestamp();
|
|
||||||
diffTick = endTick - startTick;
|
|
||||||
timeUs = ((UINT64)diffTick * 1000000ULL) / freq;
|
|
||||||
(API_STATS[openCall].execTimeUsec)+=timeUs;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -1066,17 +1088,8 @@ int close
|
|||||||
int krnPthreadCnclType; /* temp kernel canceltype saved value */
|
int krnPthreadCnclType; /* temp kernel canceltype saved value */
|
||||||
|
|
||||||
#ifdef MEASURE_SYS_CALLS
|
#ifdef MEASURE_SYS_CALLS
|
||||||
sysTimestampEnable();
|
UINT32 startTick=0, endTick=0;
|
||||||
UINT32 startTick = 0, endTick = 0, diffTick = 0;
|
sysCallMsrStart(&startTick, closeCall);
|
||||||
UINT64 timeUs = 0;
|
|
||||||
UINT32 freq = tsFreq;
|
|
||||||
char toMeasure = (measurementFlag && (sysCallTaskID == taskIdSelf()));
|
|
||||||
|
|
||||||
if (toMeasure)
|
|
||||||
{
|
|
||||||
startTick = sysTimestamp();
|
|
||||||
(API_STATS[closeCall].sysCallCount)++;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_func_pthread_testandset_canceltype != NULL)
|
if (_func_pthread_testandset_canceltype != NULL)
|
||||||
@@ -1089,13 +1102,7 @@ int close
|
|||||||
_func_pthread_testandset_canceltype (krnPthreadCnclType, NULL);
|
_func_pthread_testandset_canceltype (krnPthreadCnclType, NULL);
|
||||||
|
|
||||||
#ifdef MEASURE_SYS_CALLS
|
#ifdef MEASURE_SYS_CALLS
|
||||||
if (toMeasure)
|
sysCallMsrEnd(&startTick, &endTick, closeCall);
|
||||||
{
|
|
||||||
endTick = sysTimestamp();
|
|
||||||
diffTick = endTick - startTick;
|
|
||||||
timeUs = ((UINT64)diffTick * 1000000ULL) / freq;
|
|
||||||
(API_STATS[closeCall].execTimeUsec)+=timeUs;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
@@ -1177,29 +1184,14 @@ ssize_t read
|
|||||||
|
|
||||||
ssize_t result;
|
ssize_t result;
|
||||||
#ifdef MEASURE_SYS_CALLS
|
#ifdef MEASURE_SYS_CALLS
|
||||||
sysTimestampEnable();
|
UINT32 startTick=0, endTick=0;
|
||||||
UINT32 startTick = 0, endTick = 0, diffTick = 0;
|
sysCallMsrStart(&startTick, readCall);
|
||||||
UINT64 timeUs = 0;
|
|
||||||
UINT32 freq = tsFreq;
|
|
||||||
char toMeasure = (measurementFlag && (sysCallTaskID == taskIdSelf()));
|
|
||||||
|
|
||||||
if (toMeasure)
|
|
||||||
{
|
|
||||||
startTick = sysTimestamp();
|
|
||||||
(API_STATS[readCall].sysCallCount)++;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
result=(ioReadWrite (iosRead, fd, buffer, maxBytes));
|
result=(ioReadWrite (iosRead, fd, buffer, maxBytes));
|
||||||
|
|
||||||
#ifdef MEASURE_SYS_CALLS
|
#ifdef MEASURE_SYS_CALLS
|
||||||
if (toMeasure)
|
sysCallMsrEnd(&startTick, &endTick, readCall);
|
||||||
{
|
|
||||||
endTick = sysTimestamp();
|
|
||||||
diffTick = endTick - startTick;
|
|
||||||
timeUs = ((UINT64)diffTick * 1000000ULL) / freq;
|
|
||||||
(API_STATS[readCall].execTimeUsec)+=timeUs;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1241,28 +1233,13 @@ ssize_t write
|
|||||||
{
|
{
|
||||||
ssize_t result;
|
ssize_t result;
|
||||||
#ifdef MEASURE_SYS_CALLS
|
#ifdef MEASURE_SYS_CALLS
|
||||||
sysTimestampEnable();
|
UINT32 startTick=0, endTick=0;
|
||||||
UINT32 startTick = 0, endTick = 0, diffTick = 0;
|
sysCallMsrStart(&startTick, writeCall);
|
||||||
UINT64 timeUs = 0;
|
|
||||||
UINT32 freq = tsFreq;
|
|
||||||
char toMeasure = (measurementFlag && (sysCallTaskID == taskIdSelf()));
|
|
||||||
|
|
||||||
if (toMeasure)
|
|
||||||
{
|
|
||||||
startTick = sysTimestamp();
|
|
||||||
(API_STATS[writeCall].sysCallCount)++;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
result=(ioReadWrite (iosWrite, fd, buffer, nBytes));
|
result=(ioReadWrite (iosWrite, fd, buffer, nBytes));
|
||||||
|
|
||||||
#ifdef MEASURE_SYS_CALLS
|
#ifdef MEASURE_SYS_CALLS
|
||||||
if (toMeasure)
|
sysCallMsrEnd(&startTick, &endTick, writeCall);
|
||||||
{
|
|
||||||
endTick = sysTimestamp();
|
|
||||||
diffTick = endTick - startTick;
|
|
||||||
timeUs = ((UINT64)diffTick * 1000000ULL) / freq;
|
|
||||||
(API_STATS[writeCall].execTimeUsec)+=timeUs;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user