Skip to content

Commit 7a2c5e2

Browse files
Add getLastCounter() to EuThread
Related-To: NEO-6447 Signed-off-by: Mateusz Hoppe <[email protected]>
1 parent 371358c commit 7a2c5e2

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

level_zero/tools/source/debug/eu_thread.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2021 Intel Corporation
2+
* Copyright (C) 2021-2022 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -151,6 +151,10 @@ class EuThread {
151151

152152
uint64_t getMemoryHandle() const { return memoryHandle; }
153153

154+
uint8_t getLastCounter() const {
155+
return systemRoutineCounter;
156+
}
157+
154158
public:
155159
static constexpr uint64_t invalidHandle = std::numeric_limits<uint64_t>::max();
156160

level_zero/tools/test/unit_tests/sources/debug/eu_thread_tests.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2021 Intel Corporation
2+
* Copyright (C) 2021-2022 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -231,5 +231,17 @@ TEST(EuThread, GivenThreadStateStoppedWhenVerifyingStopWithEvenCounterBiggerByMo
231231
EXPECT_TRUE(euThread.isRunning());
232232
}
233233

234+
TEST(EuThread, GivenEuThreadWhenGettingLastCounterThenCorrectValueIsReturned) {
235+
ze_device_thread_t devThread = {3, 4, 5, 6};
236+
EuThread::ThreadId threadId(0, devThread);
237+
EuThread euThread(threadId);
238+
239+
EXPECT_EQ(0u, euThread.getLastCounter());
240+
euThread.verifyStopped(1);
241+
EXPECT_EQ(1u, euThread.getLastCounter());
242+
euThread.verifyStopped(9);
243+
EXPECT_EQ(9u, euThread.getLastCounter());
244+
}
245+
234246
} // namespace ult
235247
} // namespace L0

0 commit comments

Comments
 (0)