[LTP] [PATCH 5/6] sched_football: Add prctrl calls to set thread comms
John Stultz
jstultz@google.com
Wed Apr 24 00:58:02 CEST 2024
Make it easier to follow whats happening in traces by setting
the thread comms to be more descriptive.
Cc: kernel-team@android.com
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 7686ce3e6..45fbf6766 100644
--- a/testcases/realtime/func/sched_football/sched_football.c
+++ b/testcases/realtime/func/sched_football/sched_football.c
@@ -69,6 +69,7 @@
#include <errno.h>
#include <sys/syscall.h>
#include <unistd.h>
+#include <sys/prctl.h>
#include <sys/time.h>
#include <librttest.h>
@@ -126,6 +127,7 @@ unsigned long long ts_delta(struct timespec *start, struct timespec *stop)
/* 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);
atomic_inc(&players_ready);
/*occasionally wake up and run across the field */
while (1) {
@@ -146,6 +148,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);
atomic_inc(&players_ready);
/*keep the ball from being moved */
while (1) {
@@ -156,6 +159,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);
atomic_inc(&players_ready);
while (1) {
atomic_inc(&the_ball); /* move the ball ahead one yard */
@@ -168,6 +172,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.44.0.769.g3c40516874-goog
More information about the ltp
mailing list