cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

toplevel-enable.tc (792B)


      1#!/bin/sh
      2# SPDX-License-Identifier: GPL-2.0
      3# description: event tracing - enable/disable with top level files
      4# requires: available_events set_event events/enable
      5
      6do_reset() {
      7    echo > set_event
      8    clear_trace
      9}
     10
     11fail() { #msg
     12    echo $1
     13    exit_fail
     14}
     15
     16echo '*:*' > set_event
     17
     18yield
     19
     20echo 0 > tracing_on
     21
     22count=`head -n 128 trace | grep -v ^# | wc -l`
     23if [ $count -eq 0 ]; then
     24    fail "none of events are recorded"
     25fi
     26
     27do_reset
     28
     29echo 1 > events/enable
     30echo 1 > tracing_on
     31
     32yield
     33
     34echo 0 > tracing_on
     35count=`head -n 128 trace | grep -v ^# | wc -l`
     36if [ $count -eq 0 ]; then
     37    fail "none of events are recorded"
     38fi
     39
     40do_reset
     41
     42echo 0 > events/enable
     43
     44yield
     45
     46count=`cat trace | grep -v ^# | wc -l`
     47if [ $count -ne 0 ]; then
     48    fail "any of events should not be recorded"
     49fi
     50
     51exit 0