@@ -241,6 +241,73 @@ int get_performance_data(struct global_perf_data * const global_perf_data)
241241 return 0 ;
242242}
243243
244+ int get_extended_performance_data (struct extended_global_perf_data * const ext_global_perf_data )
245+ {
246+ if (!ext_global_perf_data ) {
247+ tr_err (& ipc_tr , "IPC data is NULL" );
248+ return - EINVAL ;
249+ }
250+
251+ size_t slots_count ;
252+ size_t slot_idx = 0 ;
253+ uint64_t total_dsp_cycles [CONFIG_MAX_CORE_COUNT ];
254+
255+ /* TODO
256+ * Setting temporary values here.
257+ * Replace this with actual total dsp cycles info once it is available.
258+ */
259+ for (int core_id = 0 ; core_id < CONFIG_MAX_CORE_COUNT ; ++ core_id )
260+ total_dsp_cycles [core_id ] = 1 ;
261+
262+ /* Fill one performance record per core with total dsp cycles */
263+ for (int core_id = 0 ; core_id < CONFIG_MAX_CORE_COUNT ; ++ core_id ) {
264+ if (!(cpu_enabled_cores () & BIT (core_id )))
265+ continue ;
266+
267+ memset (& ext_global_perf_data -> perf_items [slot_idx ], 0 ,
268+ sizeof (struct ext_perf_data_item ));
269+
270+ ext_global_perf_data -> perf_items [slot_idx ].resource_id = core_id ;
271+ ext_global_perf_data -> perf_items [slot_idx ].module_total_dsp_cycles_consumed =
272+ total_dsp_cycles [core_id ];
273+ ++ slot_idx ;
274+ }
275+
276+ slots_count = perf_bitmap_get_occupied (& performance_data_bitmap ) + slot_idx ;
277+ ext_global_perf_data -> perf_item_count = slots_count ;
278+
279+ /* fill the rest of the IPC records with data from
280+ * components registered in MW3 for performance measurement
281+ */
282+ for (int idx = 0 ; idx < perf_bitmap_get_size (& performance_data_bitmap ) &&
283+ slot_idx < slots_count ; ++ idx ) {
284+ if (perf_bitmap_is_bit_clear (& performance_data_bitmap , idx ))
285+ continue ;
286+
287+ ext_global_perf_data -> perf_items [slot_idx ].resource_id =
288+ perf_data [idx ].item .resource_id ;
289+ ext_global_perf_data -> perf_items [slot_idx ].power_mode =
290+ perf_data [idx ].item .power_mode ;
291+ ext_global_perf_data -> perf_items [slot_idx ].is_removed =
292+ perf_data [idx ].item .is_removed ;
293+ ext_global_perf_data -> perf_items [slot_idx ].module_total_dsp_iterations =
294+ perf_data [idx ].total_iteration_count ;
295+ ext_global_perf_data -> perf_items [slot_idx ].module_total_dsp_cycles_consumed =
296+ perf_data [idx ].total_cycles_consumed ;
297+ ext_global_perf_data -> perf_items [slot_idx ].module_peak_dsp_cycles =
298+ perf_data [idx ].item .peak_kcps * 1000 ;
299+ ext_global_perf_data -> perf_items [slot_idx ].module_peak_restricted_cycles =
300+ perf_data [idx ].restricted_peak_cycles ;
301+ ext_global_perf_data -> perf_items [slot_idx ].module_total_restricted_cycles_consumed =
302+ perf_data [idx ].restricted_total_cycles ;
303+ ext_global_perf_data -> perf_items [slot_idx ].module_total_restricted_iterations =
304+ perf_data [idx ].restricted_total_iterations ;
305+ ext_global_perf_data -> perf_items [slot_idx ].rsvd = 0 ;
306+ ++ slot_idx ;
307+ }
308+ return 0 ;
309+ }
310+
244311int performance_monitor_init (void )
245312{
246313 /* init global performance measurement */
0 commit comments