diff options
author | Lars Wirzenius <liw@liw.fi> | 2016-05-04 23:06:30 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2016-05-04 23:06:30 +0300 |
commit | 0d4fe5c30a8adea19ec1e06788b943468064e0b7 (patch) | |
tree | 21073d9d4a5222b8b370bae97ce8274de7b74241 | |
parent | 9a4e9739647b4a86908d5a2ec9d43f4b3ecc7400 (diff) | |
download | obnam-0d4fe5c30a8adea19ec1e06788b943468064e0b7.tar.gz |
Add script to count objects from log file
-rw-r--r-- | obj-counts-from-log | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/obj-counts-from-log b/obj-counts-from-log new file mode 100644 index 00000000..e938d36f --- /dev/null +++ b/obj-counts-from-log @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +import sys + +counts = {} + +for line in sys.stdin: + words = line.split() +# print words + if len(words) == 7 and words[4] in ('INIT', 'DEL'): + obj_type = words[5] + obj_id = words[6] + if words[4] == 'INIT': + delta = 1 + else: + delta = -1 + counts[obj_type] = counts.get(obj_type, 0) + delta + print obj_type, counts[obj_type] + elif len(words) == 6 and words[3] == 'VmRSS:': + vmrss = words[4] + print "VmRSS", vmrss |