Some experimental compiler code to gather the states on intervals.