From: Kurt Kanzenbach <kurt@linutronix.de>
To: John Kacur <jkacur@redhat.com>, Clark Williams <williams@redhat.com>
Cc: rt-users <linux-rt-users@vger.kernel.org>,
Kurt Kanzenbach <kurt@linutronix.de>
Subject: [PATCH 3/6] rt-tests: deadline: Remove duplicated gettid() code
Date: Tue, 18 Jun 2019 12:38:38 +0200 [thread overview]
Message-ID: <20190618103841.27249-4-kurt@linutronix.de> (raw)
In-Reply-To: <20190618103841.27249-1-kurt@linutronix.de>
gettid() is already implemented in the library code. Use that code instead.
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
src/sched_deadline/cyclicdeadline.c | 6 ++----
src/sched_deadline/deadline_test.c | 6 ++----
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
index 2b83665cab66..17786db45612 100644
--- a/src/sched_deadline/cyclicdeadline.c
+++ b/src/sched_deadline/cyclicdeadline.c
@@ -33,8 +33,6 @@
#define CPUSET_ALL "my_cpuset_all"
#define CPUSET_LOCAL "my_cpuset"
-#define gettid() syscall(__NR_gettid)
-
typedef unsigned long long u64;
typedef unsigned int u32;
typedef int s32;
@@ -755,7 +753,7 @@ void *run_deadline(void *data)
attr.sched_runtime = sd->runtime_us * 1000;
attr.sched_deadline = sd->deadline_us * 1000;
- printf("thread[%ld] runtime=%lldus deadline=%lldus\n",
+ printf("thread[%d] runtime=%lldus deadline=%lldus\n",
gettid(), sd->runtime_us, sd->deadline_us);
pthread_barrier_wait(&barrier);
@@ -1195,7 +1193,7 @@ int main (int argc, char **argv)
system("cat /sys/fs/cgroup/cpuset/my_cpuset/tasks");
}
- printf("main thread %ld\n", gettid());
+ printf("main thread %d\n", gettid());
pthread_barrier_wait(&barrier);
printf("fail 2 %d\n", fail);
diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
index c3b9dceb5209..e2898de328bb 100644
--- a/src/sched_deadline/deadline_test.c
+++ b/src/sched_deadline/deadline_test.c
@@ -51,6 +51,7 @@
#include <linux/unistd.h>
#include <linux/magic.h>
+#include <rt-utils.h>
#include <rt-sched.h>
/**
@@ -103,9 +104,6 @@ static void usage(char **argv)
#define CPUSET_ALL "my_cpuset_all"
#define CPUSET_LOCAL "my_cpuset"
-/* Define the system call interfaces */
-#define gettid() syscall(__NR_gettid)
-
typedef unsigned long long u64;
typedef unsigned int u32;
typedef int s32;
@@ -1267,7 +1265,7 @@ void *run_deadline(void *data)
attr.sched_runtime = sched_data->runtime_us * 1000;
attr.sched_deadline = sched_data->deadline_us * 1000;
- printf("thread[%ld] runtime=%lldus deadline=%lldus loops=%lld\n",
+ printf("thread[%d] runtime=%lldus deadline=%lldus loops=%lld\n",
gettid(), sched_data->runtime_us,
sched_data->deadline_us, sched_data->loops_per_period);
--
2.11.0
next prev parent reply other threads:[~2019-06-18 10:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-18 10:38 [PATCH 0/6] rt-tests: deadline: Cleanups Kurt Kanzenbach
2019-06-18 10:38 ` [PATCH 1/6] rt-tests: deadline: Remove duplicated code for sched_{set,get}_attr Kurt Kanzenbach
2019-06-19 15:46 ` John Kacur
2019-06-18 10:38 ` [PATCH 2/6] rt-tests: cyclicdeadline: Remove unused getcpu code Kurt Kanzenbach
2019-06-19 15:46 ` John Kacur
2019-06-18 10:38 ` Kurt Kanzenbach [this message]
2019-06-19 15:48 ` [PATCH 3/6] rt-tests: deadline: Remove duplicated gettid() code John Kacur
2019-06-24 13:40 ` Sebastian Andrzej Siewior
2019-06-25 9:29 ` John Kacur
2019-06-25 13:52 ` Sebastian Andrzej Siewior
2019-06-18 10:38 ` [PATCH 4/6] rt-tests: cyclicdeadline: Add options to usage Kurt Kanzenbach
2019-06-19 15:48 ` John Kacur
2019-06-18 10:38 ` [PATCH 5/6] rt-tests: cyclicdeadline: Print fail only if something failed Kurt Kanzenbach
2019-06-19 15:49 ` John Kacur
2019-06-18 10:38 ` [PATCH 6/6] rt-tests: cyclicdeadline: Fix cgroup setup Kurt Kanzenbach
2019-06-19 15:49 ` 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=20190618103841.27249-4-kurt@linutronix.de \
--to=kurt@linutronix.de \
--cc=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).