mirror of
https://github.com/intel/compute-runtime.git
synced 2025-11-10 05:49:51 +08:00
Use global timestamps for TimestampPacket profiling calculations
Change-Id: I53ffe566b78c1b86cf430c23e0c0bb9000532b0c Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
b6e98c4eb4
commit
8b267fd949
@@ -253,7 +253,6 @@ bool Event::calcProfilingData() {
|
|||||||
if (!dataCalculated && !profilingCpuPath) {
|
if (!dataCalculated && !profilingCpuPath) {
|
||||||
if (timestampPacketContainer && timestampPacketContainer->peekNodes().size() > 0) {
|
if (timestampPacketContainer && timestampPacketContainer->peekNodes().size() > 0) {
|
||||||
const auto timestamps = timestampPacketContainer->peekNodes();
|
const auto timestamps = timestampPacketContainer->peekNodes();
|
||||||
auto isMultiOsContextCapable = this->getCommandQueue()->getGpgpuCommandStreamReceiver().isMultiOsContextCapable();
|
|
||||||
|
|
||||||
if (DebugManager.flags.PrintTimestampPacketContents.get()) {
|
if (DebugManager.flags.PrintTimestampPacketContents.get()) {
|
||||||
for (auto i = 0u; i < timestamps.size(); i++) {
|
for (auto i = 0u; i < timestamps.size(); i++) {
|
||||||
@@ -268,41 +267,22 @@ bool Event::calcProfilingData() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMultiOsContextCapable) {
|
uint64_t globalStartTS = timestamps[0]->tagForCpuAccess->packets[0].globalStart;
|
||||||
auto globalStartTS = timestamps[0]->tagForCpuAccess->packets[0].globalStart;
|
uint64_t globalEndTS = timestamps[0]->tagForCpuAccess->packets[0].globalEnd;
|
||||||
uint64_t globalEndTS = timestamps[0]->tagForCpuAccess->packets[0].globalEnd;
|
|
||||||
|
|
||||||
for (const auto ×tamp : timestamps) {
|
for (const auto ×tamp : timestamps) {
|
||||||
for (auto i = 0u; i < timestamp->tagForCpuAccess->packetsUsed; ++i) {
|
for (auto i = 0u; i < timestamp->tagForCpuAccess->packetsUsed; ++i) {
|
||||||
const auto &packet = timestamp->tagForCpuAccess->packets[i];
|
const auto &packet = timestamp->tagForCpuAccess->packets[i];
|
||||||
if (globalStartTS > packet.globalStart) {
|
|
||||||
globalStartTS = packet.globalStart;
|
|
||||||
}
|
|
||||||
if (globalEndTS < packet.globalEnd) {
|
|
||||||
globalEndTS = packet.globalEnd;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
calculateProfilingDataInternal(globalStartTS, globalEndTS, &globalEndTS, globalStartTS);
|
|
||||||
} else {
|
|
||||||
auto contextStartTS = timestamps[0]->tagForCpuAccess->packets[0].contextStart;
|
|
||||||
uint64_t contextEndTS = timestamps[0]->tagForCpuAccess->packets[0].contextEnd;
|
|
||||||
auto globalStartTS = timestamps[0]->tagForCpuAccess->packets[0].globalStart;
|
|
||||||
|
|
||||||
for (const auto ×tamp : timestamps) {
|
|
||||||
const auto &packet = timestamp->tagForCpuAccess->packets[0];
|
|
||||||
if (contextStartTS > packet.contextStart) {
|
|
||||||
contextStartTS = packet.contextStart;
|
|
||||||
}
|
|
||||||
if (contextEndTS < packet.contextEnd) {
|
|
||||||
contextEndTS = packet.contextEnd;
|
|
||||||
}
|
|
||||||
if (globalStartTS > packet.globalStart) {
|
if (globalStartTS > packet.globalStart) {
|
||||||
globalStartTS = packet.globalStart;
|
globalStartTS = packet.globalStart;
|
||||||
}
|
}
|
||||||
|
if (globalEndTS < packet.globalEnd) {
|
||||||
|
globalEndTS = packet.globalEnd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
calculateProfilingDataInternal(contextStartTS, contextEndTS, &contextEndTS, globalStartTS);
|
|
||||||
}
|
}
|
||||||
|
calculateProfilingDataInternal(globalStartTS, globalEndTS, &globalEndTS, globalStartTS);
|
||||||
|
|
||||||
} else if (timeStampNode) {
|
} else if (timeStampNode) {
|
||||||
calculateProfilingDataInternal(
|
calculateProfilingDataInternal(
|
||||||
timeStampNode->tagForCpuAccess->ContextStartTS,
|
timeStampNode->tagForCpuAccess->ContextStartTS,
|
||||||
|
|||||||
@@ -1033,7 +1033,7 @@ struct ProfilingTimestampPacketsTest : public ::testing::Test {
|
|||||||
ev->timestampPacketContainer = std::make_unique<MockTimestampContainer>();
|
ev->timestampPacketContainer = std::make_unique<MockTimestampContainer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void addTimestampNode(int contextStart, int contextEnd, int globalStart) {
|
void addTimestampNode(int contextStart, int contextEnd, int globalStart, int globalEnd) {
|
||||||
auto node = new MockTagNode<TimestampPacketStorage>();
|
auto node = new MockTagNode<TimestampPacketStorage>();
|
||||||
auto timestampPacketStorage = new TimestampPacketStorage();
|
auto timestampPacketStorage = new TimestampPacketStorage();
|
||||||
node->tagForCpuAccess = timestampPacketStorage;
|
node->tagForCpuAccess = timestampPacketStorage;
|
||||||
@@ -1041,6 +1041,7 @@ struct ProfilingTimestampPacketsTest : public ::testing::Test {
|
|||||||
timestampPacketStorage->packets[0].contextStart = contextStart;
|
timestampPacketStorage->packets[0].contextStart = contextStart;
|
||||||
timestampPacketStorage->packets[0].contextEnd = contextEnd;
|
timestampPacketStorage->packets[0].contextEnd = contextEnd;
|
||||||
timestampPacketStorage->packets[0].globalStart = globalStart;
|
timestampPacketStorage->packets[0].globalStart = globalStart;
|
||||||
|
timestampPacketStorage->packets[0].globalEnd = globalEnd;
|
||||||
|
|
||||||
ev->timestampPacketContainer->add(node);
|
ev->timestampPacketContainer->add(node);
|
||||||
}
|
}
|
||||||
@@ -1082,20 +1083,21 @@ struct ProfilingTimestampPacketsTest : public ::testing::Test {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(ProfilingTimestampPacketsTest, givenTimestampsPacketContainerWithOneElementAndTimestampNodeWhenCalculatingProfilingThenTimesAreTakenFromPacket) {
|
TEST_F(ProfilingTimestampPacketsTest, givenTimestampsPacketContainerWithOneElementAndTimestampNodeWhenCalculatingProfilingThenTimesAreTakenFromPacket) {
|
||||||
addTimestampNode(10, 11, 12);
|
addTimestampNode(10, 11, 12, 13);
|
||||||
|
|
||||||
HwTimeStamps hwTimestamps;
|
HwTimeStamps hwTimestamps;
|
||||||
hwTimestamps.ContextStartTS = 100;
|
hwTimestamps.ContextStartTS = 100;
|
||||||
hwTimestamps.ContextEndTS = 110;
|
hwTimestamps.ContextEndTS = 110;
|
||||||
hwTimestamps.GlobalStartTS = 120;
|
hwTimestamps.GlobalStartTS = 120;
|
||||||
|
|
||||||
MockTagNode<HwTimeStamps> hwTimestampsNode;
|
MockTagNode<HwTimeStamps> hwTimestampsNode;
|
||||||
hwTimestampsNode.tagForCpuAccess = &hwTimestamps;
|
hwTimestampsNode.tagForCpuAccess = &hwTimestamps;
|
||||||
ev->timeStampNode = &hwTimestampsNode;
|
ev->timeStampNode = &hwTimestampsNode;
|
||||||
|
|
||||||
ev->calcProfilingData();
|
ev->calcProfilingData();
|
||||||
|
|
||||||
EXPECT_EQ(10u, ev->getStartTimeStamp());
|
EXPECT_EQ(12u, ev->getStartTimeStamp());
|
||||||
EXPECT_EQ(11u, ev->getEndTimeStamp());
|
EXPECT_EQ(13u, ev->getEndTimeStamp());
|
||||||
EXPECT_EQ(12u, ev->getGlobalStartTimestamp());
|
EXPECT_EQ(12u, ev->getGlobalStartTimestamp());
|
||||||
|
|
||||||
ev->timeStampNode = nullptr;
|
ev->timeStampNode = nullptr;
|
||||||
@@ -1153,14 +1155,14 @@ TEST_F(ProfilingTimestampPacketsTest, givenPrintTimestampPacketContentsSetWhenCa
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProfilingTimestampPacketsTest, givenTimestampsPacketContainerWithThreeElementsWhenCalculatingProfilingThenTimesAreTakenFromProperPacket) {
|
TEST_F(ProfilingTimestampPacketsTest, givenTimestampsPacketContainerWithThreeElementsWhenCalculatingProfilingThenTimesAreTakenFromProperPacket) {
|
||||||
addTimestampNode(10, 11, 12);
|
addTimestampNode(10, 11, 12, 13);
|
||||||
addTimestampNode(1, 21, 22);
|
addTimestampNode(1, 21, 22, 13);
|
||||||
addTimestampNode(5, 31, 2);
|
addTimestampNode(5, 31, 2, 13);
|
||||||
|
|
||||||
ev->calcProfilingData();
|
ev->calcProfilingData();
|
||||||
|
|
||||||
EXPECT_EQ(1u, ev->getStartTimeStamp());
|
EXPECT_EQ(2u, ev->getStartTimeStamp());
|
||||||
EXPECT_EQ(31u, ev->getEndTimeStamp());
|
EXPECT_EQ(13u, ev->getEndTimeStamp());
|
||||||
EXPECT_EQ(2u, ev->getGlobalStartTimestamp());
|
EXPECT_EQ(2u, ev->getGlobalStartTimestamp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user