@@ -108,9 +108,37 @@ class PapiService
108108 continue ;
109109 }
110110
111+ PAPI_event_info_t info;
112+ memset (&info, 0 , sizeof (PAPI_event_info_t));
113+ ret = PAPI_get_event_info (code, &info);
114+ if (ret != PAPI_OK ) {
115+ print_papi_error (" PAPI_get_event_info()" , ret);
116+ continue ;
117+ }
118+
119+ cali_attr_type type = CALI_TYPE_INV ;
120+ switch (info.data_type ) {
121+ case PAPI_DATATYPE_INT64 :
122+ type = CALI_TYPE_INT ;
123+ break ;
124+ case PAPI_DATATYPE_UINT64 :
125+ type = CALI_TYPE_UINT ;
126+ break ;
127+ case PAPI_DATATYPE_FP64 :
128+ type = CALI_TYPE_DOUBLE ;
129+ break ;
130+ default :
131+ break ;
132+ }
133+
134+ if (type == CALI_TYPE_INV ) {
135+ Log (0 ).stream () << " papi: Unsupported datatype for event " << name << std::endl;
136+ continue ;
137+ }
138+
111139 Attribute attr = c->create_attribute (
112140 std::string (" papi." ) + name,
113- CALI_TYPE_UINT ,
141+ type ,
114142 CALI_ATTR_SCOPE_THREAD | CALI_ATTR_SKIP_EVENTS | CALI_ATTR_ASVALUE | CALI_ATTR_AGGREGATABLE
115143 );
116144
@@ -253,8 +281,10 @@ class PapiService
253281 return ;
254282 }
255283
256- for (int i = 0 ; i < count; ++i)
257- rec.append (grp.attrs [i], Variant (cali_make_variant_from_uint (values[i])));
284+ for (int i = 0 ; i < count; ++i) {
285+ Variant v_val = Variant (grp.attrs [i].type (), reinterpret_cast <const void *>(&values[i]), sizeof (long long ));
286+ rec.append (grp.attrs [i], v_val);
287+ }
258288 }
259289
260290 bool start_thread_counting (Caliper* c)
0 commit comments