May 27, 2010

Dtrace: associative array example

Posted in Dtrace at 10:51 am by alessiodini

During my dtrace experiments , i used associative arrays.
Looking on web there are a lot of same examples on them , here i want write a different example for understand them:

#!/usr/sbin/dtrace -s
BEGIN
{
a[“test”] = 1;
b[“hello”] = 2;
c[“ale”] = 3;
printf(“\n%d\n”, a[“test”]);
exit(0);
}

The syntax is <array_name>[key1,key2,keyn] = value;
In previous example , with printing a[“test”] we’ll obtain 1 !

Advertisements

2 Comments »

  1. Durai selvan said,

    please send a me ur mail id


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: