profiling: use correct function attributes

Some functions can be declared pure, others const. This is better than
warn_unused_result alone (pure and const imply warn_unused_result).