Chapter 7. Associative arrays
Associative arrays are implemented as hash tables with a maximum size set at startup. Associative arrays are too large to be created dynamically for individual probe handler runs, so they must be declared as global. The basic operations for arrays are setting and looking up elements. These operations are expressed in awk syntax: the array name followed by an opening bracket ([), a comma-separated list of up to five index index expressions, and a closing bracket (]). Each index expression may be a string or a number, as long as it is consistently typed throughout the script.
7.1. Examples
# Increment the named array slot: foo [4,"hello"] ++ # Update a statistic: processusage [uid(),execname()] ++ # Set a timestamp reference point: times [tid()] = get_cycles() # Compute a timestamp delta: delta = get_cycles() - times [tid()]