sched: gprof SMP support

In the case of SMP, use smp_call to get other CPU data

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai
2024-09-25 22:17:06 +08:00
committed by Xiang Xiao
parent eb8449cb0c
commit 1b42a7bf84
+17 -2
View File
@@ -59,9 +59,9 @@ static struct profinfo_s g_prof;
* Private Functions
****************************************************************************/
static void profil_timer_handler(wdparm_t arg)
static int profil_timer_handler_cpu(FAR void *arg)
{
FAR struct profinfo_s *prof = (FAR struct profinfo_s *)(uintptr_t)arg;
FAR struct profinfo_s *prof = (FAR struct profinfo_s *)arg;
uintptr_t pc = up_getusrpc(NULL);
irqstate_t flags;
@@ -78,6 +78,21 @@ static void profil_timer_handler(wdparm_t arg)
}
spin_unlock_irqrestore(&prof->lock, flags);
return OK;
}
static void profil_timer_handler(wdparm_t arg)
{
FAR struct profinfo_s *prof = (FAR struct profinfo_s *)(uintptr_t)arg;
#ifdef CONFIG_SMP
cpu_set_t cpus = (1 << CONFIG_SMP_NCPUS) - 1;
CPU_CLR(this_cpu(), &cpus);
nxsched_smp_call(cpus, profil_timer_handler_cpu,
(FAR void *)arg, false);
#endif
profil_timer_handler_cpu(prof);
wd_start(&prof->timer, PROFTICK, profil_timer_handler, arg);
}