some util functions
WIP: adding cost-centre related codes only when compiling for profiling