This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
foreach interation over specified index values in multiple index arrays
- From: Mike Mason <mmlnx at us dot ibm dot com>
- To: systemtap at sources dot redhat dot com
- Date: Wed, 07 Mar 2007 08:40:34 -0800
- Subject: foreach interation over specified index values in multiple index arrays
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()
}