perf tools: Add a function to calculate sample event size