August 2011
Intermediate to advanced
552 pages
23h 48m
English
D provides associative arrays that are similar to hashtables and dictionaries in other languages. The index into the array can be a n-tuple of values, separated by commas. arrayname[pid, probefunc, "bork"] = 23; is a valid assignment. The types of the array index must match for every assignment, and the assigned values must be uniform. You cannot nest arrays.
Example 9.9 calculates the wall-clock time it takes to execute the read() system call:
Example 9.9. readtime.d
syscall::read:entry { self->ts[pid, probefunc] = timestamp; } syscall::read:return /self->ts[pid, probefunc] != 0/ { delta = timestamp ...Read now
Unlock full access