Traces of oscillating functions