1*a1ca2389SMasami Hiramatsu (Google)#!/bin/sh 2*a1ca2389SMasami Hiramatsu (Google)# SPDX-License-Identifier: GPL-2.0 3*a1ca2389SMasami Hiramatsu (Google)# description: Generic dynamic event - enable/disable tracepoint probe events 4*a1ca2389SMasami Hiramatsu (Google)# requires: dynamic_events "t[:[<group>/][<event>]] <tracepoint> [<args>]":README 5*a1ca2389SMasami Hiramatsu (Google) 6*a1ca2389SMasami Hiramatsu (Google)echo 0 > events/enable 7*a1ca2389SMasami Hiramatsu (Google)echo > dynamic_events 8*a1ca2389SMasami Hiramatsu (Google) 9*a1ca2389SMasami Hiramatsu (Google)TRACEPOINT=sched_switch 10*a1ca2389SMasami Hiramatsu (Google)ENABLEFILE=events/tracepoints/myprobe/enable 11*a1ca2389SMasami Hiramatsu (Google) 12*a1ca2389SMasami Hiramatsu (Google):;: "Add tracepoint event on $TRACEPOINT" ;: 13*a1ca2389SMasami Hiramatsu (Google) 14*a1ca2389SMasami Hiramatsu (Google)echo "t:myprobe ${TRACEPOINT}" >> dynamic_events 15*a1ca2389SMasami Hiramatsu (Google) 16*a1ca2389SMasami Hiramatsu (Google):;: "Check enable/disable to ensure it works" ;: 17*a1ca2389SMasami Hiramatsu (Google) 18*a1ca2389SMasami Hiramatsu (Google)echo 1 > $ENABLEFILE 19*a1ca2389SMasami Hiramatsu (Google) 20*a1ca2389SMasami Hiramatsu (Google)grep -q $TRACEPOINT trace 21*a1ca2389SMasami Hiramatsu (Google) 22*a1ca2389SMasami Hiramatsu (Google)echo 0 > $ENABLEFILE 23*a1ca2389SMasami Hiramatsu (Google) 24*a1ca2389SMasami Hiramatsu (Google)echo > trace 25*a1ca2389SMasami Hiramatsu (Google) 26*a1ca2389SMasami Hiramatsu (Google)! grep -q $TRACEPOINT trace 27*a1ca2389SMasami Hiramatsu (Google) 28*a1ca2389SMasami Hiramatsu (Google):;: "Repeat enable/disable to ensure it works" ;: 29*a1ca2389SMasami Hiramatsu (Google) 30*a1ca2389SMasami Hiramatsu (Google)echo 1 > $ENABLEFILE 31*a1ca2389SMasami Hiramatsu (Google) 32*a1ca2389SMasami Hiramatsu (Google)grep -q $TRACEPOINT trace 33*a1ca2389SMasami Hiramatsu (Google) 34*a1ca2389SMasami Hiramatsu (Google)echo 0 > $ENABLEFILE 35*a1ca2389SMasami Hiramatsu (Google) 36*a1ca2389SMasami Hiramatsu (Google)echo > trace 37*a1ca2389SMasami Hiramatsu (Google) 38*a1ca2389SMasami Hiramatsu (Google)! grep -q $TRACEPOINT trace 39*a1ca2389SMasami Hiramatsu (Google) 40*a1ca2389SMasami Hiramatsu (Google)exit 0 41