File: alloc_dump_summary.sh

package info (click to toggle)
epic5 3.0.3-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 5,328 kB
  • sloc: ansic: 75,810; makefile: 648; ruby: 227; python: 215; sh: 78; perl: 13
file content (28 lines) | stat: -rw-r--r-- 713 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

# alloc_dump_summary.sh
# summarises the output of the /ALLOCDUMP epic command.
# - caf

last_file_line=""

echo "file/line	alloc_count	alloc_bytes"
cut -f1-2 |
 sort |
 (while read file_line alloc_bytes; do
     if [ "$file_line" != "$last_file_line" ]; then
         if [ "$last_file_line" != "" ]; then
             echo "$last_file_line	$alloc_count	$alloc_total"
         fi
         last_file_line="$file_line"
         alloc_total=$((alloc_bytes))
         alloc_count=1
     else
         alloc_total=$((alloc_total + alloc_bytes))
         alloc_count=$((alloc_count + 1))
	 fi
  done
  if [ "$last_file_line" != "" ]; then
      echo "$last_file_line	$alloc_count	$alloc_total"
  fi)