@@ -868,25 +868,16 @@ executeMatrixMultiplyWorkload(ze_device_handle_t device,
868
868
lzt::reset_command_list (commandList);
869
869
}
870
870
871
- class zetMetricTracerParameterizedReadTestFixture
872
- : public zetMetricTracerTest,
873
- public ::testing::WithParamInterface<bool > {};
874
-
875
- LZT_TEST_P (
876
- zetMetricTracerParameterizedReadTestFixture,
877
- GivenAsynchronouslyOrSynchronouslyEnabledAndDisabledTracerWithOneOrMoreMetricsGroupsAndWorkloadExecutionThenExpectTracerReadsToSucceed) {
878
-
871
+ void run_metric_tracer_read_test (
872
+ ze_device_handle_t &device,
873
+ std::vector<lzt::activatable_metric_group_handle_list_for_device_t >
874
+ &tracer_supporting_devices_list,
875
+ zet_metric_tracer_exp_desc_t &tracer_descriptor, bool synchronous) {
879
876
constexpr int32_t number_of_retries = 5 ;
880
877
constexpr int32_t retry_wait_milliseconds = 5 ;
881
- bool test_is_synchronous = GetParam ();
882
878
ze_result_t result;
883
879
884
- std::string test_mode;
885
- if (test_is_synchronous) {
886
- test_mode = " Synchronous" ;
887
- } else {
888
- test_mode = " Asynchronous" ;
889
- }
880
+ std::string test_mode = synchronous ? " Synchronous" : " Asynchronous" ;
890
881
891
882
LOG_INFO << " testing zetMetricTracerReadDataExp with " << test_mode
892
883
<< " tracer Enable and Disable" ;
@@ -919,9 +910,9 @@ LZT_TEST_P(
919
910
.data (),
920
911
&tracer_descriptor, nullptr , &metric_tracer_handle);
921
912
922
- lzt::metric_tracer_enable (metric_tracer_handle, test_is_synchronous );
913
+ lzt::metric_tracer_enable (metric_tracer_handle, synchronous );
923
914
924
- if (!test_is_synchronous ) {
915
+ if (!synchronous ) {
925
916
int32_t j = 0 ;
926
917
size_t raw_data_size = 0 ;
927
918
do {
@@ -968,9 +959,8 @@ LZT_TEST_P(
968
959
executeMatrixMultiplyWorkload (device, commandQueue, commandList);
969
960
970
961
size_t raw_data_size = 0 ;
971
- result = zetMetricTracerReadDataExp (metric_tracer_handle, &raw_data_size,
972
- nullptr );
973
- ASSERT_ZE_RESULT_SUCCESS (result);
962
+ raw_data_size = lzt::metric_tracer_read_data_size (metric_tracer_handle);
963
+
974
964
ASSERT_NE (raw_data_size, 0 ) << " After executing a workload, "
975
965
" zetMetricTracerReadDataExp with an "
976
966
" enabled tracer and null data "
@@ -986,7 +976,7 @@ LZT_TEST_P(
986
976
<< " zetMetricTracerReadDataExp on an enabled "
987
977
" tracer returned zero data size" ;
988
978
989
- lzt::metric_tracer_disable (metric_tracer_handle, true );
979
+ lzt::metric_tracer_disable (metric_tracer_handle, synchronous );
990
980
991
981
size_t disabled_read_data_size = raw_data_size - enabled_read_data_size;
992
982
std::vector<uint8_t > disabled_raw_data (disabled_read_data_size);
@@ -998,7 +988,7 @@ LZT_TEST_P(
998
988
<< " zetMetricTracerReadDataExp with "
999
989
" non-null data buffer and disabled "
1000
990
" tracer has returned no data" ;
1001
- if (!test_is_synchronous ) {
991
+ if (!synchronous ) {
1002
992
int32_t k = 0 ;
1003
993
do {
1004
994
size_t raw_data_size = 0 ;
@@ -1033,9 +1023,19 @@ LZT_TEST_P(
1033
1023
}
1034
1024
}
1035
1025
1036
- INSTANTIATE_TEST_SUITE_P (ReadTestWithAsynchronousOrSynchronousEnableAndDisable,
1037
- zetMetricTracerParameterizedReadTestFixture,
1038
- ::testing::Values (true ));
1026
+ LZT_TEST_F (
1027
+ zetMetricTracerTest,
1028
+ GivenSynchronouslyEnabledAndDisabledTracerThenExpectTracerReadsToSucceed) {
1029
+ run_metric_tracer_read_test (device, tracer_supporting_devices_list,
1030
+ tracer_descriptor, true );
1031
+ }
1032
+
1033
+ LZT_TEST_F (
1034
+ zetMetricTracerTest,
1035
+ GivenAsynchronouslyEnabledAndDisabledTracerThenExpectTracerReadsToSucceed) {
1036
+ run_metric_tracer_read_test (device, tracer_supporting_devices_list,
1037
+ tracer_descriptor, false );
1038
+ }
1039
1039
1040
1040
LZT_TEST_F (zetMetricTracerTest,
1041
1041
GivenTracerIsCreatedThenDecoderCreateAndDestroySucceed) {
0 commit comments