Reset EventIdx counter at the end of CledReleaseAllEvents as it can be called multiple time. TODO change the place where exit_profiling is called (pop_data_environment() is not a good place but I don't now when to unload the runtime) and use callback on events to update the database (clSetEventCallback)