From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ravindra Kumar Meena Subject: Re: What is _prev_state in sched_switch? Date: Mon, 29 Jul 2019 14:37:20 +0530 Message-ID: References: <0e850b02-3fec-a335-3f37-8579ad1b704d@gydle.com> <18d63d8c-da2d-54c3-3a9a-1d77a5a3a675@gydle.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3804972026821716219==" Return-path: Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lists.lttng.org (Postfix) with ESMTPS id 45xv3g2wMBz16qR for ; Mon, 29 Jul 2019 05:07:59 -0400 (EDT) Received: by mail-wr1-x444.google.com with SMTP id r1so60933191wrl.7 for ; Mon, 29 Jul 2019 02:07:59 -0700 (PDT) In-Reply-To: <18d63d8c-da2d-54c3-3a9a-1d77a5a3a675@gydle.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lttng-dev-bounces@lists.lttng.org Sender: "lttng-dev" To: Sebastien Boisvert Cc: lttng-dev List-Id: lttng-dev@lists.lttng.org --===============3804972026821716219== Content-Type: multipart/alternative; boundary="00000000000066c27b058ece3aba" --00000000000066c27b058ece3aba Content-Type: text/plain; charset="UTF-8" > > > 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) , Dhanbad --00000000000066c27b058ece3aba Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
>=C2=A0 =C2=A0 =C2=A0On 2019-07-24 2:44 a.m., Ravindr= a Kumar Meena wrote:
>=C2=A0 =C2=A0 =C2=A0> Hi,
>=C2=A0 =C2=A0 =C2=A0>
>=C2=A0 =C2=A0 =C2=A0> I had a looked at TraceCompass example. I came= across sched_swithc event in present in the metadata.
>=C2=A0 =C2=A0 =C2=A0>
>=C2=A0 =C2=A0 =C2=A0> event {
>=C2=A0 =C2=A0 =C2=A0> name =3D "sched_switch";
>=C2=A0 =C2=A0 =C2=A0> id =3D 27;
>=C2=A0 =C2=A0 =C2=A0> stream_id =3D 0;
>=C2=A0 =C2=A0 =C2=A0> fields :=3D struct {
>=C2=A0 =C2=A0 =C2=A0> integer { size =3D 8; align =3D 8; signed =3D = 0; encoding =3D UTF8; base =3D 10; } _prev_comm[16];
>=C2=A0 =C2=A0 =C2=A0> integer { size =3D 32; align =3D 8; signed =3D= 1; encoding =3D none; base =3D 10; } _prev_tid;
>=C2=A0 =C2=A0 =C2=A0> integer { size =3D 32; align =3D 8; signed =3D= 1; encoding =3D none; base =3D 10; } _prev_prio;
>=C2=A0 =C2=A0 =C2=A0> integer { size =3D 64; align =3D 8; signed =3D= 1; encoding =3D none; base =3D 10; } _prev_state;
>=C2=A0 =C2=A0 =C2=A0> integer { size =3D 8; align =3D 8; signed =3D = 0; encoding =3D UTF8; base =3D 10; } _next_comm[16];
>=C2=A0 =C2=A0 =C2=A0> integer { size =3D 32; align =3D 8; signed =3D= 1; encoding =3D none; base =3D 10; } _next_tid;
>=C2=A0 =C2=A0 =C2=A0> integer { size =3D 32; align =3D 8; signed =3D= 1; encoding =3D none; base =3D 10; } _next_prio;
>=C2=A0 =C2=A0 =C2=A0> };
>=C2=A0 =C2=A0 =C2=A0> };
>=C2=A0 =C2=A0 =C2=A0>
>=C2=A0 =C2=A0 =C2=A0> 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= =3D52a6e82ac27288f591c750f201de5c3e6ef24385#n465


In lttng-modules, however, there is the field prev_state:

http://git.lttng.org/?p=3Dlttng-modules.git;a=3Dblob;f= =3Dinstrumentation/events/lttng-module/sched.h;h=3D77d77b2aeeddbe6ac34e2228= b077734721f45b18;hb=3D4ea9b7c98ade603b08f0d945f4d99bc079eb57b6#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 stil= l didn't get what is the meaning of {0, 1, 1026, 4096} values in _prev_= state.=C2=A0

In babeltrace output _prev_state have= { 0, 1, 1026, 4096 } values.


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 =3D 3 }, { prev_comm =3D "swappe= r/3", prev_tid =3D 0, prev_prio =3D 20, prev_state =3D 0, next_comm = =3D "kworker/u8:2", next_tid =3D 8363, next_prio =3D 20 }
[21:= 20:44.207252919] (+0.000000085) arnaud-desktop sched_switch: { cpu_id =3D 3= }, { prev_comm =3D "kworker/u8:2", prev_tid =3D 8363, prev_prio = =3D 20, prev_state =3D 1026, next_comm =3D "swapper/3", next_tid = =3D 0, next_prio =3D 20 }
[21:20:44.207253370] (+0.000000143) arnaud-des= ktop sched_switch: { cpu_id =3D 0 }, { prev_comm =3D "code", prev= _tid =3D 3876, prev_prio =3D 20, prev_state =3D 0, next_comm =3D "code= ", next_tid =3D 4140, next_prio =3D 20 }
[21:20:44.207257279] (+0.0= 00000656) arnaud-desktop sched_switch: { cpu_id =3D 3 }, { prev_comm =3D &q= uot;swapper/3", prev_tid =3D 0, prev_prio =3D 20, prev_state =3D 0, ne= xt_comm =3D "kworker/u8:2", next_tid =3D 8363, next_prio =3D 20 }=
[21:20:44.207258485] (+0.000000903) arnaud-desktop sched_switch: { cpu_= id =3D 3 }, { prev_comm =3D "kworker/u8:2", prev_tid =3D 8363, pr= ev_prio =3D 20, prev_state =3D 1026, next_comm =3D "swapper/3", n= ext_tid =3D 0, next_prio =3D 20 }
[21:20:44.207270164] (+0.000000081) ar= naud-desktop sched_switch: { cpu_id =3D 3 }, { prev_comm =3D "swapper/= 3", prev_tid =3D 0, prev_prio =3D 20, prev_state =3D 0, next_comm =3D = "kworker/u8:2", next_tid =3D 8363, next_prio =3D 20 }

P.S: This is not = a full babeltrace output.


--
Ravindra Kumar Meena,
B. Tech. Computer Science and Engineering,
--00000000000066c27b058ece3aba-- --===============3804972026821716219== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev --===============3804972026821716219==--