18c2ecf20Sopenharmony_ci#!/bin/sh 28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0 38c2ecf20Sopenharmony_ci# description: event tracing - enable/disable with event level files 48c2ecf20Sopenharmony_ci# requires: set_event events/sched 58c2ecf20Sopenharmony_ci# flags: instance 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_cido_reset() { 88c2ecf20Sopenharmony_ci echo > set_event 98c2ecf20Sopenharmony_ci clear_trace 108c2ecf20Sopenharmony_ci} 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_cifail() { #msg 138c2ecf20Sopenharmony_ci echo $1 148c2ecf20Sopenharmony_ci exit_fail 158c2ecf20Sopenharmony_ci} 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ciecho 'sched:sched_switch' > set_event 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ciyield 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_cicount=`cat trace | grep sched_switch | wc -l` 228c2ecf20Sopenharmony_ciif [ $count -eq 0 ]; then 238c2ecf20Sopenharmony_ci fail "sched_switch events are not recorded" 248c2ecf20Sopenharmony_cifi 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_cido_reset 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ciecho 1 > events/sched/sched_switch/enable 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ciyield 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_cicount=`cat trace | grep sched_switch | wc -l` 338c2ecf20Sopenharmony_ciif [ $count -eq 0 ]; then 348c2ecf20Sopenharmony_ci fail "sched_switch events are not recorded" 358c2ecf20Sopenharmony_cifi 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cido_reset 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ciecho 0 > events/sched/sched_switch/enable 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ciyield 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_cicount=`cat trace | grep sched_switch | wc -l` 448c2ecf20Sopenharmony_ciif [ $count -ne 0 ]; then 458c2ecf20Sopenharmony_ci fail "sched_switch events should not be recorded" 468c2ecf20Sopenharmony_cifi 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ciexit 0 49