Record only the first inciding inlcuding tid, value and trace event. If multiple threads exceed the limit then the reported `tid' might not match the reported value. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> --- src/cyclictest/cyclictest.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index 34aa9be583f85..777da26d7bdc3 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -718,13 +718,14 @@ static void *timerthread(void *param) if (!stopped && tracelimit && (diff > tracelimit)) { stopped++; - tracemark("hit latency threshold (%llu > %d)", - (unsigned long long) diff, tracelimit); shutdown++; pthread_mutex_lock(&break_thread_id_lock); - if (break_thread_id == 0) + if (break_thread_id == 0) { break_thread_id = stat->tid; - break_thread_value = diff; + tracemark("hit latency threshold (%llu > %d)", + (unsigned long long) diff, tracelimit); + break_thread_value = diff; + } pthread_mutex_unlock(&break_thread_id_lock); } stat->act = diff; -- 2.29.2