linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: John Kacur <jkacur@redhat.com>
Cc: rt-users <linux-rt-users@vger.kernel.org>,
	Clark Williams <williams@redhat.com>
Subject: Re: [PATCH 6/6] cyclictest: Add long option --laptop to preserve battery power
Date: Thu, 14 Aug 2014 18:38:06 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.10.1408141837200.25171@riemann> (raw)
In-Reply-To: <1408033090-24866-7-git-send-email-jkacur@redhat.com>



On Thu, 14 Aug 2014, John Kacur wrote:

> Some people running cyclictest on laptops don't want to automatically
> take advantage of the trick that prevents the power management to
> transistion to high cstates, since it eats up their battery power.
> 
> Allow them to suppress this feature with --laptop
> 
> This will result in power latency results of course.

The above should read: "This will result in poorer latency results of 
course."
> 
> Feature-requested-by:  Joakim Hernberg <jhernberg@alchemy.lu>
> Signed-off-by: John Kacur <jkacur@redhat.com>
> ---
>  src/cyclictest/cyclictest.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index b45041e01f3a..a3e7b1d6c377 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -186,6 +186,7 @@ static int use_fifo = 0;
>  static pthread_t fifo_threadid;
>  static int aligned = 0;
>  static int offset = 0;
> +static int laptop = 0;
>  
>  static pthread_cond_t refresh_on_max_cond = PTHREAD_COND_INITIALIZER;
>  static pthread_mutex_t refresh_on_max_lock = PTHREAD_MUTEX_INITIALIZER;
> @@ -235,6 +236,11 @@ static void set_latency_target(void)
>  	struct stat s;
>  	int err;
>  
> +	if (laptop) {
> +		warn("not setting cpu_dma_latency to save battery power\n");
> +		return;
> +	}
> +
>  	errno = 0;
>  	err = stat("/dev/cpu_dma_latency", &s);
>  	if (err == -1) {
> @@ -1020,6 +1026,9 @@ static void display_help(int error)
>  	       "-i INTV  --interval=INTV   base interval of thread in us default=1000\n"
>  	       "-I       --irqsoff         Irqsoff tracing (used with -b)\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"
>  	       "-m       --mlockall        lock current and future memory allocations\n"
>  	       "-M       --refresh_on_max  delay updating the screen until a new max latency is hit\n"
>  	       "-n       --nanosleep       use clock_nanosleep\n"
> @@ -1183,7 +1192,7 @@ enum option_values {
>  	OPT_QUIET, OPT_PRIOSPREAD, OPT_RELATIVE, OPT_RESOLUTION, OPT_SYSTEM,
>  	OPT_SMP, OPT_THREADS, OPT_TRACER, OPT_UNBUFFERED, OPT_NUMA, OPT_VERBOSE,
>  	OPT_WAKEUP, OPT_WAKEUPRT, OPT_DBGCYCLIC, OPT_POLICY, OPT_HELP, OPT_NUMOPTS,
> -	OPT_ALIGNED,
> +	OPT_ALIGNED, OPT_LAPTOP,
>  };
>  
>  /* Process commandline options */
> @@ -1216,6 +1225,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
>  			{"histofall",        required_argument, NULL, OPT_HISTOFALL },
>  			{"interval",         required_argument, NULL, OPT_INTERVAL },
>  			{"irqsoff",          no_argument,       NULL, OPT_IRQSOFF },
> +			{"laptop",	     no_argument,	NULL, OPT_LAPTOP },
>  			{"loops",            required_argument, NULL, OPT_LOOPS },
>  			{"mlockall",         no_argument,       NULL, OPT_MLOCKALL },
>  			{"refresh_on_max",   no_argument,       NULL, OPT_REFRESH },
> @@ -1445,6 +1455,8 @@ static void process_options (int argc, char *argv[], int max_cpus)
>  			handlepolicy(optarg); break;
>  		case OPT_DBGCYCLIC:
>  			ct_debug = 1; break;
> +		case OPT_LAPTOP:
> +			laptop = 1; break;
>  		}
>  	}
>  
> -- 
> 1.8.1.4
> 
> 

  reply	other threads:[~2014-08-14 16:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-14 16:18 [PATCH 0/6] Miscellaneous cyclictest patches John Kacur
2014-08-14 16:18 ` [PATCH 1/6] lib: Rework err_msg_n to output strerror after message John Kacur
2014-08-14 16:18 ` [PATCH 2/6] rt_numa.h: Suppress discards 'const' qualifier warning John Kacur
2014-08-14 16:18 ` [PATCH 3/6] cyclictest: Always print an err message if write of 0 to cpu-dma_latency fails John Kacur
2014-08-14 16:18 ` [PATCH 4/6] cyclictest: Change the output from function sighand() to stderr John Kacur
2014-08-14 16:18 ` [PATCH 5/6] cyclictest: Fix help for long options only John Kacur
2014-08-18 20:26   ` Michael
2014-08-18 20:45     ` John Kacur
2014-08-14 16:18 ` [PATCH 6/6] cyclictest: Add long option --laptop to preserve battery power John Kacur
2014-08-14 16:38   ` John Kacur [this message]
2014-08-18 20:29   ` Michael
2014-08-18 20:46     ` John Kacur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.10.1408141837200.25171@riemann \
    --to=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).