performance: Check if print xe logs is needed before locking
Related-To: NEO-7996 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
parent
30c5d8a681
commit
3f27b5225c
|
@ -1145,17 +1145,17 @@ int IoctlHelperXe::ioctl(DrmIoctl request, void *arg) {
|
|||
}
|
||||
|
||||
void IoctlHelperXe::xeShowBindTable() {
|
||||
#if 1
|
||||
std::unique_lock<std::mutex> lock(xeLock);
|
||||
xeLog("show bind: (<index> <handle> <userptr> <addr> <size>)\n", "");
|
||||
for (unsigned int i = 0; i < bindInfo.size(); i++) {
|
||||
xeLog(" %3d x%08x x%016lx x%016lx x%016lx\n", i,
|
||||
bindInfo[i].handle,
|
||||
bindInfo[i].userptr,
|
||||
bindInfo[i].addr,
|
||||
bindInfo[i].size);
|
||||
if (DebugManager.flags.PrintDebugMessages.get()) {
|
||||
std::unique_lock<std::mutex> lock(xeLock);
|
||||
xeLog("show bind: (<index> <handle> <userptr> <addr> <size>)\n", "");
|
||||
for (unsigned int i = 0; i < bindInfo.size(); i++) {
|
||||
xeLog(" %3d x%08x x%016lx x%016lx x%016lx\n", i,
|
||||
bindInfo[i].handle,
|
||||
bindInfo[i].userptr,
|
||||
bindInfo[i].addr,
|
||||
bindInfo[i].size);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int IoctlHelperXe::createDrmContext(Drm &drm, OsContextLinux &osContext, uint32_t drmVmId, uint32_t deviceIndex) {
|
||||
|
|
|
@ -110,7 +110,7 @@ class IoctlHelperXe : public IoctlHelper {
|
|||
uint32_t xeSyncObjCreate(uint32_t flags);
|
||||
bool xeSyncObjWait(uint32_t *handles, uint32_t count, uint64_t absTimeoutNsec, uint32_t flags, uint32_t *firstSignaled);
|
||||
void xeSyncObjDestroy(uint32_t handle);
|
||||
void xeShowBindTable();
|
||||
|
||||
int xeGetQuery(Query *data);
|
||||
struct drm_xe_engine_class_instance *xeFindMatchingEngine(uint16_t engineClass, uint16_t engineInstance);
|
||||
|
||||
|
@ -122,6 +122,7 @@ class IoctlHelperXe : public IoctlHelper {
|
|||
std::vector<uint8_t> queryData(uint32_t queryId);
|
||||
int xeWaitUserFence(uint64_t mask, uint16_t op, uint64_t addr, uint64_t value, int64_t timeout);
|
||||
int xeVmBind(const VmBindParams &vmBindParams, bool bindOp);
|
||||
void xeShowBindTable();
|
||||
|
||||
struct UserFenceExtension {
|
||||
static constexpr uint32_t tagValue = 0x123987;
|
||||
|
|
|
@ -33,6 +33,7 @@ struct MockIoctlHelperXe : IoctlHelperXe {
|
|||
using IoctlHelperXe::xeGetBindOpName;
|
||||
using IoctlHelperXe::xeGetClassName;
|
||||
using IoctlHelperXe::xeGetengineClassName;
|
||||
using IoctlHelperXe::xeShowBindTable;
|
||||
using IoctlHelperXe::xeTimestampFrequency;
|
||||
};
|
||||
|
||||
|
@ -1449,3 +1450,28 @@ TEST(IoctlHelperXeTest, WhenSetupIpVersionIsCalledThenIpVersionIsCorrect) {
|
|||
xeIoctlHelper->setupIpVersion();
|
||||
EXPECT_EQ(config, hwInfo.ipVersion.value);
|
||||
}
|
||||
|
||||
TEST(IoctlHelperXeTest, whenXeShowBindTableIsCalledThenBindLogsArePrinted) {
|
||||
DebugManagerStateRestore restorer;
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
||||
auto xeIoctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
|
||||
|
||||
BindInfo mockBindInfo{};
|
||||
mockBindInfo.handle = 1u;
|
||||
mockBindInfo.userptr = 2u;
|
||||
mockBindInfo.addr = 3u;
|
||||
mockBindInfo.size = 4u;
|
||||
xeIoctlHelper->bindInfo.push_back(mockBindInfo);
|
||||
|
||||
::testing::internal::CaptureStderr();
|
||||
|
||||
DebugManager.flags.PrintDebugMessages.set(true);
|
||||
xeIoctlHelper->xeShowBindTable();
|
||||
DebugManager.flags.PrintDebugMessages.set(false);
|
||||
std::string output = testing::internal::GetCapturedStderr();
|
||||
std::string expectedOutput = R"(show bind: (<index> <handle> <userptr> <addr> <size>)
|
||||
0 x00000001 x0000000000000002 x0000000000000003 x0000000000000004
|
||||
)";
|
||||
EXPECT_STREQ(expectedOutput.c_str(), output.c_str());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue