Add getLastCounter() to EuThread

Related-To: NEO-6447

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2022-02-24 17:39:28 +00:00
committed by Compute-Runtime-Automation
parent 371358c8c7
commit 7a2c5e28c1
2 changed files with 18 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -151,6 +151,10 @@ class EuThread {
uint64_t getMemoryHandle() const { return memoryHandle; }
uint8_t getLastCounter() const {
return systemRoutineCounter;
}
public:
static constexpr uint64_t invalidHandle = std::numeric_limits<uint64_t>::max();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -231,5 +231,17 @@ TEST(EuThread, GivenThreadStateStoppedWhenVerifyingStopWithEvenCounterBiggerByMo
EXPECT_TRUE(euThread.isRunning());
}
TEST(EuThread, GivenEuThreadWhenGettingLastCounterThenCorrectValueIsReturned) {
ze_device_thread_t devThread = {3, 4, 5, 6};
EuThread::ThreadId threadId(0, devThread);
EuThread euThread(threadId);
EXPECT_EQ(0u, euThread.getLastCounter());
euThread.verifyStopped(1);
EXPECT_EQ(1u, euThread.getLastCounter());
euThread.verifyStopped(9);
EXPECT_EQ(9u, euThread.getLastCounter());
}
} // namespace ult
} // namespace L0