From 33f65bd80910e96504b35e1c67f16c8fb9180928 Mon Sep 17 00:00:00 2001 From: Herman Chen Date: Fri, 24 Oct 2025 17:50:07 +0800 Subject: [PATCH] fix[mpp_singleton]: Fix cluster sgln id conflict 1. Add MPP_SGLN_CLUSTER. 2. Add sgln init timing log. Signed-off-by: Herman Chen Change-Id: Id6d6a103f441cbf6a8acc9b00a0d54c788a939d8 --- mpp/base/mpp_cluster.c | 2 +- osal/inc/mpp_singleton.h | 1 + osal/mpp_singleton.c | 13 ++++++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mpp/base/mpp_cluster.c b/mpp/base/mpp_cluster.c index 5e093aae..a96ad2dc 100644 --- a/mpp/base/mpp_cluster.c +++ b/mpp/base/mpp_cluster.c @@ -643,7 +643,7 @@ static void mpp_cluster_srv_deinit(void) MPP_FREE(srv_cluster); } -MPP_SINGLETON(MPP_SGLN_SYS_CFG, mpp_cluster, mpp_cluster_srv_init, mpp_cluster_srv_deinit) +MPP_SINGLETON(MPP_SGLN_CLUSTER, mpp_cluster, mpp_cluster_srv_init, mpp_cluster_srv_deinit) static MppCluster *cluster_server_get(MppClientType client_type) { diff --git a/osal/inc/mpp_singleton.h b/osal/inc/mpp_singleton.h index c9074338..1f064fa1 100644 --- a/osal/inc/mpp_singleton.h +++ b/osal/inc/mpp_singleton.h @@ -21,6 +21,7 @@ typedef enum MppSingletonId_e { MPP_SGLN_SOC, MPP_SGLN_PLATFORM, MPP_SGLN_SERVER, + MPP_SGLN_CLUSTER, /* software platform */ MPP_SGLN_RUNTIME, /* kernel module (MUST before userspace module) */ diff --git a/osal/mpp_singleton.c b/osal/mpp_singleton.c index 4801aa53..d7fb442a 100644 --- a/osal/mpp_singleton.c +++ b/osal/mpp_singleton.c @@ -10,6 +10,7 @@ #include #include "mpp_env.h" +#include "mpp_time.h" #include "mpp_singleton.h" #define sgln_dbg(fmt, ...) \ @@ -86,6 +87,7 @@ static void mpp_singleton_deinit(void) __attribute__((constructor(65535))) static void mpp_singleton_init(void) { + rk_s64 sum = 0; rk_s32 i; sgln_dbg("init enter\n"); @@ -98,16 +100,21 @@ __attribute__((constructor(65535))) static void mpp_singleton_init(void) MppSingletonInfo *info = &sgln_info[i]; if (info->init) { + rk_s64 time; + sgln_dbg("info %2d %-*s init start\n", info->id, sgln_max_name_len, info->name); + time = mpp_time(); info->init(); + time = mpp_time() - time; + sum += time; - sgln_dbg("info %2d %-*s init finish\n", info->id, - sgln_max_name_len, info->name); + sgln_dbg("info %2d %-*s init finish %lld us\n", info->id, + sgln_max_name_len, info->name, time); } } } - sgln_dbg("init leave\n"); + sgln_dbg("init leave total %lld us\n", sum); }