All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: xenomai@xenomai.org
Subject: Re: [Xenomai-core] [PATCH 4/6] Add prio switch to latency test
Date: Wed, 28 Jun 2006 21:38:34 +0200	[thread overview]
Message-ID: <44A2DABA.4050902@domain.hid> (raw)
In-Reply-To: <20060626172119.347898000@domain.hid>

[-- Attachment #1: Type: text/plain, Size: 70 bytes --]

This is just a rebased version of the patch over revision #1275.

Jan

[-- Attachment #2: latency-add-prio-switch.patch --]
[-- Type: text/x-patch, Size: 5207 bytes --]

Subject: Add prio switch to latency test

Introduces -P <priority> switch to the latency test and extends xeno_timerbench to respect this for the kernel-based timer task as well. The patch also allows now to run multiple latency tests (both in-kernel and user-space) in parallel.

---
 include/rtdm/rttesting.h          |    1 +
 ksrc/drivers/testing/timerbench.c |    4 ++--
 src/testsuite/latency/latency.c   |   20 ++++++++++++++++----
 3 files changed, 19 insertions(+), 6 deletions(-)

Index: xenomai/include/rtdm/rttesting.h
===================================================================
--- xenomai.orig/include/rtdm/rttesting.h
+++ xenomai/include/rtdm/rttesting.h
@@ -86,6 +86,7 @@ typedef struct rttst_overall_bench_res {
 typedef struct rttst_tmbench_config {
     int                     mode;
     uint64_t                period;
+    int                     priority;
     int                     warmup_loops;
     int                     histogram_size;
     int                     histogram_bucketsize;
Index: xenomai/ksrc/drivers/testing/timerbench.c
===================================================================
--- xenomai.orig/ksrc/drivers/testing/timerbench.c
+++ xenomai/ksrc/drivers/testing/timerbench.c
@@ -305,7 +305,7 @@ int rt_tmbench_ioctl_nrt(struct rtdm_dev
                     ctx->mode = RTTST_TMBENCH_TASK;
                     ret = rtdm_task_init(&ctx->timer_task, "timerbench",
                                          timer_task_proc, ctx,
-                                         RTDM_TASK_HIGHEST_PRIORITY, 0);
+                                         config->priority, 0);
                 }
             } else {
                 /* FIXME: convert to RTDM timers */
@@ -465,7 +465,7 @@ int rt_tmbench_ioctl_rt(struct rtdm_dev_
 static struct rtdm_device device = {
     struct_version:     RTDM_DEVICE_STRUCT_VER,
 
-    device_flags:       RTDM_NAMED_DEVICE | RTDM_EXCLUSIVE,
+    device_flags:       RTDM_NAMED_DEVICE,
     context_size:       sizeof(struct rt_tmbench_context),
     device_name:        "",
 
Index: xenomai/src/testsuite/latency/latency.c
===================================================================
--- xenomai.orig/src/testsuite/latency/latency.c
+++ xenomai/src/testsuite/latency/latency.c
@@ -34,6 +34,7 @@ int quiet = 0;          /* suppress prin
 int benchdev_no = 0;
 int benchdev = -1;
 int freeze_max = 0;
+int priority = T_HIPRIO;
 
 #define USER_TASK       0
 #define KERNEL_TASK     1
@@ -194,6 +195,7 @@ void display (void *cookie)
             config.mode = RTTST_TMBENCH_HANDLER;
 
         config.period               = period_ns;
+        config.priority             = priority;
         config.warmup_loops         = WARMUP_TIME;
         config.histogram_size       = (do_histogram || do_stats) ? histogram_size : 0;
         config.histogram_bucketsize = bucketsize;
@@ -424,7 +426,7 @@ int main (int argc, char **argv)
     char task_name[16];
     int cpu = 0;
 
-    while ((c = getopt(argc,argv,"hp:l:T:qH:B:sD:t:fc:")) != EOF)
+    while ((c = getopt(argc,argv,"hp:l:T:qH:B:sD:t:fc:P:")) != EOF)
         switch (c)
             {
             case 'h':
@@ -487,6 +489,10 @@ int main (int argc, char **argv)
                 cpu = T_CPU(atoi(optarg));
                 break;
 
+            case 'P':
+                priority = atoi(optarg);
+                break;
+
             default:
 
                 fprintf(stderr, "usage: latency [options]\n"
@@ -501,7 +507,8 @@ int main (int argc, char **argv)
                         "  [-D <testing_device_no>]     # number of testing device, default=0\n"
                         "  [-t <test_mode>]             # 0=user task (default), 1=kernel task, 2=timer IRQ\n"
                         "  [-f]                         # freeze trace for each new max latency\n"
-                        "  [-c <cpu>]                   # pin measuring task down to given CPU\n");
+                        "  [-c <cpu>]                   # pin measuring task down to given CPU\n"
+                        "  [-P <priority>]              # task priority (test mode 0 and 1 only)\n");
                 exit(2);
             }
 
@@ -529,6 +536,11 @@ int main (int argc, char **argv)
     if (period_ns == 0)
         period_ns = 100000LL; /* ns */
 
+    if (priority <= T_LOPRIO)
+        priority = T_LOPRIO + 1;
+    else if (priority > T_HIPRIO)
+        priority = T_HIPRIO;
+
     signal(SIGINT, sighand);
     signal(SIGTERM, sighand);
     signal(SIGHUP, sighand);
@@ -562,7 +574,7 @@ int main (int argc, char **argv)
     rt_timer_set_mode(TM_ONESHOT); /* Force aperiodic timing. */
 
     snprintf(task_name, sizeof(task_name), "display-%d", getpid());
-    err = rt_task_create(&display_task,task_name,0,98,T_FPU);
+    err = rt_task_create(&display_task,task_name,0,0,T_FPU);
 
     if (err)
         {
@@ -580,7 +592,7 @@ int main (int argc, char **argv)
 
     if (test_mode == USER_TASK) {
         snprintf(task_name, sizeof(task_name), "sampling-%d", getpid());
-        err = rt_task_create(&latency_task,task_name,0,99,T_FPU|cpu);
+        err = rt_task_create(&latency_task,task_name,0,priority,T_FPU|cpu);
 
         if (err)
             {

  reply	other threads:[~2006-06-28 19:38 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-26 17:21 [Xenomai-core] [PATCH 0/6] Various refactoring and new IRQ test jan.kiszka
2006-06-26 17:21 ` [Xenomai-core] [PATCH 1/6] Refactor tracer API jan.kiszka
2006-06-26 17:21 ` [Xenomai-core] [PATCH 2/6] Improve fault report jan.kiszka
2006-06-28  7:42   ` Philippe Gerum
2006-06-28  7:51     ` Jan Kiszka
2006-06-28  8:04       ` Philippe Gerum
2006-06-28  8:18         ` Jan Kiszka
2006-06-28  8:36           ` Philippe Gerum
2006-06-28  8:51             ` Jan Kiszka
2006-06-28  9:00               ` Philippe Gerum
2006-06-28  9:17                 ` Jan Kiszka
2006-06-28 16:36                   ` Philippe Gerum
2006-06-26 17:21 ` [Xenomai-core] [PATCH 3/6] Refactor rttesting device interface jan.kiszka
2006-06-26 17:21 ` [Xenomai-core] [PATCH 4/6] Add prio switch to latency test jan.kiszka
2006-06-28 19:38   ` Jan Kiszka [this message]
2006-06-26 17:21 ` [Xenomai-core] [PATCH 5/6] Overread dev-prefix on posix open jan.kiszka
2006-06-28 19:38   ` Jan Kiszka
2006-06-26 17:21 ` [Xenomai-core] [PATCH 6/6] Introduce IRQ latency benchmark jan.kiszka
2006-06-27 16:45   ` Jan Kiszka
2006-06-28 12:11   ` Gilles Chanteperdrix
2006-06-28 12:28     ` Jan Kiszka
2006-06-28 12:35       ` Gilles Chanteperdrix
2006-06-28 13:42       ` Gilles Chanteperdrix
2006-06-28 14:14         ` Dmitry Adamushko
2006-06-28 14:37           ` Jan Kiszka
2006-06-28 15:18             ` Dmitry Adamushko
2006-06-28 14:44         ` Jan Kiszka
2006-06-28 19:39   ` Jan Kiszka
2006-06-29 11:20     ` Jan Kiszka
2006-07-01 15:38       ` Philippe Gerum
2006-07-01 18:17         ` Jan Kiszka

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=44A2DABA.4050902@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=xenomai@xenomai.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.