Skip to contentSkip to conversation

tracing/sched: Fix task states in sched switch event

PATCH Carsten Emde 3 participants 4 messages May 13, 2010 – May 25, 2010

lore
Share & tools
lore
#0 lore raw

Hi Ingo,

Quoted 1 line

Hm, this is totally unreadable. What does 'TASK_STATE_X' mean??

Would this be better?
+#define MAKE_TASK_STATE_STRING(num) TASK_STATE_##num " (" DESCR_TASK_STATE_##num ")"
static const char *task_state_array[] = {
- "R (running)", /* 0 */
- "S (sleeping)", /* 1 */
- "D (disk sleep)", /* 2 */
- "T (stopped)", /* 4 */
- "t (tracing stop)", /* 8 */
- "Z (zombie)", /* 16 */
- "X (dead)", /* 32 */
- "x (dead)", /* 64 */
- "K (wakekill)", /* 128 */
- "W (waking)", /* 256 */
+ MAKE_TASK_STATE_STRING(0),
+ MAKE_TASK_STATE_STRING(1),
+ MAKE_TASK_STATE_STRING(2),
+ MAKE_TASK_STATE_STRING(4),
+ MAKE_TASK_STATE_STRING(8),
+ MAKE_TASK_STATE_STRING(16),
+ MAKE_TASK_STATE_STRING(32),
+ MAKE_TASK_STATE_STRING(64),
+ MAKE_TASK_STATE_STRING(128),
+ MAKE_TASK_STATE_STRING(256)

Carsten.

#1 lore raw
Quoted 16 lines · Carsten Emde

Hi Ingo,

Quoted 1 line

Hm, this is totally unreadable. What does 'TASK_STATE_X' mean??

Would this be better?

(quoted diff) +1 -10
+#define MAKE_TASK_STATE_STRING(num) TASK_STATE_##num " (" DESCR_TASK_STATE_##num ")"
 static const char *task_state_array[] = {
-	"R (running)",		/*   0 */
-	"S (sleeping)",		/*   1 */
-	"D (disk sleep)",	/*   2 */
-	"T (stopped)",		/*   4 */
-	"t (tracing stop)",	/*   8 */
-	"Z (zombie)",		/*  16 */
-	"X (dead)",		/*  32 */
-	"x (dead)",		/*  64 */
-	"K (wakekill)",		/* 128 */
-	"W (waking)",		/* 256 */

Review

Quoted 10 lines
(quoted diff) +10 -0
+	MAKE_TASK_STATE_STRING(0),
+	MAKE_TASK_STATE_STRING(1),
+	MAKE_TASK_STATE_STRING(2),
+	MAKE_TASK_STATE_STRING(4),
+	MAKE_TASK_STATE_STRING(8),
+	MAKE_TASK_STATE_STRING(16),
+	MAKE_TASK_STATE_STRING(32),
+	MAKE_TASK_STATE_STRING(64),
+	MAKE_TASK_STATE_STRING(128),
+	MAKE_TASK_STATE_STRING(256)

The whole enumeration there is pointless in that .c file - it tells nothing to the code reader.

If it cannot be expressed in a meaningful way then introduce TASK_STATE_STRINGS_INIT construct that is defined next to the strings (in a .h file or so) - that way it's a coherent whole.

Thanks,

Ingo

#2 lore raw
Quoted 32 lines · Ingo Molnar
Quoted 16 lines · Carsten Emde

Hi Ingo,

Quoted 1 line

Hm, this is totally unreadable. What does 'TASK_STATE_X' mean??

Would this be better?

(quoted diff) +1 -10
+#define MAKE_TASK_STATE_STRING(num) TASK_STATE_##num " (" DESCR_TASK_STATE_##num ")"
 static const char *task_state_array[] = {
-	"R (running)",		/*   0 */
-	"S (sleeping)",		/*   1 */
-	"D (disk sleep)",	/*   2 */
-	"T (stopped)",		/*   4 */
-	"t (tracing stop)",	/*   8 */
-	"Z (zombie)",		/*  16 */
-	"X (dead)",		/*  32 */
-	"x (dead)",		/*  64 */
-	"K (wakekill)",		/* 128 */
-	"W (waking)",		/* 256 */

Review

Quoted 10 lines
(quoted diff) +10 -0
+	MAKE_TASK_STATE_STRING(0),
+	MAKE_TASK_STATE_STRING(1),
+	MAKE_TASK_STATE_STRING(2),
+	MAKE_TASK_STATE_STRING(4),
+	MAKE_TASK_STATE_STRING(8),
+	MAKE_TASK_STATE_STRING(16),
+	MAKE_TASK_STATE_STRING(32),
+	MAKE_TASK_STATE_STRING(64),
+	MAKE_TASK_STATE_STRING(128),
+	MAKE_TASK_STATE_STRING(256)

The whole enumeration there is pointless in that .c file - it tells nothing to the code reader.

Quoted 3 lines

If it cannot be expressed in a meaningful way then introduce TASK_STATE_STRINGS_INIT construct that is defined next to the strings (in a .h file or so) - that way it's a coherent whole.

I'm rebasing both pull requests. I'll leave this one out until there is an agreement.

Thanks,

-- Steve

#3 lore raw
In reply to Ingo Molnar

Hi Ingo,

Quoted 28 lines
Quoted 14 lines
Quoted 1 line

Hm, this is totally unreadable. What does 'TASK_STATE_X' mean??

Would this be better?

(quoted diff) +1 -10
+#define MAKE_TASK_STATE_STRING(num) TASK_STATE_##num " (" DESCR_TASK_STATE_##num ")"
  static const char *task_state_array[] = {
-	"R (running)",		/*   0 */
-	"S (sleeping)",		/*   1 */
-	"D (disk sleep)",	/*   2 */
-	"T (stopped)",		/*   4 */
-	"t (tracing stop)",	/*   8 */
-	"Z (zombie)",		/*  16 */
-	"X (dead)",		/*  32 */
-	"x (dead)",		/*  64 */
-	"K (wakekill)",		/* 128 */
-	"W (waking)",		/* 256 */

Review

Quoted 10 lines
(quoted diff) +10 -0
+	MAKE_TASK_STATE_STRING(0),
+	MAKE_TASK_STATE_STRING(1),
+	MAKE_TASK_STATE_STRING(2),
+	MAKE_TASK_STATE_STRING(4),
+	MAKE_TASK_STATE_STRING(8),
+	MAKE_TASK_STATE_STRING(16),
+	MAKE_TASK_STATE_STRING(32),
+	MAKE_TASK_STATE_STRING(64),
+	MAKE_TASK_STATE_STRING(128),
+	MAKE_TASK_STATE_STRING(256)

The whole enumeration there is pointless in that .c file - it tells nothing to the code reader.

Quoted 3 lines

If it cannot be expressed in a meaningful way then introduce TASK_STATE_STRINGS_INIT construct that is defined next to the strings (in a .h file or so) - that way it's a coherent whole.

This is what I did and submitted some time ago. Is there anything else you want me to change?

Thanks,

Carsten.