Skip to content
Snippets Groups Projects
Commit caa94a47 authored by Nikolai.Hartmann's avatar Nikolai.Hartmann
Browse files

update reporter script

parent 44ce7cde
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ from glob import glob
import struct
import time
import requests
from datetime import datetime
#BASE_DIR = '/xcache-meta/namespace'
BASE_DIR = '/data/xrd/namespace'
......@@ -30,6 +31,14 @@ collector = os.environ['XC_REPORT_COLLECTOR']
reports = []
def countSetBits(n):
count = 0
while n:
count += n & 1
n >>= 1
return count
def get_info(filename):
fin = open(filename, "rb")
......@@ -48,6 +57,11 @@ def get_info(filename):
sv = struct.unpack(str(StateVectorLengthInBytes) + 'B', fin.read(StateVectorLengthInBytes)) # disk written state vector
# print ('disk written state vector:\n ->', sv, '<-')
inCache = 0
for i in sv:
inCache += countSetBits(i)
# print('blocks cached:', inCache)
chksum, = struct.unpack('16s', fin.read(16))
# print ('chksum:', chksum)
......@@ -60,7 +74,9 @@ def get_info(filename):
'site': site,
'file': filename.replace(BASE_DIR, '').replace('/atlas/rucio/', '').replace('.cinfo', ''),
'size': fs,
'created_at': time_of_creation * 1000
'created_at': time_of_creation * 1000,
'blocks': buckets,
'blocks_cached': inCache
}
accesses, = struct.unpack('Q', fin.read(8))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment