Henk Vandenbergh
2008-Dec-08 16:43 UTC
[dtrace-discuss] Is there a way to clear Dtrace arrays?
I am using trunc(@agg,0) to clear an aggregation every ''n'' seconds. Is there a similar function to clear an associative array? I know I can deallocate memory for an individual element by setting is to zero, but I am looking for a way to clear ALL elements in an array. -- This message posted from opensolaris.org
Adam Leventhal
2008-Dec-08 16:57 UTC
[dtrace-discuss] Is there a way to clear Dtrace arrays?
On Dec 8, 2008, at 8:43 AM, Henk Vandenbergh wrote:> I am using trunc(@agg,0) to clear an aggregation every ''n'' seconds. > Is there a similar function to clear an associative array? I know I > can deallocate memory for an individual element by setting is to > zero, but I am looking for a way to clear ALL elements in an array.There''s not. Can you explain what you''re doing a bit so we can understand the use case for such a function? Adam -- Adam Leventhal, Fishworks http://blogs.sun.com/ahl
Henk Vandenbergh
2008-Dec-08 17:20 UTC
[dtrace-discuss] Is there a way to clear Dtrace arrays?
I am gathering numerous file-level statistics that I want to report (printf)
every ''n'' seconds, and then start all over again with a new
set of statistics. I currently accumulate each ''field'' in
several aggregations, one aggregation per field. Every n seconds I dump out the
aggregations and then clear them using trunc(@xxx,0).
Instead of having one aggregation per field, I would think it would be more
efficient if I create a struct{} with all the fields, and then store that struct
in one associative array. However, I can''t clear an array.
Henk.
--
This message posted from opensolaris.org
Henk Vandenbergh
2008-Dec-08 18:06 UTC
[dtrace-discuss] Is there a way to clear Dtrace arrays?
Ignore my request. Even if there was a way to clear an array, there is no function that allows me to print out that array. Only an aggregation does that. -- This message posted from opensolaris.org
Adam Leventhal
2008-Dec-10 08:02 UTC
[dtrace-discuss] Is there a way to clear Dtrace arrays?
> Ignore my request. Even if there was a way to clear an array, there > is no function that allows me to print out that array. Only an > aggregation does that.True, and I''d argue that an aggregation is probably the right data structure for what you''re doing. Adam -- Adam Leventhal, Fishworks http://blogs.sun.com/ahl