rt-tests: Add *.dat to .gitignore
PATCH 1/3 rt-tests: Add *.dat to .gitignore
Add *.dat to .gitignore so that files such as trace.dat are ignored by git
--- .gitignore | 1 + 1 file changed, 1 insertion(+)
.gitignore +1 -0
@@ -10,6 +10,7 @@ *.bz2 *.xz *.asc +*.dat tmp patches ChangeLog
Signature · 1 line
2.31.1
PATCH 2/3 rt-tests: Update the help and man page for --latency
- Update the help and man page for --latency
- Fix some sorting of --latency and --loops
--- src/cyclictest/cyclictest.8 | 12 ++++++------ src/cyclictest/cyclictest.c | 6 ++++-- 2 files changed, 10 insertions(+), 8 deletions(-)
src/cyclictest/cyclictest.8 +6 -6
@@ -67,9 +67,6 @@ Specify a length for the test run. .br Append 'm', 'h', or 'd' to specify minutes, hours or days. .TP -.B \-\-latency=PM_Q0S -write PM_Q0S to /dev/cpu_dma_latency -.TP .B \-F, \-\-fifo=<path> Create a named pipe at path and write stats to it .TP
@@ -88,12 +85,15 @@ Set the base interval of the thread(s) in microseconds (default is 1000us). This .B \-\-json=FILENAME Write final results into FILENAME, JSON formatted. .TP -.B \-l, \-\-loops=LOOPS -Set the number of loops. The default is 0 (endless). This option is useful for automated tests with a given number of test cycles. Cyclictest is stopped once the number of timer intervals has been reached. -.TP .B \-\-laptop Save battery when running cyclictest. This will give you poorer realtime results, but will not drain your battery so quickly. .TP +.B \-\-latency=PM_Q0S +power management latency target value. This value is written to /dev/cpu_dma_latency and affects c-states. The default is 0 +.TP +.B \-l, \-\-loops=LOOPS +Set the number of loops. The default is 0 (endless). This option is useful for automated tests with a given number of test cycles. Cyclictest is stopped once the number of timer intervals has been reached. +.TP .B \-\-mainaffinity=CPUSET Run the main thread on CPU #N. This only affects the main thread and not the measurement threads .TP
src/cyclictest/cyclictest.c +4 -2
@@ -823,7 +823,6 @@ static void display_help(int error)"-d DIST --distance=DIST distance of thread intervals in us, default=500\n" "-D --duration=TIME specify a length for the test run.\n" " Append 'm', 'h', or 'd' to specify minutes, hours or days.\n" -" --latency=PM_QOS write PM_QOS to /dev/cpu_dma_latency\n" "-F --fifo=<path> create a named pipe at path and write stats to it\n" "-h --histogram=US dump a latency histogram to stdout after the run\n" " US is the max latency time to be tracked in microseconds\n"
@@ -832,10 +831,13 @@ static void display_help(int error)" --histfile=<path> dump the latency histogram to <path> instead of stdout\n" "-i INTV --interval=INTV base interval of thread in us default=1000\n" " --json=FILENAME write final results into FILENAME, JSON formatted\n" -"-l LOOPS --loops=LOOPS number of loops: default=0(endless)\n" " --laptop Save battery when running cyclictest\n" " This will give you poorer realtime results\n" " but will not drain your battery so quickly\n" +" --latency=PM_QOS power management latency target value\n" +" This value is written to /dev/cpu_dma_latency\n" +" and affects c-states. The default is 0\n" +"-l LOOPS --loops=LOOPS number of loops: default=0(endless)\n" " --mainaffinity=CPUSET\n" " Run the main thread on CPU #N. This only affects\n" " the main thread and not the measurement threads\n"
Signature · 1 line
2.31.1
PATCH 3/3 rt-tests: cyclictest: Add --default-system option
In reply to John KacurThis patch add the long option --default-system --default-system runs cyclictest without attempting any tuning. Power management is not suppressed so cyclictest measures the system as it is configured.
This is effectively the same as --laptop, but makes it clear to the user what is done and why.
--- src/cyclictest/cyclictest.8 | 3 +++ src/cyclictest/cyclictest.c | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-)
src/cyclictest/cyclictest.8 +3 -0
@@ -59,6 +59,9 @@ select clock .br 1 = CLOCK_REALTIME .TP +.B \-\-default\-system +Don't attempt to tune the system from cyclictest. Power management is not suppressed. This might give poorer results, but will allow you to discover if you need to tune the system. +.TP .B \-d, \-\-distance=DIST Distance of thread intervals in us, default = 500 .TP
src/cyclictest/cyclictest.c +14 -1
@@ -194,6 +194,7 @@ static int ct_debug;static int use_fifo =0 ;static pthread_t fifo_threadid;static int laptop =0 ; +static int power_management =0 ;static int use_histfile =0 ;#ifdef ARCH_HAS_SMI_COUNTER
@@ -256,6 +257,11 @@ static void set_latency_target(void)return ; } +if (power_management) { +warn ("not setting cpu_dma_latency from cyclictest\n" ); +return ; + } + errno =0 ; err =stat ("/dev/cpu_dma_latency" , &s);if (err ==-1 ) {
@@ -820,6 +826,10 @@ static void display_help(int error)"-c CLOCK --clock=CLOCK select clock\n" " 0 = CLOCK_MONOTONIC (default)\n" " 1 = CLOCK_REALTIME\n" +" --default-system Don't attempt to tune the system from cyclictest.\n" +" Power management is not suppressed.\n" +" This might give poorer results, but will allow you\n" +" to discover if you need to tune the system\n" "-d DIST --distance=DIST distance of thread intervals in us, default=500\n" "-D --duration=TIME specify a length for the test run.\n" " Append 'm', 'h', or 'd' to specify minutes, hours or days.\n"
@@ -947,7 +957,7 @@ static char *policyname(int policy)enum option_values {OPT_AFFINITY =1 ,OPT_BREAKTRACE ,OPT_CLOCK , -OPT_DISTANCE ,OPT_DURATION ,OPT_LATENCY , +OPT_DEFAULT_SYSTEM ,OPT_DISTANCE ,OPT_DURATION ,OPT_LATENCY ,OPT_FIFO ,OPT_HISTOGRAM ,OPT_HISTOFALL ,OPT_HISTFILE ,OPT_INTERVAL ,OPT_JSON ,OPT_MAINAFFINITY ,OPT_LOOPS ,OPT_MLOCKALL ,OPT_REFRESH ,OPT_NANOSLEEP ,OPT_NSECS ,OPT_OSCOPE ,OPT_PRIORITY ,
@@ -976,6 +986,7 @@ static void process_options(int argc, char *argv[], int max_cpus) {"aligned", optional_argument, NULL, OPT_ALIGNED }, {"breaktrace", required_argument, NULL, OPT_BREAKTRACE }, {"clock", required_argument, NULL, OPT_CLOCK }, + {"default-system", no_argument, NULL, OPT_DEFAULT_SYSTEM }, {"distance", required_argument, NULL, OPT_DISTANCE }, {"duration", required_argument, NULL, OPT_DURATION }, {"latency", required_argument, NULL, OPT_LATENCY },
@@ -1061,6 +1072,8 @@ static void process_options(int argc, char *argv[], int max_cpus)case OPT_CLOCK : clocksel =atoi (optarg);break ;case 'C' : +case OPT_DEFAULT_SYSTEM : + power_management =1 ;break ;case 'd' :case OPT_DISTANCE : distance =atoi (optarg);break ;
Signature · 1 line
2.31.1
Re: [PATCH 3/3] rt-tests: cyclictest: Add --default-system option
Quoted 9 lines · John Kacur
This patch add the long option --default-system --default-system runs cyclictest without attempting any tuning. Power management is not suppressed so cyclictest measures the system as it is configured.
This is effectively the same as --laptop, but makes it clear to the user what is done and why.
Signed-off-by John Kacur <[email protected]>
I suppose this is probably the best that can be done without breaking compatibility.
One comment about a pre-existing issue in the code below.
Quoted 72 lines
--- src/cyclictest/cyclictest.8 | 3 +++ src/cyclictest/cyclictest.c | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-)src/cyclictest/cyclictest.8 +3
-0@@ -59,6 +59,9 @@ select clock .br 1 = CLOCK_REALTIME .TP +.B \-\-default\-system +Don't attempt to tune the system from cyclictest. Power management is not suppressed. This might give poorer results, but will allow you to discover if you need to tune the system. +.TP .B \-d, \-\-distance=DIST Distance of thread intervals in us, default = 500 .TPsrc/cyclictest/cyclictest.c +12
-1@@ -194,6 +194,7 @@ static int ct_debug;static int use_fifo =0 ;static pthread_t fifo_threadid;static int laptop =0 ; +static int power_management =0 ;static int use_histfile =0 ;#ifdef ARCH_HAS_SMI_COUNTER @@ -256,6 +257,11 @@ static void set_latency_target(void)return ; } +if (power_management) { +warn ("not setting cpu_dma_latency from cyclictest\n" ); +return ; + } + errno =0 ; err =stat ("/dev/cpu_dma_latency" , &s);if (err ==-1 ) {@@ -820,6 +826,10 @@ static void display_help(int error)"-c CLOCK --clock=CLOCK select clock\n" " 0 = CLOCK_MONOTONIC (default)\n" " 1 = CLOCK_REALTIME\n" +" --default-system Don't attempt to tune the system from cyclictest.\n" +" Power management is not suppressed.\n" +" This might give poorer results, but will allow you\n" +" to discover if you need to tune the system\n" "-d DIST --distance=DIST distance of thread intervals in us, default=500\n" "-D --duration=TIME specify a length for the test run.\n" " Append 'm', 'h', or 'd' to specify minutes, hours or days.\n" @@ -947,7 +957,7 @@ static char *policyname(int policy)enum option_values {OPT_AFFINITY =1 ,OPT_BREAKTRACE ,OPT_CLOCK , -OPT_DISTANCE ,OPT_DURATION ,OPT_LATENCY , +OPT_DEFAULT_SYSTEM ,OPT_DISTANCE ,OPT_DURATION ,OPT_LATENCY ,OPT_FIFO ,OPT_HISTOGRAM ,OPT_HISTOFALL ,OPT_HISTFILE ,OPT_INTERVAL ,OPT_JSON ,OPT_MAINAFFINITY ,OPT_LOOPS ,OPT_MLOCKALL ,OPT_REFRESH ,OPT_NANOSLEEP ,OPT_NSECS ,OPT_OSCOPE ,OPT_PRIORITY ,@@ -976,6 +986,7 @@ static void process_options(int argc, char *argv[], int max_cpus) {"aligned", optional_argument, NULL, OPT_ALIGNED }, {"breaktrace", required_argument, NULL, OPT_BREAKTRACE }, {"clock", required_argument, NULL, OPT_CLOCK }, + {"default-system", no_argument, NULL, OPT_DEFAULT_SYSTEM }, {"distance", required_argument, NULL, OPT_DISTANCE }, {"duration", required_argument, NULL, OPT_DURATION }, {"latency", required_argument, NULL, OPT_LATENCY },
src/cyclictest/cyclictest.c static void process_options(int argc, char *argv[], int max_cpus) · line 1074
Quoted 3 lines
src/cyclictest/cyclictest.c +0
-0@@ -1061,6 +1072,8 @@ static void process_options(int argc, char *argv[], int max_cpus)case OPT_CLOCK : clocksel =atoi (optarg);break ;case 'C' :
The case for the short option 'C' should be dropped. It seems to be a left-over from a previous cleanup. Same for 'E' a bit further down in the switch statement.
Quoted 5 lines
src/cyclictest/cyclictest.c +2
-0+case OPT_DEFAULT_SYSTEM : + power_management =1 ;break ;case 'd' :case OPT_DISTANCE : distance =atoi (optarg);break ;