* What is _prev_state in sched_switch? @ 2019-07-24 6:44 Ravindra Kumar Meena 2019-07-24 14:02 ` Sebastien Boisvert [not found] ` <0e850b02-3fec-a335-3f37-8579ad1b704d@gydle.com> 0 siblings, 2 replies; 8+ messages in thread From: Ravindra Kumar Meena @ 2019-07-24 6:44 UTC (permalink / raw) To: lttng-dev [-- Attachment #1.1: Type: text/plain, Size: 1161 bytes --] Hi, I had a looked at TraceCompass example. I came across sched_swithc event in present in the metadata. event { name = "sched_switch"; id = 27; stream_id = 0; fields := struct { integer { size = 8; align = 8; signed = 0; encoding = UTF8; base = 10; } _prev_comm[16]; integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _prev_tid; integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _prev_prio; integer { size = 64; align = 8; signed = 1; encoding = none; base = 10; } _prev_state; integer { size = 8; align = 8; signed = 0; encoding = UTF8; base = 10; } _next_comm[16]; integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _next_tid; integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _next_prio; }; }; All event.fields variables are clear to me but what does _prev_state do here? I had a looked at its babeltrace output but found no pattern in _prev_state value. Please attend this email ASAP. Thanks -- *Ravindra Kumar Meena*, B. Tech. Computer Science and Engineering, Indian Institute of Technology (Indian School of Mines) <https://www.iitism.ac.in/>, Dhanbad [-- Attachment #1.2: Type: text/html, Size: 1728 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: What is _prev_state in sched_switch? 2019-07-24 6:44 What is _prev_state in sched_switch? Ravindra Kumar Meena @ 2019-07-24 14:02 ` Sebastien Boisvert [not found] ` <0e850b02-3fec-a335-3f37-8579ad1b704d@gydle.com> 1 sibling, 0 replies; 8+ messages in thread From: Sebastien Boisvert @ 2019-07-24 14:02 UTC (permalink / raw) To: Ravindra Kumar Meena, lttng-dev On 2019-07-24 2:44 a.m., Ravindra Kumar Meena wrote: > Hi, > > I had a looked at TraceCompass example. I came across sched_swithc event in present in the metadata. > > event { > name = "sched_switch"; > id = 27; > stream_id = 0; > fields := struct { > integer { size = 8; align = 8; signed = 0; encoding = UTF8; base = 10; } _prev_comm[16]; > integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _prev_tid; > integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _prev_prio; > integer { size = 64; align = 8; signed = 1; encoding = none; base = 10; } _prev_state; > integer { size = 8; align = 8; signed = 0; encoding = UTF8; base = 10; } _next_comm[16]; > integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _next_tid; > integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _next_prio; > }; > }; > > All event.fields variables are clear to me but what does _prev_state do here? I had a looked at its babeltrace output but found no pattern in _prev_state value. > > Please attend this email ASAP. I think that writing "Please attend this email ASAP" is somehow rude. > > Thanks > > -- > *Ravindra Kumar Meena*, > B. Tech. Computer Science and Engineering, > Indian Institute of Technology (Indian School of Mines) <https://www.iitism.ac.in/>, Dhanbad > > _______________________________________________ > lttng-dev mailing list > lttng-dev@lists.lttng.org > https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <0e850b02-3fec-a335-3f37-8579ad1b704d@gydle.com>]
* Re: What is _prev_state in sched_switch? [not found] ` <0e850b02-3fec-a335-3f37-8579ad1b704d@gydle.com> @ 2019-07-24 14:09 ` Ravindra Kumar Meena [not found] ` <CAEWVvOSu4vbiDpMCCTHdP59xNaMsAJ74orA52amRaFfoN7jfXQ@mail.gmail.com> 1 sibling, 0 replies; 8+ messages in thread From: Ravindra Kumar Meena @ 2019-07-24 14:09 UTC (permalink / raw) To: Sebastien Boisvert; +Cc: lttng-dev [-- Attachment #1.1: Type: text/plain, Size: 1416 bytes --] On Wed, Jul 24, 2019, 7:33 PM Sebastien Boisvert <sboisvert@gydle.com> wrote: > > > On 2019-07-24 2:44 a.m., Ravindra Kumar Meena wrote: > > Hi, > > > > I had a looked at TraceCompass example. I came across sched_swithc event > in present in the metadata. > > > > event { > > name = "sched_switch"; > > id = 27; > > stream_id = 0; > > fields := struct { > > integer { size = 8; align = 8; signed = 0; encoding = UTF8; base = 10; } > _prev_comm[16]; > > integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; > } _prev_tid; > > integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; > } _prev_prio; > > integer { size = 64; align = 8; signed = 1; encoding = none; base = 10; > } _prev_state; > > integer { size = 8; align = 8; signed = 0; encoding = UTF8; base = 10; } > _next_comm[16]; > > integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; > } _next_tid; > > integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; > } _next_prio; > > }; > > }; > > > > All event.fields variables are clear to me but what does _prev_state do > here? I had a looked at its babeltrace output but found no pattern in > _prev_state value. > > > > Please attend this email ASAP. > > I think that writing "Please attend this email ASAP" is somehow rude. > Okay. Sorry for that. It won't happen again. I want to know what _prev_state means in sched_switch event. > [-- Attachment #1.2: Type: text/html, Size: 2083 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <CAEWVvOSu4vbiDpMCCTHdP59xNaMsAJ74orA52amRaFfoN7jfXQ@mail.gmail.com>]
* Re: What is _prev_state in sched_switch? [not found] ` <CAEWVvOSu4vbiDpMCCTHdP59xNaMsAJ74orA52amRaFfoN7jfXQ@mail.gmail.com> @ 2019-07-24 14:30 ` Sebastien Boisvert [not found] ` <18d63d8c-da2d-54c3-3a9a-1d77a5a3a675@gydle.com> 1 sibling, 0 replies; 8+ messages in thread From: Sebastien Boisvert @ 2019-07-24 14:30 UTC (permalink / raw) To: Ravindra Kumar Meena; +Cc: lttng-dev Hello Ravindra, On 2019-07-24 10:09 a.m., Ravindra Kumar Meena wrote: > > > On Wed, Jul 24, 2019, 7:33 PM Sebastien Boisvert <sboisvert@gydle.com <mailto:sboisvert@gydle.com>> wrote: > > > > On 2019-07-24 2:44 a.m., Ravindra Kumar Meena wrote: > > Hi, > > > > I had a looked at TraceCompass example. I came across sched_swithc event in present in the metadata. > > > > event { > > name = "sched_switch"; > > id = 27; > > stream_id = 0; > > fields := struct { > > integer { size = 8; align = 8; signed = 0; encoding = UTF8; base = 10; } _prev_comm[16]; > > integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _prev_tid; > > integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _prev_prio; > > integer { size = 64; align = 8; signed = 1; encoding = none; base = 10; } _prev_state; > > integer { size = 8; align = 8; signed = 0; encoding = UTF8; base = 10; } _next_comm[16]; > > integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _next_tid; > > integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _next_prio; > > }; > > }; > > > > All event.fields variables are clear to me but what does _prev_state do here? I had a looked at its babeltrace output but found no pattern in _prev_state value. > > > > Please attend this email ASAP. > > I think that writing "Please attend this email ASAP" is somehow rude. > > Okay. Sorry for that. It won't happen again. > > I want to know what _prev_state means in sched_switch event. > In the Linux kernel, the tracepoint for sched_switch does not have the field prev_state: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/tracepoint.h?id=52a6e82ac27288f591c750f201de5c3e6ef24385#n465 In lttng-modules, however, there is the field prev_state: http://git.lttng.org/?p=lttng-modules.git;a=blob;f=instrumentation/events/lttng-module/sched.h;h=77d77b2aeeddbe6ac34e2228b077734721f45b18;hb=4ea9b7c98ade603b08f0d945f4d99bc079eb57b6#l237 My guess would be that prev_state is the previous state of the thread (TID): in "man ps": PROCESS STATE CODES Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") will display to describe the state of a process: D uninterruptible sleep (usually IO) R running or runnable (on run queue) S interruptible sleep (waiting for an event to complete) T stopped by job control signal t stopped by debugger during the tracing W paging (not valid since the 2.6.xx kernel) X dead (should never be seen) Z defunct ("zombie") process, terminated but not reaped by its parent In the Linux kernel: $ grep "#define TASK_" include/linux/sched.h #define TASK_RUNNING 0x0000 #define TASK_INTERRUPTIBLE 0x0001 #define TASK_UNINTERRUPTIBLE 0x0002 #define TASK_PARKED 0x0040 #define TASK_DEAD 0x0080 #define TASK_WAKEKILL 0x0100 #define TASK_WAKING 0x0200 #define TASK_NOLOAD 0x0400 #define TASK_NEW 0x0800 #define TASK_STATE_MAX 0x1000 #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) #define TASK_STOPPED (TASK_WAKEKILL | __TASK_STOPPED) #define TASK_TRACED (TASK_WAKEKILL | __TASK_TRACED) #define TASK_IDLE (TASK_UNINTERRUPTIBLE | TASK_NOLOAD) #define TASK_NORMAL (TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE) #define TASK_REPORT (TASK_RUNNING | TASK_INTERRUPTIBLE | \ _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <18d63d8c-da2d-54c3-3a9a-1d77a5a3a675@gydle.com>]
* Re: What is _prev_state in sched_switch? [not found] ` <18d63d8c-da2d-54c3-3a9a-1d77a5a3a675@gydle.com> @ 2019-07-29 9:07 ` Ravindra Kumar Meena [not found] ` <CAEWVvORgCQW8ScJZctu7dzT3QaO0PY50qmR-Aov9YHV1GkB+JQ@mail.gmail.com> 1 sibling, 0 replies; 8+ messages in thread From: Ravindra Kumar Meena @ 2019-07-29 9:07 UTC (permalink / raw) To: Sebastien Boisvert; +Cc: lttng-dev [-- Attachment #1.1: Type: text/plain, Size: 3778 bytes --] > > > On 2019-07-24 2:44 a.m., Ravindra Kumar Meena wrote: > > > Hi, > > > > > > I had a looked at TraceCompass example. I came across sched_swithc > event in present in the metadata. > > > > > > event { > > > name = "sched_switch"; > > > id = 27; > > > stream_id = 0; > > > fields := struct { > > > integer { size = 8; align = 8; signed = 0; encoding = UTF8; base = > 10; } _prev_comm[16]; > > > integer { size = 32; align = 8; signed = 1; encoding = none; base > = 10; } _prev_tid; > > > integer { size = 32; align = 8; signed = 1; encoding = none; base > = 10; } _prev_prio; > > > integer { size = 64; align = 8; signed = 1; encoding = none; base > = 10; } _prev_state; > > > integer { size = 8; align = 8; signed = 0; encoding = UTF8; base = > 10; } _next_comm[16]; > > > integer { size = 32; align = 8; signed = 1; encoding = none; base > = 10; } _next_tid; > > > integer { size = 32; align = 8; signed = 1; encoding = none; base > = 10; } _next_prio; > > > }; > > > }; > > > > > > All event.fields variables are clear to me but what does > _prev_state do here? I had a looked at its babeltrace output but found no > pattern in _prev_state value. > > In the Linux kernel, the tracepoint for sched_switch does not have the > field prev_state: > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/tracepoint.h?id=52a6e82ac27288f591c750f201de5c3e6ef24385#n465 > > > In lttng-modules, however, there is the field prev_state: > > > http://git.lttng.org/?p=lttng-modules.git;a=blob;f=instrumentation/events/lttng-module/sched.h;h=77d77b2aeeddbe6ac34e2228b077734721f45b18;hb=4ea9b7c98ade603b08f0d945f4d99bc079eb57b6#l237 > > > My guess would be that prev_state is the previous state of the thread > (TID): > Okay. The above link was somewhat helpful but I still didn't get what is the meaning of {0, 1, 1026, 4096} values in _prev_state. In babeltrace output _prev_state have { 0, 1, 1026, 4096 } values. The example can be found here https://github.com/tuxology/tracevizlab/blob/master/labs/TraceCompassTutorialTraces.tgz At folder "102-tracing-wget-critical-path/wget-first-call" babeltrace gives following output. babeltrace . | grep sched_switch [21:20:44.207247650] (+0.000000799) arnaud-desktop sched_switch: { cpu_id = 3 }, { prev_comm = "swapper/3", prev_tid = 0, prev_prio = 20, prev_state = 0, next_comm = "kworker/u8:2", next_tid = 8363, next_prio = 20 } [21:20:44.207252919] (+0.000000085) arnaud-desktop sched_switch: { cpu_id = 3 }, { prev_comm = "kworker/u8:2", prev_tid = 8363, prev_prio = 20, prev_state = 1026, next_comm = "swapper/3", next_tid = 0, next_prio = 20 } [21:20:44.207253370] (+0.000000143) arnaud-desktop sched_switch: { cpu_id = 0 }, { prev_comm = "code", prev_tid = 3876, prev_prio = 20, prev_state = 0, next_comm = "code", next_tid = 4140, next_prio = 20 } [21:20:44.207257279] (+0.000000656) arnaud-desktop sched_switch: { cpu_id = 3 }, { prev_comm = "swapper/3", prev_tid = 0, prev_prio = 20, prev_state = 0, next_comm = "kworker/u8:2", next_tid = 8363, next_prio = 20 } [21:20:44.207258485] (+0.000000903) arnaud-desktop sched_switch: { cpu_id = 3 }, { prev_comm = "kworker/u8:2", prev_tid = 8363, prev_prio = 20, prev_state = 1026, next_comm = "swapper/3", next_tid = 0, next_prio = 20 } [21:20:44.207270164] (+0.000000081) arnaud-desktop sched_switch: { cpu_id = 3 }, { prev_comm = "swapper/3", prev_tid = 0, prev_prio = 20, prev_state = 0, next_comm = "kworker/u8:2", next_tid = 8363, next_prio = 20 } P.S: This is not a full babeltrace output. -- *Ravindra Kumar Meena*, B. Tech. Computer Science and Engineering, Indian Institute of Technology (Indian School of Mines) <https://www.iitism.ac.in/>, Dhanbad [-- Attachment #1.2: Type: text/html, Size: 5428 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <CAEWVvORgCQW8ScJZctu7dzT3QaO0PY50qmR-Aov9YHV1GkB+JQ@mail.gmail.com>]
[parent not found: <CAAS9doZ1AjBiVCPOZUPBZYVZ11hRohP5g9pmAU+pPU=EQo120Q@mail.gmail.com>]
* Re: What is _prev_state in sched_switch? [not found] ` <CAAS9doZ1AjBiVCPOZUPBZYVZ11hRohP5g9pmAU+pPU=EQo120Q@mail.gmail.com> @ 2019-07-29 9:53 ` Christophe Bédard 0 siblings, 0 replies; 8+ messages in thread From: Christophe Bédard @ 2019-07-29 9:53 UTC (permalink / raw) Cc: lttng-dev [-- Attachment #1.1: Type: text/plain, Size: 1692 bytes --] Hi, Re-sending since I previously used an email address not subscribed to the ML. On Mon, 29 Jul 2019 at 11:08, Ravindra Kumar Meena <rmeena840@gmail.com> wrote: > Okay. The above link was somewhat helpful but I still didn't get what is > the meaning of {0, 1, 1026, 4096} values in _prev_state. > > In babeltrace output _prev_state have { 0, 1, 1026, 4096 } values. > > I think the answer to your question was in Sebastien's email. $ grep "#define TASK_" include/linux/sched.h > #define TASK_RUNNING 0x0000 > #define TASK_INTERRUPTIBLE 0x0001 > #define TASK_UNINTERRUPTIBLE 0x0002 > #define TASK_PARKED 0x0040 > #define TASK_DEAD 0x0080 > #define TASK_WAKEKILL 0x0100 > #define TASK_WAKING 0x0200 > #define TASK_NOLOAD 0x0400 > #define TASK_NEW 0x0800 > #define TASK_STATE_MAX 0x1000 > #define TASK_KILLABLE (TASK_WAKEKILL | > TASK_UNINTERRUPTIBLE) > #define TASK_STOPPED (TASK_WAKEKILL | __TASK_STOPPED) > #define TASK_TRACED (TASK_WAKEKILL | __TASK_TRACED) > #define TASK_IDLE (TASK_UNINTERRUPTIBLE | > TASK_NOLOAD) > #define TASK_NORMAL (TASK_INTERRUPTIBLE | > TASK_UNINTERRUPTIBLE) > #define TASK_REPORT (TASK_RUNNING | TASK_INTERRUPTIBLE > | \ > States can be combined (OR'd). 1026 in decimal is 0x402 which is 0x400 | 0x002. That is TASK_NOLOAD | TASK_UNINTERRUPTIBLE, or, as defined above, it's simply TASK_IDLE. I'm not sure what other answer you're expecting. Christophe [-- Attachment #1.2: Type: text/html, Size: 3006 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: What is _prev_state in sched_switch? [not found] ` <CAEWVvORgCQW8ScJZctu7dzT3QaO0PY50qmR-Aov9YHV1GkB+JQ@mail.gmail.com> [not found] ` <CAAS9doZ1AjBiVCPOZUPBZYVZ11hRohP5g9pmAU+pPU=EQo120Q@mail.gmail.com> @ 2019-07-29 15:08 ` Sebastien Boisvert [not found] ` <aa931b19-0a14-8659-aa9a-13e7f6523465@gydle.com> 2 siblings, 0 replies; 8+ messages in thread From: Sebastien Boisvert @ 2019-07-29 15:08 UTC (permalink / raw) To: Ravindra Kumar Meena; +Cc: lttng-dev On 2019-07-29 5:07 a.m., Ravindra Kumar Meena wrote: > Okay. The above link was somewhat helpful but I still didn't get what is the meaning of {0, 1, 1026, 4096} values in _prev_state. > Christophe explained, the values of _prev_state. In addition, I suggest you read those links (from general to specific): - https://en.wikipedia.org/wiki/Finite-state_machine - https://en.wikipedia.org/wiki/Scheduling_(computing) - https://www.kernel.org/doc/Documentation/scheduler/sched-design-CFS.txt _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <aa931b19-0a14-8659-aa9a-13e7f6523465@gydle.com>]
* Re: What is _prev_state in sched_switch? [not found] ` <aa931b19-0a14-8659-aa9a-13e7f6523465@gydle.com> @ 2019-07-31 6:48 ` Ravindra Kumar Meena 0 siblings, 0 replies; 8+ messages in thread From: Ravindra Kumar Meena @ 2019-07-31 6:48 UTC (permalink / raw) To: Sebastien Boisvert; +Cc: lttng-dev [-- Attachment #1.1: Type: text/plain, Size: 567 bytes --] > > Christophe explained, the values of _prev_state. > > In addition, I suggest you read those links (from general to specific): > > - https://en.wikipedia.org/wiki/Finite-state_machine > - https://en.wikipedia.org/wiki/Scheduling_(computing) > - https://www.kernel.org/doc/Documentation/scheduler/sched-design-CFS.txt Thanks, Christophe and Sebastien for helping me out. This resolved the problem. -- *Ravindra Kumar Meena*, B. Tech. Computer Science and Engineering, Indian Institute of Technology (Indian School of Mines) <https://www.iitism.ac.in/>, Dhanbad [-- Attachment #1.2: Type: text/html, Size: 1436 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-07-31 6:49 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-07-24 6:44 What is _prev_state in sched_switch? Ravindra Kumar Meena 2019-07-24 14:02 ` Sebastien Boisvert [not found] ` <0e850b02-3fec-a335-3f37-8579ad1b704d@gydle.com> 2019-07-24 14:09 ` Ravindra Kumar Meena [not found] ` <CAEWVvOSu4vbiDpMCCTHdP59xNaMsAJ74orA52amRaFfoN7jfXQ@mail.gmail.com> 2019-07-24 14:30 ` Sebastien Boisvert [not found] ` <18d63d8c-da2d-54c3-3a9a-1d77a5a3a675@gydle.com> 2019-07-29 9:07 ` Ravindra Kumar Meena [not found] ` <CAEWVvORgCQW8ScJZctu7dzT3QaO0PY50qmR-Aov9YHV1GkB+JQ@mail.gmail.com> [not found] ` <CAAS9doZ1AjBiVCPOZUPBZYVZ11hRohP5g9pmAU+pPU=EQo120Q@mail.gmail.com> 2019-07-29 9:53 ` Christophe Bédard 2019-07-29 15:08 ` Sebastien Boisvert [not found] ` <aa931b19-0a14-8659-aa9a-13e7f6523465@gydle.com> 2019-07-31 6:48 ` Ravindra Kumar Meena
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).