update_histogram with timing of a function