1. Remember current time in now_utime
2. Lock LOCK_thd_remove, so threads will not be removed from the list of threads, but new threads can be added
3. For each thread calculate TIME_MS as now_utime - tmp->start_utime
4. Unlock LOCK_thd_remove
It is possible for the new thread to be created while we doing 3. Natural fix would be to set TIME_MS=0 when now_utime < tmp->start_utime.
fill_schema_ processlist works as following:
1. Remember current time in now_utime
2. Lock LOCK_thd_remove, so threads will not be removed from the list of threads, but new threads can be added
3. For each thread calculate TIME_MS as now_utime - tmp->start_utime
4. Unlock LOCK_thd_remove
It is possible for the new thread to be created while we doing 3. Natural fix would be to set TIME_MS=0 when now_utime < tmp->start_utime.