From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <200609201034.k8KAY0w20632@zamenhof.cs.utwente.nl> To: 9fans@cse.psu.edu From: Axel Belinfante MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20626.1158748439.1@zamenhof.cs.utwente.nl.cs.utwente.nl> Date: Wed, 20 Sep 2006 12:33:59 +0200 Subject: [9fans] awk: hex numbers? (and leak(1)) Topicbox-Message-UUID: bbad0e4a-ead1-11e9-9d60-3106f5b1d025 is there a way to use awk to sum hex values? i.e. I want to sum values in the 3rd column of block 0x000af9a8 0x00000040 0x0001ddf3 0x00000000 block 0x000afd88 0x00000040 0x0001ddf3 0x00000000 I have tried to make awk use an external program to do the hex-to-dec conversion, but that was very slow (probably due to many page faults). (in the end I resorted to perl...) context: I've been fiddling with leak(1) to make it print an overview of how much memory is allocated where, as in: location total calls amount allocated src(0x0001d8f1); // 247648 20 src(0x000067f8); // 24256 59 src(0x0001da70); // 15760 6 src(0x000128ac); // 8256 1 src(0x000210f8); // 4128 66 src(0x00014bc2); // 3648 57 [...] src(0x00006586); // 64 1 src(0x00011a50); // 64 1 src(0x000067c7); // 64 1 src(0x0001ca32); // 32 1 // 326544 I found it quite useful to get insight in where the memory goes (even when it is not leaked) - but maybe we already have this functionality somewhere, and I missed it? Axel.