1cbcd9c83STom Zanussi#!/bin/sh 2cbcd9c83STom Zanussi# SPDX-License-Identifier: GPL-2.0 3cbcd9c83STom Zanussi# description: event trigger - test inter-event histogram trigger trace action with dynamic string param 4*145036f8SNaveen N Rao# requires: set_event synthetic_events events/sched/sched_process_exec/hist "' >> synthetic_events":README ping:program 5cbcd9c83STom Zanussi 6cbcd9c83STom Zanussifail() { #msg 7cbcd9c83STom Zanussi echo $1 8cbcd9c83STom Zanussi exit_fail 9cbcd9c83STom Zanussi} 10cbcd9c83STom Zanussi 11cbcd9c83STom Zanussiecho "Test create synthetic event" 12cbcd9c83STom Zanussi 13cbcd9c83STom Zanussiecho 'ping_test_latency u64 lat; char filename[]' > synthetic_events 14cbcd9c83STom Zanussiif [ ! -d events/synthetic/ping_test_latency ]; then 15cbcd9c83STom Zanussi fail "Failed to create ping_test_latency synthetic event" 16cbcd9c83STom Zanussifi 17cbcd9c83STom Zanussi 18cbcd9c83STom Zanussiecho "Test create histogram for synthetic event using trace action and dynamic strings" 19cbcd9c83STom Zanussiecho "Test histogram dynamic string variables,simple expression support and trace action" 20cbcd9c83STom Zanussi 21cbcd9c83STom Zanussiecho 'hist:key=pid:filenamevar=filename:ts0=common_timestamp.usecs' > events/sched/sched_process_exec/trigger 22cbcd9c83STom Zanussiecho 'hist:key=pid:lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_process_exec).ping_test_latency($lat,$filenamevar) if comm == "ping"' > events/sched/sched_process_exit/trigger 23cbcd9c83STom Zanussiecho 'hist:keys=filename,lat:sort=filename,lat' > events/synthetic/ping_test_latency/trigger 24cbcd9c83STom Zanussi 25cbcd9c83STom Zanussiping $LOCALHOST -c 5 26cbcd9c83STom Zanussi 27cbcd9c83STom Zanussiif ! grep -q "ping" events/synthetic/ping_test_latency/hist; then 28cbcd9c83STom Zanussi fail "Failed to create dynamic string trace action inter-event histogram" 29cbcd9c83STom Zanussifi 30cbcd9c83STom Zanussi 31cbcd9c83STom Zanussiexit 0 32