1*41522f74SNamhyung Kim /* SPDX-License-Identifier: GPL-2.0 */ 2*41522f74SNamhyung Kim #include <stdlib.h> 3*41522f74SNamhyung Kim #include <linux/compiler.h> 4*41522f74SNamhyung Kim #include "../tests.h" 5*41522f74SNamhyung Kim 6*41522f74SNamhyung Kim /* We want to check these symbols in perf script */ 7*41522f74SNamhyung Kim noinline void leaf(volatile int b); 8*41522f74SNamhyung Kim noinline void parent(volatile int b); 9*41522f74SNamhyung Kim 10*41522f74SNamhyung Kim static volatile int a; 11*41522f74SNamhyung Kim 12*41522f74SNamhyung Kim noinline void leaf(volatile int b) 13*41522f74SNamhyung Kim { 14*41522f74SNamhyung Kim for (;;) 15*41522f74SNamhyung Kim a += b; 16*41522f74SNamhyung Kim } 17*41522f74SNamhyung Kim 18*41522f74SNamhyung Kim noinline void parent(volatile int b) 19*41522f74SNamhyung Kim { 20*41522f74SNamhyung Kim leaf(b); 21*41522f74SNamhyung Kim } 22*41522f74SNamhyung Kim 23*41522f74SNamhyung Kim static int leafloop(int argc, const char **argv) 24*41522f74SNamhyung Kim { 25*41522f74SNamhyung Kim int c = 1; 26*41522f74SNamhyung Kim 27*41522f74SNamhyung Kim if (argc > 0) 28*41522f74SNamhyung Kim c = atoi(argv[0]); 29*41522f74SNamhyung Kim 30*41522f74SNamhyung Kim parent(c); 31*41522f74SNamhyung Kim return 0; 32*41522f74SNamhyung Kim } 33*41522f74SNamhyung Kim 34*41522f74SNamhyung Kim DEFINE_WORKLOAD(leafloop); 35