1#!/bin/bash 2# This script generates large function intended to 3# cause as many iTLB misses as possible. 4 5# Number of instructions: 6# 4k - page size 7# x 64 - supposed number of TLB entires 8# x 2 - executing a function sized page_size * tlb_entry_count multiple 9# times would cause tlb misses only on the first call and tlb entries 10# would be valid for each next call. Doubling the size of the function 11# guarantees invalidating tlb entires and thus causing tlb misses. 12 13echo "void iTLB_bechmark_function() {" 14echo " int a = 0, b = 0;" 15 16for (( c=0; c < (1 << 18) ; c++ )) ; do 17 echo " a = b + 1;" 18 echo " b = a + 1;" 19done 20 21echo "}" 22