Skip to content

Commit 487ff11

Browse files
committed
fix: correct failing metrics CTS on windows
This fixes below failing metrics CTS because of windows specific behaviour GivenValidMetricGroupWhenTimerBasedStreamerIsCreatedThenExpectStreamerToSucceed GivenValidMetricGroupWhenTimerBasedStreamerIsCreatedThenExpectStreamerToGenrateCorrectNumberOfReports GivenValidMetricGroupWhenTimerBasedStreamerIsCreatedThenExpectStreamerToNotifyEventAtProperTimeAndSucceed Related-To: VLCLJ-2370 Signed-off-by: shubham kumar <[email protected]>
1 parent b9d3934 commit 487ff11

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

conformance_tests/tools/metrics/src/test_metric.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,8 +1217,10 @@ TEST_F(
12171217
zetMetricStreamerTest,
12181218
GivenValidMetricGroupWhenTimerBasedStreamerIsCreatedThenExpectStreamerToSucceed) {
12191219

1220-
// The time in seconds for the buffer to overflow would be 2 * (notifyEveryNReports * (samplingPeriod/nanoSecToSeconds)) for this test it will be 512 seconds
1221-
uint32_t notifyEveryNReports = 256;
1220+
/* The time in seconds for the buffer to overflow would be 2 * (notifyEveryNReports * (samplingPeriod/nanoSecToSeconds)) for this test it will be 18000 seconds
1221+
* A high value of notifyEveryNReports makes sure buffer overflow does not happen even if context-switching caused extra reports to be generated
1222+
*/
1223+
uint32_t notifyEveryNReports = 9000;
12221224
uint32_t samplingPeriod = 1000000000;
12231225
for (auto device : devices) {
12241226

@@ -1357,7 +1359,7 @@ TEST_F(
13571359
notifyEveryNReports *
13581360
(static_cast<double>(samplingPeriod) / nanoSecToSeconds);
13591361
// Initializing the error buffer to prevent corner cases
1360-
double errorBuffer = 0.05 * minimumTimeBeforeEventIsExpected;
1362+
double errorBuffer = 0.10 * minimumTimeBeforeEventIsExpected;
13611363
LOG_DEBUG << "minimumTimeBeforeEventIsExpected "
13621364
<< minimumTimeBeforeEventIsExpected;
13631365
LOG_DEBUG << "errorBuffer " << errorBuffer;
@@ -1373,6 +1375,9 @@ TEST_F(
13731375
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
13741376
currentTime = std::chrono::system_clock::now();
13751377
elapsedSeconds = currentTime - startTime;
1378+
// Need to keep runnning some workload since some platforms go into sleep mode when idle and dont generate reports. This will delay the event generation.
1379+
lzt::execute_command_lists(commandQueue, 1, &commandList, nullptr);
1380+
lzt::synchronize(commandQueue, std::numeric_limits<uint64_t>::max());
13761381
}
13771382

13781383
// Sleep again for the error buffer time to ensure corner cases are
@@ -1459,7 +1464,7 @@ TEST_F(
14591464
notifyEveryNReports *
14601465
(static_cast<double>(samplingPeriod) / nanoSecToSeconds);
14611466
// Initializing the error buffer to prevent corner cases
1462-
double errorBuffer = 0.05 * minimumTimeBeforeEventIsExpected;
1467+
double errorBuffer = 0.10 * minimumTimeBeforeEventIsExpected;
14631468
LOG_DEBUG << "minimumTimeBeforeEventIsExpected "
14641469
<< minimumTimeBeforeEventIsExpected;
14651470
LOG_DEBUG << "errorBuffer " << errorBuffer;
@@ -1473,6 +1478,9 @@ TEST_F(
14731478
LOG_DEBUG << "additional sleep before expecting event to be ready "
14741479
<< timeLeft;
14751480
std::this_thread::sleep_for(std::chrono::seconds(timeLeft));
1481+
// Need to keep runnning some workload since some platforms go into sleep mode when idle and dont generate reports. This will delay the event generation.
1482+
lzt::execute_command_lists(commandQueue, 1, &commandList, nullptr);
1483+
lzt::synchronize(commandQueue, std::numeric_limits<uint64_t>::max());
14761484
}
14771485

14781486
ze_result_t eventResult;

0 commit comments

Comments
 (0)