public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: John Stultz via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Cc: kernel-team@android.com, John Stultz <jstultz@google.com>,
	Darren Hart <darren@os.amperecomputing.com>
Subject: [LTP] [PATCH v2 5/6] sched_football: Add prctrl calls to set thread comms
Date: Tue, 25 Jun 2024 16:52:34 -0700	[thread overview]
Message-ID: <20240625235245.2106313-6-jstultz@google.com> (raw)
In-Reply-To: <20240625235245.2106313-1-jstultz@google.com>

Make it easier to follow whats happening in traces by setting
the thread comms to be more descriptive.

Cc: kernel-team@android.com
Cc: Cyril Hrubis <chrubis@suse.cz>
Cc: Darren Hart <darren@os.amperecomputing.com>
Signed-off-by: John Stultz <jstultz@google.com>
---
 testcases/realtime/func/sched_football/sched_football.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/testcases/realtime/func/sched_football/sched_football.c b/testcases/realtime/func/sched_football/sched_football.c
index 9d12f0193..40496cc22 100644
--- a/testcases/realtime/func/sched_football/sched_football.c
+++ b/testcases/realtime/func/sched_football/sched_football.c
@@ -68,6 +68,7 @@
 #include <errno.h>
 #include <sys/syscall.h>
 #include <unistd.h>
+#include <sys/prctl.h>
 #include <sys/time.h>
 #include <librttest.h>
 #include <tst_atomic.h>
@@ -119,6 +120,7 @@ int parse_args(int c, char *v)
 /* These are fans running across the field. They're trying to interrupt/distract everyone */
 void *thread_fan(void *arg)
 {
+	prctl(PR_SET_NAME, "crazy_fan", 0, 0, 0);
 	tst_atomic_add_return(1, &players_ready);
 	/*occasionally wake up and run across the field */
 	while (1) {
@@ -142,6 +144,7 @@ void *thread_fan(void *arg)
 /* This is the defensive team. They're trying to block the offense */
 void *thread_defense(void *arg)
 {
+	prctl(PR_SET_NAME, "defense", 0, 0, 0);
 	tst_atomic_add_return(1, &players_ready);
 	/*keep the ball from being moved */
 	while (1) {
@@ -152,6 +155,7 @@ void *thread_defense(void *arg)
 /* This is the offensive team. They're trying to move the ball */
 void *thread_offense(void *arg)
 {
+	prctl(PR_SET_NAME, "offense", 0, 0, 0);
 	tst_atomic_add_return(1, &players_ready);
 	while (1) {
 		tst_atomic_add_return(1, &the_ball); /* move the ball ahead one yard */
@@ -164,6 +168,7 @@ int referee(int game_length)
 	struct timeval start, now;
 	int final_ball;
 
+	prctl(PR_SET_NAME, "referee", 0, 0, 0);
 	printf("Game On (%d seconds)!\n", game_length);
 
 	gettimeofday(&start, NULL);
-- 
2.45.2.741.gdbec12cfda-goog


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2024-06-25 23:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 23:52 [LTP] [PATCH v2 0/6] sched_football: Re-add crazy fans and other cleanups John Stultz via ltp
2024-06-25 23:52 ` [LTP] [PATCH v2 1/6] sched_football: Drop use of sched_yeild() John Stultz via ltp
2024-06-25 23:52 ` [LTP] [PATCH v2 2/6] sched_football: Use atomic operations for ball John Stultz via ltp
2024-06-25 23:52 ` [LTP] [PATCH v2 3/6] sched_football: Re-add the crazy fans to interrupt everyone John Stultz via ltp
2024-06-25 23:52 ` [LTP] [PATCH v2 4/6] sched_football: Add a sleep before the game begins to get into steady state John Stultz via ltp
2024-06-25 23:52 ` John Stultz via ltp [this message]
2024-06-25 23:52 ` [LTP] [PATCH v2 6/6] sched_football: Add trace_marker messages if we're tracing John Stultz via ltp
2024-06-26 11:49 ` [LTP] [PATCH v2 0/6] sched_football: Re-add crazy fans and other cleanups Cyril Hrubis

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=20240625235245.2106313-6-jstultz@google.com \
    --to=ltp@lists.linux.it \
    --cc=darren@os.amperecomputing.com \
    --cc=jstultz@google.com \
    --cc=kernel-team@android.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