mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-04-13 09:59:31 +00:00
selftests:timers: remove local CLOCKID defines
timers tests defines CLOCKIDs locally. Remove all local CLOCKIDs except CLOCK_HWSPECIFIC and use defines from time.h header file. CLOCK_HWSPECIFIC and CLOCK_SGI_CYCLE are the same and CLOCK_SGI_CYCLE is deprecated, Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Acked-by: John Stultz <jstultz@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
parent
488be88a32
commit
ecfe6870ab
7 changed files with 15 additions and 76 deletions
|
@ -26,8 +26,6 @@
|
||||||
|
|
||||||
#include "../kselftest.h"
|
#include "../kselftest.h"
|
||||||
|
|
||||||
#define CLOCK_MONOTONIC_RAW 4
|
|
||||||
|
|
||||||
#define MILLION 1000000
|
#define MILLION 1000000
|
||||||
|
|
||||||
long systick;
|
long systick;
|
||||||
|
|
|
@ -32,21 +32,6 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "../kselftest.h"
|
#include "../kselftest.h"
|
||||||
|
|
||||||
#define CLOCK_REALTIME 0
|
|
||||||
#define CLOCK_MONOTONIC 1
|
|
||||||
#define CLOCK_PROCESS_CPUTIME_ID 2
|
|
||||||
#define CLOCK_THREAD_CPUTIME_ID 3
|
|
||||||
#define CLOCK_MONOTONIC_RAW 4
|
|
||||||
#define CLOCK_REALTIME_COARSE 5
|
|
||||||
#define CLOCK_MONOTONIC_COARSE 6
|
|
||||||
#define CLOCK_BOOTTIME 7
|
|
||||||
#define CLOCK_REALTIME_ALARM 8
|
|
||||||
#define CLOCK_BOOTTIME_ALARM 9
|
|
||||||
#define CLOCK_HWSPECIFIC 10
|
|
||||||
#define CLOCK_TAI 11
|
|
||||||
#define NR_CLOCKIDS 12
|
|
||||||
|
|
||||||
|
|
||||||
#define UNREASONABLE_LAT (NSEC_PER_SEC * 5) /* hopefully we resume in 5 secs */
|
#define UNREASONABLE_LAT (NSEC_PER_SEC * 5) /* hopefully we resume in 5 secs */
|
||||||
|
|
||||||
#define SUSPEND_SECS 15
|
#define SUSPEND_SECS 15
|
||||||
|
|
|
@ -31,21 +31,10 @@
|
||||||
#include <include/vdso/time64.h>
|
#include <include/vdso/time64.h>
|
||||||
#include "../kselftest.h"
|
#include "../kselftest.h"
|
||||||
|
|
||||||
#define CALLS_PER_LOOP 64
|
/* CLOCK_HWSPECIFIC == CLOCK_SGI_CYCLE (Deprecated) */
|
||||||
|
|
||||||
#define CLOCK_REALTIME 0
|
|
||||||
#define CLOCK_MONOTONIC 1
|
|
||||||
#define CLOCK_PROCESS_CPUTIME_ID 2
|
|
||||||
#define CLOCK_THREAD_CPUTIME_ID 3
|
|
||||||
#define CLOCK_MONOTONIC_RAW 4
|
|
||||||
#define CLOCK_REALTIME_COARSE 5
|
|
||||||
#define CLOCK_MONOTONIC_COARSE 6
|
|
||||||
#define CLOCK_BOOTTIME 7
|
|
||||||
#define CLOCK_REALTIME_ALARM 8
|
|
||||||
#define CLOCK_BOOTTIME_ALARM 9
|
|
||||||
#define CLOCK_HWSPECIFIC 10
|
#define CLOCK_HWSPECIFIC 10
|
||||||
#define CLOCK_TAI 11
|
|
||||||
#define NR_CLOCKIDS 12
|
#define CALLS_PER_LOOP 64
|
||||||
|
|
||||||
char *clockstring(int clockid)
|
char *clockstring(int clockid)
|
||||||
{
|
{
|
||||||
|
@ -152,7 +141,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int clockid, opt;
|
int clockid, opt;
|
||||||
int userclock = CLOCK_REALTIME;
|
int userclock = CLOCK_REALTIME;
|
||||||
int maxclocks = NR_CLOCKIDS;
|
int maxclocks = CLOCK_TAI + 1;
|
||||||
int runtime = 10;
|
int runtime = 10;
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
|
||||||
|
|
|
@ -30,19 +30,8 @@
|
||||||
#include <include/vdso/time64.h>
|
#include <include/vdso/time64.h>
|
||||||
#include "../kselftest.h"
|
#include "../kselftest.h"
|
||||||
|
|
||||||
#define CLOCK_REALTIME 0
|
/* CLOCK_HWSPECIFIC == CLOCK_SGI_CYCLE (Deprecated) */
|
||||||
#define CLOCK_MONOTONIC 1
|
|
||||||
#define CLOCK_PROCESS_CPUTIME_ID 2
|
|
||||||
#define CLOCK_THREAD_CPUTIME_ID 3
|
|
||||||
#define CLOCK_MONOTONIC_RAW 4
|
|
||||||
#define CLOCK_REALTIME_COARSE 5
|
|
||||||
#define CLOCK_MONOTONIC_COARSE 6
|
|
||||||
#define CLOCK_BOOTTIME 7
|
|
||||||
#define CLOCK_REALTIME_ALARM 8
|
|
||||||
#define CLOCK_BOOTTIME_ALARM 9
|
|
||||||
#define CLOCK_HWSPECIFIC 10
|
#define CLOCK_HWSPECIFIC 10
|
||||||
#define CLOCK_TAI 11
|
|
||||||
#define NR_CLOCKIDS 12
|
|
||||||
|
|
||||||
#define UNSUPPORTED 0xf00f
|
#define UNSUPPORTED 0xf00f
|
||||||
|
|
||||||
|
@ -131,11 +120,12 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
long long length;
|
long long length;
|
||||||
int clockid, ret;
|
int clockid, ret;
|
||||||
|
int max_clocks = CLOCK_TAI + 1;
|
||||||
|
|
||||||
ksft_print_header();
|
ksft_print_header();
|
||||||
ksft_set_plan(NR_CLOCKIDS);
|
ksft_set_plan(max_clocks);
|
||||||
|
|
||||||
for (clockid = CLOCK_REALTIME; clockid < NR_CLOCKIDS; clockid++) {
|
for (clockid = CLOCK_REALTIME; clockid < max_clocks; clockid++) {
|
||||||
|
|
||||||
/* Skip cputime clockids since nanosleep won't increment cputime */
|
/* Skip cputime clockids since nanosleep won't increment cputime */
|
||||||
if (clockid == CLOCK_PROCESS_CPUTIME_ID ||
|
if (clockid == CLOCK_PROCESS_CPUTIME_ID ||
|
||||||
|
|
|
@ -29,20 +29,8 @@
|
||||||
|
|
||||||
#define UNRESONABLE_LATENCY 40000000 /* 40ms in nanosecs */
|
#define UNRESONABLE_LATENCY 40000000 /* 40ms in nanosecs */
|
||||||
|
|
||||||
|
/* CLOCK_HWSPECIFIC == CLOCK_SGI_CYCLE (Deprecated) */
|
||||||
#define CLOCK_REALTIME 0
|
|
||||||
#define CLOCK_MONOTONIC 1
|
|
||||||
#define CLOCK_PROCESS_CPUTIME_ID 2
|
|
||||||
#define CLOCK_THREAD_CPUTIME_ID 3
|
|
||||||
#define CLOCK_MONOTONIC_RAW 4
|
|
||||||
#define CLOCK_REALTIME_COARSE 5
|
|
||||||
#define CLOCK_MONOTONIC_COARSE 6
|
|
||||||
#define CLOCK_BOOTTIME 7
|
|
||||||
#define CLOCK_REALTIME_ALARM 8
|
|
||||||
#define CLOCK_BOOTTIME_ALARM 9
|
|
||||||
#define CLOCK_HWSPECIFIC 10
|
#define CLOCK_HWSPECIFIC 10
|
||||||
#define CLOCK_TAI 11
|
|
||||||
#define NR_CLOCKIDS 12
|
|
||||||
|
|
||||||
#define UNSUPPORTED 0xf00f
|
#define UNSUPPORTED 0xf00f
|
||||||
|
|
||||||
|
@ -144,11 +132,12 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
long long length;
|
long long length;
|
||||||
int clockid, ret;
|
int clockid, ret;
|
||||||
|
int max_clocks = CLOCK_TAI + 1;
|
||||||
|
|
||||||
ksft_print_header();
|
ksft_print_header();
|
||||||
ksft_set_plan(NR_CLOCKIDS - CLOCK_REALTIME - SKIPPED_CLOCK_COUNT);
|
ksft_set_plan(max_clocks - CLOCK_REALTIME - SKIPPED_CLOCK_COUNT);
|
||||||
|
|
||||||
for (clockid = CLOCK_REALTIME; clockid < NR_CLOCKIDS; clockid++) {
|
for (clockid = CLOCK_REALTIME; clockid < max_clocks; clockid++) {
|
||||||
|
|
||||||
/* Skip cputime clockids since nanosleep won't increment cputime */
|
/* Skip cputime clockids since nanosleep won't increment cputime */
|
||||||
if (clockid == CLOCK_PROCESS_CPUTIME_ID ||
|
if (clockid == CLOCK_PROCESS_CPUTIME_ID ||
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
#include <include/vdso/time64.h>
|
#include <include/vdso/time64.h>
|
||||||
#include "../kselftest.h"
|
#include "../kselftest.h"
|
||||||
|
|
||||||
#define CLOCK_MONOTONIC_RAW 4
|
|
||||||
|
|
||||||
#define shift_right(x, s) ({ \
|
#define shift_right(x, s) ({ \
|
||||||
__typeof__(x) __x = (x); \
|
__typeof__(x) __x = (x); \
|
||||||
__typeof__(s) __s = (s); \
|
__typeof__(s) __s = (s); \
|
||||||
|
|
|
@ -31,19 +31,8 @@
|
||||||
#include <include/vdso/time64.h>
|
#include <include/vdso/time64.h>
|
||||||
#include "../kselftest.h"
|
#include "../kselftest.h"
|
||||||
|
|
||||||
#define CLOCK_REALTIME 0
|
/* CLOCK_HWSPECIFIC == CLOCK_SGI_CYCLE (Deprecated) */
|
||||||
#define CLOCK_MONOTONIC 1
|
|
||||||
#define CLOCK_PROCESS_CPUTIME_ID 2
|
|
||||||
#define CLOCK_THREAD_CPUTIME_ID 3
|
|
||||||
#define CLOCK_MONOTONIC_RAW 4
|
|
||||||
#define CLOCK_REALTIME_COARSE 5
|
|
||||||
#define CLOCK_MONOTONIC_COARSE 6
|
|
||||||
#define CLOCK_BOOTTIME 7
|
|
||||||
#define CLOCK_REALTIME_ALARM 8
|
|
||||||
#define CLOCK_BOOTTIME_ALARM 9
|
|
||||||
#define CLOCK_HWSPECIFIC 10
|
#define CLOCK_HWSPECIFIC 10
|
||||||
#define CLOCK_TAI 11
|
|
||||||
#define NR_CLOCKIDS 12
|
|
||||||
|
|
||||||
#define UNRESONABLE_LATENCY 40000000 /* 40ms in nanosecs */
|
#define UNRESONABLE_LATENCY 40000000 /* 40ms in nanosecs */
|
||||||
|
|
||||||
|
@ -253,6 +242,7 @@ int main(void)
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
int signum = SIGRTMAX;
|
int signum = SIGRTMAX;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
int max_clocks = CLOCK_TAI + 1;
|
||||||
|
|
||||||
/* Set up signal handler: */
|
/* Set up signal handler: */
|
||||||
sigfillset(&act.sa_mask);
|
sigfillset(&act.sa_mask);
|
||||||
|
@ -261,7 +251,7 @@ int main(void)
|
||||||
sigaction(signum, &act, NULL);
|
sigaction(signum, &act, NULL);
|
||||||
|
|
||||||
printf("Setting timers for every %i seconds\n", TIMER_SECS);
|
printf("Setting timers for every %i seconds\n", TIMER_SECS);
|
||||||
for (clock_id = 0; clock_id < NR_CLOCKIDS; clock_id++) {
|
for (clock_id = 0; clock_id < max_clocks; clock_id++) {
|
||||||
|
|
||||||
if ((clock_id == CLOCK_PROCESS_CPUTIME_ID) ||
|
if ((clock_id == CLOCK_PROCESS_CPUTIME_ID) ||
|
||||||
(clock_id == CLOCK_THREAD_CPUTIME_ID) ||
|
(clock_id == CLOCK_THREAD_CPUTIME_ID) ||
|
||||||
|
|
Loading…
Add table
Reference in a new issue