123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056 |
- #include <stdio.h> /* fopen, printf, fprintf, fclose */
- #include <string.h> /* strcpy, strcmp */
- #include <stdlib.h> /* exit, atol, atoi */
- #include <sys/time.h> /* setitimer, settimeofday, gettimeofday */
- #include <time.h> /* time */
- #include <signal.h> /* signal */
- #include <sched.h> /* sched_setscheduler, sched_get_priority_min,*/
- #include <unistd.h> /* gettimeofday, sleep */
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <sys/mman.h>
- #define PROGRAM_NAME "JitterTest"
- #include "common.h"
- enum timerActions
- {
- ONESHOT,
- AUTORESETTING
- };
- #define EXIT_FILE_OPEN_ERR (1)
- #define EXIT_REG_SIGALRM_ERR (2)
- #define EXIT_REG_SIGINT_ERR (3)
- #define EXIT_INV_INT_PERIOD (4)
- #define EXIT_MIN_PRIORITY_ERR (5)
- #define EXIT_MAX_PRIORITY_ERR (6)
- #define EXIT_INV_SCHED_PRIORITY (7)
- #define EXIT_SET_SCHEDULER_ERR (8)
- #define EXIT_PREV_TIME_OF_DAY_ERR (9)
- #define MAX_FILE_NAME_LEN (32)
- #define STRINGS_EQUAL ((int) 0)
- #define MIN_INT_PERIOD_MILLISEC ( 5L)
- #define MAX_INT_PERIOD_MILLISEC (5000L)
- #define DEF_INT_PERIOD_MILLISEC ( 10L)
- #define READ_FILE_MESSAGE "This is a junk file. Must contain at least 1 byte though!\n"
- #define MIN_WRITE_BYTES 30
- #define DEFAULT_WRITE_BYTES 30
- #define MAX_WRITE_BYTES 4096
- #define MIN_ASCII 32
- #define MAX_ASCII 126.0
- #if (DEF_INT_PERIOD_MILLISEC < MIN_INT_PERIOD_MILLISEC)
- #error *** Invalid default interrupt period. ***
- #endif
- #if (DEF_INT_PERIOD_MILLISEC > MAX_INT_PERIOD_MILLISEC)
- #error *** Invalid default interrupt period. ***
- #endif
- #define TRUE 1
- #define FALSE 0
- #define MILLISEC_PER_SEC (1000L)
- #define MICROSEC_PER_MILLISEC (1000L)
- #define MICROSEC_PER_SEC (1000000L)
- #define PRIORITY_POLICY ((int) SCHED_RR)
- static char OutFileName[MAX_FILE_NAME_LEN+1];
- static char LogFile[MAX_FILE_NAME_LEN+1] = "/dev/console";
- static char ReadFile[MAX_FILE_NAME_LEN+1];
- static int WriteBytes = DEFAULT_WRITE_BYTES;
- static int Fd1;
- static int Cfd;
- static int Fd2;
- static int DoRead = FALSE;
- static long InterruptPeriodMilliSec;
- static int MinPriority;
- static int MaxPriority;
- static int RequestedPriority;
- static struct itimerval ITimer;
- static struct timeval PrevTimeVal;
- static struct timeval CurrTimeVal;
- static long LastMaxDiff = 0;
- static int GrabKProfile = FALSE;
- static long ProfileTriggerMSecs = 15000l;
- static int SignalGCTask = FALSE;
- static int GCTaskPID;
- static int RunAsRTTask = FALSE;
- void HandleCmdLineArgs(int argc, char *argv[]);
- void SetFileName(char * pFileName);
- void SetInterruptPeriod(char * pASCIIInterruptPeriodMilliSec);
- void SetSchedulerPriority(char * pASCIISchedulerPriority);
- void PrintVersionInfo(void);
- void PrintHelpInfo(void);
- int Write(int fd, void *buf, size_t bytes, int lineNo);
- void InitITimer(struct itimerval * pITimer, int action);
- void AlarmHandler(int sigNum);
- void SignalHandler(int sigNum);
- int main(
- int argc,
- char *argv[])
- {
- struct sched_param schedParam;
- int mypri;
- char tmpBuf[200];
- strcpy(OutFileName,"jitter.dat");
- InterruptPeriodMilliSec = MIN_INT_PERIOD_MILLISEC;
-
- MinPriority = sched_get_priority_min(PRIORITY_POLICY);
- MaxPriority = sched_get_priority_max(PRIORITY_POLICY);
- if (MinPriority == -1) {
- printf("\n*** Unable to get minimum priority. ***\n");
- exit(EXIT_MIN_PRIORITY_ERR);
- }
- if (MaxPriority == -1) {
- printf("\n*** Unable to get maximum priority. ***\n");
- exit(EXIT_MAX_PRIORITY_ERR);
- }
-
- RequestedPriority = MinPriority;
- HandleCmdLineArgs(argc, argv);
- if(mlockall(MCL_CURRENT|MCL_FUTURE) < 0){
- printf("Could not lock task into memory. Bye\n");
- perror("Error");
- }
- if(RunAsRTTask){
-
- schedParam.sched_priority = RequestedPriority;
- if (sched_setscheduler(
- 0,
- PRIORITY_POLICY,
- &schedParam) != (int) 0) {
- printf("Exiting: Unsuccessful sched_setscheduler.\n");
- close(Fd1);
- exit(EXIT_SET_SCHEDULER_ERR);
- }
-
- if((mypri = sched_getscheduler(0)) != RequestedPriority)
- {
- printf("Not running with request priority %i. running with priority %i instead!\n",
- RequestedPriority, mypri);
- }else
- {
- printf("Running with %i priority. Good!\n", mypri);
- }
- }
-
- if((Fd1 = open(OutFileName, O_RDWR|O_CREAT|O_SYNC, S_IRWXU)) <= 0)
- {
- perror("Cannot open outfile for write:");
- exit(1);
- }
-
- if(DoRead)
- {
- if((Fd2 = open(ReadFile, O_RDWR|O_CREAT|O_SYNC|O_TRUNC, S_IRWXU)) <= 0)
- {
- perror("cannot open read file:");
- exit(1);
- }else
- {
-
- if(write(Fd2, READ_FILE_MESSAGE, strlen(READ_FILE_MESSAGE)) < 0)
- {
- perror("Problems writing to readfile:");
- exit(1);
- }
- lseek(Fd2, 0, SEEK_SET);
- }
- }
-
- if((Cfd = open(LogFile, O_WRONLY|O_SYNC)) <= 0)
- {
- perror("cannot open o/p logfile:");
- exit(1);
- }
-
- if (signal(SIGALRM, &AlarmHandler) == SIG_ERR) {
- printf("Couldn't register signal handler for SIGALRM.\n");
- sprintf(tmpBuf,
- "Couldn't register signal handler for SIGALRM.\n");
- Write(Fd1, tmpBuf, strlen(tmpBuf), __LINE__);
- close(Fd1);
- exit(EXIT_REG_SIGALRM_ERR);
- }
-
- if (signal(SIGINT, &SignalHandler) == SIG_ERR) {
- printf("Couldn't register signal handler for SIGINT.\n");
- sprintf(tmpBuf,
- "Couldn't register signal handler for SIGINT.\n");
- Write(Fd1, tmpBuf, strlen(tmpBuf), __LINE__);
- close(Fd1);
- exit(EXIT_REG_SIGINT_ERR);
- }
- printf("Press Ctrl+C to exit the program.\n");
- printf("Output File: %s\n", OutFileName);
- printf("Scheduler priority: %d\n", RequestedPriority);
- sprintf(tmpBuf, "\nScheduler priority: %d\n",
- RequestedPriority);
- Write(Fd1, tmpBuf, strlen(tmpBuf), __LINE__);
- Write(Cfd, tmpBuf, strlen(tmpBuf), __LINE__);
- printf("Interrupt period: %ld milliseconds\n",
- InterruptPeriodMilliSec);
- sprintf(tmpBuf, "Interrupt period: %ld milliseconds\n",
- InterruptPeriodMilliSec);
- Write(Fd1, tmpBuf, strlen(tmpBuf), __LINE__);
- Write(Cfd, tmpBuf, strlen(tmpBuf), __LINE__);
- fflush(0);
-
- InitITimer(&ITimer, ONESHOT);
-
- if (gettimeofday(&PrevTimeVal, NULL) != (int) 0) {
- printf("Exiting - ");
- printf("Unable to initialize previous time of day.\n");
- sprintf(tmpBuf, "Exiting - ");
- Write(Fd1, tmpBuf, strlen(tmpBuf), __LINE__);
- sprintf(tmpBuf,
- "Unable to initialize previous time of day.\n");
- Write(Fd1, tmpBuf, strlen(tmpBuf), __LINE__);
- }
-
- setitimer(ITIMER_REAL, &ITimer, NULL);
- while(TRUE) {
-
- sleep((unsigned int) 1);
- }
-
- close(Fd1);
- close(Cfd);
- return 0;
- }
- void SignalHandler(
- int sigNum)
- {
- char tmpBuf[200];
-
- (void)sigNum;
- printf("Ctrl+C detected. Worst Jitter time was:%fms.\nJitterTest exiting.\n",
- (float)LastMaxDiff/1000.0);
- sprintf(tmpBuf,
- "\nCtrl+C detected. Worst Jitter time was:%fms\nJitterTest exiting.\n",
- (float)LastMaxDiff/1000.0);
- Write(Fd1, tmpBuf, strlen(tmpBuf), __LINE__);
- Write(Cfd, tmpBuf, strlen(tmpBuf), __LINE__);
- close(Fd1);
- close(Cfd);
- exit(0);
- }
- static void doGrabKProfile(int jitterusec, char *fileName)
- {
- int fdSnapshot;
- int fdProfile;
- int readBytes;
- char readBuf[4096];
- (void)jitterusec;
- if((fdSnapshot = open(fileName, O_WRONLY | O_CREAT, S_IRWXU)) < 0)
- {
- fprintf(stderr, "Could not open file %s.\n", fileName);
- perror("Error:");
- return;
- }
- if((fdProfile = open("/proc/profile", O_RDWR)) < 0)
- {
- fprintf(stderr, "Could not open file /proc/profile. Make sure you booted with profile=2\n");
- close(fdSnapshot);
- return;
- }
- while((readBytes = read(fdProfile, readBuf, sizeof(readBuf))) > 0)
- {
- int writeBytes = write(fdSnapshot, readBuf, readBytes);
- if (writeBytes != readBytes) {
- perror("write error");
- break;
- }
- }
- close(fdSnapshot);
- if(write(fdProfile, readBuf, 1) != 1)
- {
- perror("Could Not clear profile by writing to /proc/profile:");
- }
- close(fdProfile);
- }
- static void clearProfileBuf(void){
- int fdProfile;
- char readBuf[10];
- if((fdProfile = open("/proc/profile", O_RDWR)) < 0)
- {
- fprintf(stderr, "Could not open file /proc/profile. Make sure you booted with profile=2\n");
- return;
- }
- if(write(fdProfile, readBuf, 1) != 1)
- {
- perror("Could Not clear profile by writing to /proc/profile:");
- }
- close(fdProfile);
- }
- void AlarmHandler(
- int sigNum)
- {
- long timeDiffusec;
- long intervalusec;
- char tmpBuf[MAX_WRITE_BYTES];
- int cntr;
- char padChar;
- static int profileFileNo = 0;
- char profileFileName[150];
- static int seedStarter = 0;
- (void)sigNum;
- if (gettimeofday(&CurrTimeVal, NULL) == (int) 0) {
-
- timeDiffusec = (long)(((((long long)CurrTimeVal.tv_sec) * 1000000L) + CurrTimeVal.tv_usec) -
- (((long long)PrevTimeVal.tv_sec * 1000000L) + PrevTimeVal.tv_usec));
- sprintf(tmpBuf," %f ms ", (float)timeDiffusec/1000.0);
- intervalusec = InterruptPeriodMilliSec * 1000L;
- timeDiffusec = timeDiffusec - intervalusec;
- sprintf(&tmpBuf[strlen(tmpBuf)]," %f ms", (float)timeDiffusec/1000.0);
-
- if(SignalGCTask){
- if(kill(GCTaskPID, SIGSTOP) < 0){
- perror("error:");
- }
- }
-
- if(labs(timeDiffusec) > LastMaxDiff)
- {
- LastMaxDiff = labs(timeDiffusec);
- sprintf(&tmpBuf[strlen(tmpBuf)],"!");
- if((GrabKProfile == TRUE) && (ProfileTriggerMSecs < (labs(timeDiffusec)/1000)))
- {
- sprintf(profileFileName, "JitterTest.profilesnap-%i", profileFileNo);
-
- doGrabKProfile(timeDiffusec, profileFileName);
- profileFileNo++;
-
- sprintf(&tmpBuf[strlen(tmpBuf)],"<Profile saved in file:%s>",
- profileFileName);
- }
- }
- sprintf(&tmpBuf[strlen(tmpBuf)],"\n");
- Write(Cfd, tmpBuf, strlen(tmpBuf), __LINE__);
-
- sprintf(&tmpBuf[strlen(tmpBuf)-1]," PadBytes:");
-
- if(WriteBytes > MIN_WRITE_BYTES)
- {
-
- srand(time(NULL) + seedStarter);
-
- for(cntr = strlen(tmpBuf); cntr < WriteBytes - 1 ; cntr++)
- {
-
- padChar = (char)(MIN_ASCII+(int)((MAX_ASCII-(float)MIN_ASCII)*rand()/(RAND_MAX+1.0)));
-
- tmpBuf[cntr] = padChar;
- }
- seedStarter = tmpBuf[cntr-1];
- tmpBuf[cntr] = '\n';
- tmpBuf[cntr+1] = '\0';
- }
-
- Write(Fd1, tmpBuf, strlen(tmpBuf), __LINE__);
-
- if(DoRead)
- {
- cntr = read(Fd2, tmpBuf, 1);
- if (cntr < 0)
- perror("read error");
- lseek(Fd2, 0, SEEK_SET);
- }
-
- setitimer(ITIMER_REAL, &ITimer, NULL);
-
- PrevTimeVal.tv_sec = CurrTimeVal.tv_sec;
- PrevTimeVal.tv_usec = CurrTimeVal.tv_usec;
- }
- else {
- sprintf(tmpBuf, "gettimeofday error \n");
- Write(Fd1, tmpBuf, strlen(tmpBuf), __LINE__);
- printf("gettimeofday error \n");
- }
-
- if(GrabKProfile == TRUE){
- clearProfileBuf();
- }
-
- if(SignalGCTask){
- if(kill(GCTaskPID, SIGCONT) < 0){
- perror("error:");
- }
- }
- return;
- }
- void InitITimer(
- struct itimerval * pITimer,
- int action)
- {
- long seconds;
- long microSeconds;
-
- if (InterruptPeriodMilliSec < MILLISEC_PER_SEC) {
- seconds = 0L;
- microSeconds = InterruptPeriodMilliSec * MICROSEC_PER_MILLISEC;
- }
- else {
- seconds = InterruptPeriodMilliSec / MILLISEC_PER_SEC;
- microSeconds =
- (InterruptPeriodMilliSec - (seconds * MILLISEC_PER_SEC)) *
- MICROSEC_PER_MILLISEC;
- }
-
- pITimer->it_value.tv_sec = seconds;
- pITimer->it_value.tv_usec = microSeconds;
- if(action == ONESHOT)
- {
-
- pITimer->it_interval.tv_sec = 0;
- pITimer->it_interval.tv_usec = 0;
- }else
- {
- pITimer->it_interval.tv_sec = seconds;
- pITimer->it_interval.tv_usec = microSeconds;
- }
- return;
- }
- void HandleCmdLineArgs(
- int argc,
- char *argv[])
- {
- int argNum;
- if (argc > (int) 1) {
- for (argNum = (int) 1; argNum < argc; argNum++) {
-
- if ((strcmp(argv[argNum],"--version") == STRINGS_EQUAL) ||
- (strcmp(argv[argNum],"-v") == STRINGS_EQUAL)) {
-
- PrintVersionInfo();
- exit(0);
- }
- else if ((strcmp(argv[argNum],"--help") == STRINGS_EQUAL) ||
- (strcmp(argv[argNum],"-h") == STRINGS_EQUAL) ||
- (strcmp(argv[argNum],"-?") == STRINGS_EQUAL)) {
-
- PrintHelpInfo();
- exit(0);
- }
- else if ((strcmp(argv[argNum],"--file") == STRINGS_EQUAL) ||
- (strcmp(argv[argNum],"-f") == STRINGS_EQUAL)) {
-
- ++argNum;
- if (argNum < argc) {
- SetFileName(argv[argNum]);
- }
- else {
- printf("*** Output file name not specified. ***\n");
- printf("Default output file name will be used.\n");
- }
- }
- else if ((strcmp(argv[argNum],"--time") == STRINGS_EQUAL) ||
- (strcmp(argv[argNum],"-t") == STRINGS_EQUAL)) {
-
- ++argNum;
- if (argNum < argc) {
- SetInterruptPeriod(argv[argNum]);
- }
- else {
- printf("*** Interrupt period not specified. ***\n");
- printf("Default interrupt period will be used.\n");
- }
- }
- else if ((strcmp(argv[argNum],"--priority") ==
- STRINGS_EQUAL) ||
- (strcmp(argv[argNum],"-p") == STRINGS_EQUAL)) {
-
- ++argNum;
- if (argNum < argc) {
- SetSchedulerPriority(argv[argNum]);
- }
- else {
- printf("*** Scheduler priority not specified. ***\n");
- printf("Default scheduler priority will be used.\n");
- }
- }
- else if ((strcmp(argv[argNum],"--readfile") ==
- STRINGS_EQUAL) ||
- (strcmp(argv[argNum],"-r") == STRINGS_EQUAL)) {
-
- ++argNum;
- strncpy(ReadFile, argv[argNum], sizeof(ReadFile));
- DoRead = TRUE;
- }
- else if ((strcmp(argv[argNum],"--write_bytes") ==
- STRINGS_EQUAL) ||
- (strcmp(argv[argNum],"-w") == STRINGS_EQUAL)) {
-
- ++argNum;
- WriteBytes = atoi(argv[argNum]);
- if(WriteBytes < MIN_WRITE_BYTES)
- {
- printf("Writing less than %i bytes is not allowed. Bye.\n",
- MIN_WRITE_BYTES);
- exit(0);
- }
- }
- else if ((strcmp(argv[argNum],"--consolefile") ==
- STRINGS_EQUAL) ||
- (strcmp(argv[argNum],"-c") == STRINGS_EQUAL)) {
-
- ++argNum;
- strncpy(LogFile, argv[argNum], sizeof(LogFile) - 1);
- LogFile[sizeof(LogFile) - 1] = '\0';
- }
- else if ((strcmp(argv[argNum],"--grab_kprofile") ==
- STRINGS_EQUAL))
- {
-
- GrabKProfile = TRUE;
- ++argNum;
-
- ProfileTriggerMSecs = (long) atoi(argv[argNum]);
- if(ProfileTriggerMSecs <= 0){
- printf("Illegal value for profile trigger threshold.\n");
- exit(0);
- }
- }
- else if ((strcmp(argv[argNum],"--siggc") ==
- STRINGS_EQUAL))
- {
-
- SignalGCTask = TRUE;
- ++argNum;
- GCTaskPID = atoi(argv[argNum]);
- if(ProfileTriggerMSecs <= 0){
- printf("Illegal value for JFFS(2) GC task pid.\n");
- exit(0);
- }
- }
- else {
-
- printf("Invalid option %s\n", argv[argNum]);
- printf("Try 'JitterTest --help' for more information.\n");
- exit(0);
- }
- }
- }
- return;
- }
- void SetFileName(
- char * pFileName)
- {
- size_t fileNameLen;
-
- fileNameLen = strlen(pFileName);
- if (fileNameLen > (size_t) MAX_FILE_NAME_LEN) {
- printf("File name %s exceeds maximum length %d.\n",
- pFileName, MAX_FILE_NAME_LEN);
- exit(0);
- }
-
- strcpy(OutFileName, pFileName);
- return;
- }
- void SetInterruptPeriod(
- char *
- pASCIIInterruptPeriodMilliSec)
- {
- long period;
- period = atol(pASCIIInterruptPeriodMilliSec);
- if ((period < MIN_INT_PERIOD_MILLISEC) ||
- (period > MAX_INT_PERIOD_MILLISEC)) {
- printf("Invalid interrupt period: %ld ms.\n", period);
- exit(EXIT_INV_INT_PERIOD);
- }
- else {
- InterruptPeriodMilliSec = period;
- }
- return;
- }
- void SetSchedulerPriority(
- char * pASCIISchedulerPriority)
- {
- int priority;
- priority = atoi(pASCIISchedulerPriority);
- if ((priority < MinPriority) ||
- (priority > MaxPriority)) {
- printf("Scheduler priority %d outside of range [%d, %d]\n",
- priority, MinPriority, MaxPriority);
- exit(EXIT_INV_SCHED_PRIORITY);
- }
- else {
- RequestedPriority = priority;
- RunAsRTTask = TRUE;
- }
- return;
- }
- void PrintVersionInfo(void)
- {
- common_print_version();
- printf("Copyright (c) 2001, Daniel Industries, Inc.\n");
- return;
- }
- void PrintHelpInfo(void)
- {
- printf("Usage: JitterTest [options]\n");
- printf(" *** Requires root privileges. ***\n");
- printf("Option:\n");
- printf(" [-h, --help, -?] Print this message and exit.\n");
- printf(" [-v, --version] ");
- printf( "Print the version number of JitterTest and exit.\n");
- printf(" [-f FILE, --file FILE] Set output file name to FILE. Typically you would put this on the fs under test\n");
- printf(" [-c FILE, --consolefile] Set device or file to write the console log to.\n\tTypically you would set this to /dev/console and save it on another computer.\n");
- printf(" [-w BYTES, --write_bytes BYTES Write BYTES to FILE each period.\n");
- printf(" [-r FILE, --readfile FILE] Also read 1 byte every cycle from FILE. FILE will be created and filled with data.\n");
- printf(" [-t <n>, --time <n>] ");
- printf( "Set interrupt period to <n> milliseconds.\n");
- printf(" ");
- printf( "Range: [%ld, %ld] milliseconds.\n",
- MIN_INT_PERIOD_MILLISEC, MAX_INT_PERIOD_MILLISEC);
- printf(" [-p <n>, --priority <n>] ");
- printf( "Set scheduler priority to <n>.\n");
- printf(" ");
- printf( "Range: [%d, %d] (higher number = higher priority)\n",
- MinPriority, MaxPriority);
- printf(" [--grab_kprofile <THRESHOLD in ms>] Read the /proc/profile if jitter is > THRESHOLD and store in file.\n");
- printf(" [--siggc <PID>] Before writing to fs send SIGSTOP to PID. After write send SIGCONT\n");
- return;
- }
- int Write(int fd, void *buf, size_t bytes, int lineNo)
- {
- int err;
- err = write(fd, buf, bytes);
- if(err < bytes)
- {
- printf("Write Error at line %i! Wanted to write %zu bytes, but wrote only %i bytes.\n",
- lineNo, bytes, err);
- perror("Write did not complete. Error. Bye:");
- exit(1);
- }
- return err;
- }
|