~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/timers/skew_consistency.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* ADJ_FREQ Skew consistency test
  2  *              by: john stultz (johnstul@us.ibm.com)
  3  *              (C) Copyright IBM 2012
  4  *              Licensed under the GPLv2
  5  *
  6  *  NOTE: This is a meta-test which cranks the ADJ_FREQ knob back
  7  *  and forth and watches for consistency problems. Thus this test requires
  8  *  that the inconsistency-check tests be present in the same directory it
  9  *  is run from.
 10  *
 11  *  To build:
 12  *      $ gcc skew_consistency.c -o skew_consistency -lrt
 13  *
 14  *   This program is free software: you can redistribute it and/or modify
 15  *   it under the terms of the GNU General Public License as published by
 16  *   the Free Software Foundation, either version 2 of the License, or
 17  *   (at your option) any later version.
 18  *
 19  *   This program is distributed in the hope that it will be useful,
 20  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 21  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 22  *   GNU General Public License for more details.
 23  */
 24 
 25 
 26 #include <stdio.h>
 27 #include <stdlib.h>
 28 #include <unistd.h>
 29 #include <sys/time.h>
 30 #include <sys/timex.h>
 31 #include <time.h>
 32 #include <sys/types.h>
 33 #include <sys/stat.h>
 34 #include <fcntl.h>
 35 #include <string.h>
 36 #include <sys/wait.h>
 37 #include "../kselftest.h"
 38 
 39 #define NSEC_PER_SEC 1000000000LL
 40 
 41 int main(int argc, char **argv)
 42 {
 43         struct timex tx;
 44         int ret, ppm;
 45         pid_t pid;
 46 
 47 
 48         printf("Running Asynchronous Frequency Changing Tests...\n");
 49 
 50         pid = fork();
 51         if (!pid)
 52                 return system("./inconsistency-check -c 1 -t 600");
 53 
 54         ppm = 500;
 55         ret = 0;
 56 
 57         while (pid != waitpid(pid, &ret, WNOHANG)) {
 58                 ppm = -ppm;
 59                 tx.modes = ADJ_FREQUENCY;
 60                 tx.freq = ppm << 16;
 61                 adjtimex(&tx);
 62                 usleep(500000);
 63         }
 64 
 65         /* Set things back */
 66         tx.modes = ADJ_FREQUENCY;
 67         tx.offset = 0;
 68         adjtimex(&tx);
 69 
 70 
 71         if (ret) {
 72                 printf("[FAILED]\n");
 73                 ksft_exit_fail();
 74         }
 75         printf("[OK]\n");
 76         ksft_exit_pass();
 77 }
 78 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php