[ns] how to reduce processing cost of an awk script ... or a
Thu, 14 Dec 2000 10:01:16 +0800 (HKT)
On Wed, 13 Dec 2000, ¸ÀÀÖ´Â¿ìÀ¯ wrote:
> I am trying to calculate total packet delay(ms) and drop rate(%) of 5
> flows on a link using awk script...since the size of the tracefile is
> enormous, I have filtered it to print only lines with ($1 == d || $1 ==
> My problem is that, despite the filtering, a memory allocation error
> occurs when I run awk script:
> awk -f NCmyawkscript out_scenario1.tr > result1
> awk: NCmyawkscript:12: (FILENAME=out_scenario1.tr
> FNR=890944) fatal: newnode: nextfree: can't allocate memory
> As it is quite impossible to make the tracefile any shorter, I think I
> should modify my awk script (i.e. to reduce processing cost) but I can't
> figure out any other methods to compute delay and drop rate than the
> ones I have already used(shown below)..could anyone plz help me out on
> this? (it suddenly occurs to me that it might even be a totally
> different problem from memory shortage)
> I would appreciate your help very much..thanks in advance!
I used awk to get packet latency from tracefile too.
I find awk is running too slow, therefore I perform
a search on the Internet for "awk converter" or something
like that, and I find a awk->c converter called awka.
Therefore I grab the awka from
Convert my awk script into c code, then compile it and
run the program. Boom! The compiled c code run much much
faster than the original awk script.
So I think you may try this awk->c converter awka to see
if it can help.
Hope that this may help you!
|/ |- | / | |\| Kevin
'` `- `' ' ' ' Yuen Ka Nang
CUHK CSE (Undergrad. CC + M.Phil) Year 5/(5 ?!?)