@@ -258,10 +258,10 @@ TEST_F(
258258
259259 // Get initial bandwidth counters
260260 auto bandwidth_before = lzt::get_mem_bandwidth (mem_handle);
261- EXPECT_LT (bandwidth_before.readCounter , UINT64_MAX);
262- EXPECT_LT (bandwidth_before. writeCounter , UINT64_MAX) ;
263- EXPECT_LT (bandwidth_before.maxBandwidth , UINT64_MAX);
264- EXPECT_LT (bandwidth_before. timestamp , UINT64_MAX) ;
261+ EXPECT_GT (bandwidth_before.maxBandwidth , 0 )
262+ << " Max bandwidth is not greater than zero " ;
263+ EXPECT_GT (bandwidth_before.timestamp , 0 )
264+ << " Timestamp is not greater than zero " ;
265265 // Run the workload
266266 ze_result_t result = copy_workload (device, &device_desc, src_ptr, dst_ptr,
267267 static_cast <int32_t >(buffer_size));
@@ -271,24 +271,25 @@ TEST_F(
271271 auto bandwidth_after = lzt::get_mem_bandwidth (mem_handle);
272272
273273 // Validate that read/write counters have increased after workload
274- EXPECT_GE (bandwidth_after.readCounter , bandwidth_before.readCounter )
274+ EXPECT_GT (bandwidth_after.readCounter , bandwidth_before.readCounter )
275275 << " Read counter did not increase after workload" ;
276- EXPECT_GE (bandwidth_after.writeCounter , bandwidth_before.writeCounter )
276+ EXPECT_GT (bandwidth_after.writeCounter , bandwidth_before.writeCounter )
277277 << " Write counter did not increase after workload" ;
278- EXPECT_GE (bandwidth_after.maxBandwidth , bandwidth_before.maxBandwidth )
279- << " Max bandwidth did not increase after workload" ;
280-
281- auto percentage_bandwidth =
282- 1000000 *
278+ EXPECT_GT (bandwidth_after.timestamp , bandwidth_before.timestamp )
279+ << " Timestamp did not increase after workload" ;
280+ double percentage_bandwidth =
281+ 1000000.0 *
283282 ((bandwidth_after.readCounter - bandwidth_before.readCounter ) +
284283 (bandwidth_after.writeCounter - bandwidth_before.writeCounter )) /
285- (bandwidth_after.maxBandwidth *
286- (bandwidth_after.timestamp - bandwidth_before.timestamp ));
284+ (static_cast <double >(bandwidth_after.maxBandwidth ) *
285+ (static_cast <double >(bandwidth_after.timestamp ) -
286+ static_cast <double >(bandwidth_before.timestamp )));
287287 // Validate that percentage bandwidth is greater than zero
288288 LOG_INFO << " Percentage Bandwidth: " << percentage_bandwidth << " %" ;
289289 EXPECT_GT (percentage_bandwidth, 0.0 )
290290 << " Percentage bandwidth is not greater than zero" ;
291- EXPECT_LT (percentage_bandwidth, 100.0 );
291+ EXPECT_LE (percentage_bandwidth, 100.0 )
292+ << " Percentage bandwidth is greater than 100%" ;
292293 }
293294 // Free device memory
294295 lzt::free_memory (src_ptr);
0 commit comments