foreach interation over specified index values in multiple index arrays
Mike Mason
mmlnx@us.ibm.com
Wed Mar 7 16:41:00 GMT 2007
I have an array with two indexes. I'd like to use foreach to iterate over part of the array by specifying the first index value and iterating over the second index (see example below). Is there a way to do this? Nothing I've tried works.
Thanks,
Mike
global arr
probe begin
{
arr[0,0] = "00"
arr[0,1] = "01"
arr[0,2] = "02"
arr[1,0] = "10"
arr[1,1] = "11"
arr[1,2] = "12"
arr[3,0] = "30"
arr[3,1] = "31"
arr[3,2] = "32"
// stap doesn't like the 3 in foreach
foreach ([3, idx2] in arr) {
printf("%s\n", arr[3, idx2])
}
exit()
}
More information about the Systemtap
mailing list