fix[mpp_singleton]: Fix cluster sgln id conflict

1. Add MPP_SGLN_CLUSTER.
2. Add sgln init timing log.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: Id6d6a103f441cbf6a8acc9b00a0d54c788a939d8
This commit is contained in:
Herman Chen 2025-10-24 17:50:07 +08:00
parent b40657a3c7
commit 33f65bd809
3 changed files with 12 additions and 4 deletions

View file

@ -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)
{

View file

@ -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) */

View file

@ -10,6 +10,7 @@
#include <string.h>
#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);
}