linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Carsten Emde <C.Emde@osadl.org>
Cc: Clark Williams <williams@redhat.com>,
	RT-users <linux-rt-users@vger.kernel.org>
Subject: Re: [PATCH 1/2] add-smp-option-to-ptsematest.patch
Date: Mon, 8 Mar 2010 13:45:27 +0100	[thread overview]
Message-ID: <520f0cf11003080445i2733a309v3362fa217e542050@mail.gmail.com> (raw)
In-Reply-To: <20100307204907.464728076@osadl.org>

On Sun, Mar 7, 2010 at 9:48 PM, Carsten Emde <C.Emde@osadl.org> wrote:
> Add SMP testing option (-S, --smp) to ptsematest, same as in
> cyclictest.
>
> Signed-off-by: Carsten Emde <C.Emde@osadl.org>
>
> Index: rt-tests/src/ptsematest/ptsematest.c
> ===================================================================
> --- rt-tests.orig/src/ptsematest/ptsematest.c
> +++ rt-tests/src/ptsematest/ptsematest.c
> @@ -173,6 +173,8 @@ static void display_help(void)
>        "-i INTV  --interval=INTV   base interval of thread in us default=1000\n"
>        "-l LOOPS --loops=LOOPS     number of loops: default=0(endless)\n"
>        "-p PRIO  --prio=PRIO       priority\n"
> +       "-S       --smp             SMP testing: options -a -t and same priority\n"
> +        "                           of all threads\n"
>        "-t       --threads         one thread per available processor\n"
>        "-t [NUM] --threads=NUM     number of threads:\n"
>        "                           without NUM, threads = max_cpus\n"
> @@ -189,6 +191,8 @@ static int num_threads = 1;
>  static int max_cycles;
>  static int interval = 1000;
>  static int distance = 500;
> +static int smp;
> +static int sameprio;
>
>  static void process_options (int argc, char *argv[])
>  {
> @@ -205,16 +209,21 @@ static void process_options (int argc, c
>                        {"interval", required_argument, NULL, 'i'},
>                        {"loops", required_argument, NULL, 'l'},
>                        {"priority", required_argument, NULL, 'p'},
> +                       {"smp", no_argument, NULL, 'S'},
>                        {"threads", optional_argument, NULL, 't'},
>                        {"help", no_argument, NULL, '?'},
>                        {NULL, 0, NULL, 0}
>                };
> -               int c = getopt_long (argc, argv, "a::b:d:i:l:p:t::",
> +               int c = getopt_long (argc, argv, "a::b:d:i:l:p:St::",
>                        long_options, &option_index);
>                if (c == -1)
>                        break;
>                switch (c) {
>                case 'a':
> +                       if (smp) {
> +                               warn("-a ignored due to --smp\n");
> +                               break;
> +                       }
>                        if (optarg != NULL) {
>                                affinity = atoi(optarg);
>                                setaffinity = AFFINITY_SPECIFIED;
> @@ -230,7 +239,16 @@ static void process_options (int argc, c
>                case 'i': interval = atoi(optarg); break;
>                case 'l': max_cycles = atoi(optarg); break;
>                case 'p': priority = atoi(optarg); break;
> +               case 'S':
> +                       smp = 1;
> +                       num_threads = max_cpus;
> +                       setaffinity = AFFINITY_USEALL;
> +                       break;
>                case 't':
> +                       if (smp) {
> +                               warn("-t ignored due to --smp\n");
> +                               break;
> +                       }
>                        if (optarg != NULL)
>                                num_threads = atoi(optarg);
>                        else if (optind<argc && atoi(argv[optind]))
> @@ -261,6 +279,9 @@ static void process_options (int argc, c
>        if (num_threads < 1)
>                error = 1;
>
> +       if (priority && smp)
> +               sameprio = 1;
> +
>        if (error)
>                display_help ();
>  }
> @@ -327,7 +348,7 @@ int main(int argc, char *argv[])
>                }
>                receiver[i].priority = priority;
>                receiver[i].tracelimit = tracelimit;
> -               if (priority > 0)
> +               if (priority > 1 && !sameprio)
>                        priority--;
>                receiver[i].delay.tv_sec = interval / USEC_PER_SEC;
>                receiver[i].delay.tv_nsec = (interval % USEC_PER_SEC) * 1000;
>
> --

Acked-by: John Kacur <jkacur@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-03-08 12:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-07 20:48 [PATCH 0/2] [rt-tests] Add smp option to ptsematest and svsematest Carsten Emde
2010-03-07 20:48 ` [PATCH 1/2] add-smp-option-to-ptsematest.patch Carsten Emde
2010-03-08 12:45   ` John Kacur [this message]
2010-03-07 20:48 ` [PATCH 2/2] add-smp-option-to-svsematest.patch Carsten Emde
2010-03-08 12:45   ` John Kacur
2010-03-09 18:10   ` David Sommerseth
2010-03-09 18:15     ` John Kacur
2010-03-09 21:07       ` Carsten Emde
2010-03-09 20:39     ` Carsten Emde

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=520f0cf11003080445i2733a309v3362fa217e542050@mail.gmail.com \
    --to=jkacur@redhat.com \
    --cc=C.Emde@osadl.org \
    --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).