提交 3118c289 编写于 作者: M Mupceet

init: fix bugs

Signed-off-by: NMupceet <laiguizhong@huawei.com>
上级 8cb57654
......@@ -130,6 +130,7 @@ if (defined(ohos_lite)) {
"stop_service",
"service",
"sandbox",
"dump_service",
]
install_images = [ "system" ]
......
......@@ -63,11 +63,8 @@ void ReleaseService(Service *service);
void StartAllServices(int startMode);
void LoadAccessTokenId(void);
Service *AddService(const char *name);
#ifdef OHOS_SERVICE_DUMP
void DumpAllServices();
void DumpAllServices(void);
void DumpOneService(const Service *service);
#endif
#ifdef __cplusplus
#if __cplusplus
}
......
......@@ -43,7 +43,6 @@ static const int CRITICAL_DEFAULT_CRASH_TIME = 20;
static const int CRITICAL_DEFAULT_CRASH_COUNT = 4;
static const int CRITICAL_CONFIG_ARRAY_LEN = 3;
#ifdef OHOS_SERVICE_DUMP
static void DumpServiceArgs(const char *info, const ServiceArgs *args)
{
printf("\tservice %s count %d \n", info, args->count);
......@@ -116,7 +115,7 @@ void DumpOneService(const Service *service)
}
}
void DumpAllServices()
void DumpAllServices(void)
{
printf("Ready to dump all services: \n");
printf("total service number: %d \n", g_serviceSpace.serviceCount);
......@@ -132,7 +131,6 @@ void DumpAllServices()
}
printf("Dump all services finished \n");
}
#endif
static void FreeServiceArg(ServiceArgs *arg)
{
......
......@@ -266,7 +266,6 @@ static int SystemDump(int id, const char *name, int argc, const char **argv)
{
INIT_ERROR_CHECK(argv != NULL && argc >= 1, return 0, "Invalid install parameter");
INIT_LOGI("Dump system info %s", argv[0]);
DumpAllServices();
SystemDumpParameters(1);
SystemDumpTriggers(1);
return 0;
......@@ -318,18 +317,19 @@ static void InitPreHook(const HOOK_INFO *hookInfo)
static void InitPostHook(const HOOK_INFO *hookInfo)
{
long long diff;
const long long baseTime = 1000;
HOOK_TIMING_STAT *stat = (HOOK_TIMING_STAT *)hookInfo->cookie;
clock_gettime(CLOCK_MONOTONIC, &(stat->endTime));
diff = (long long)((stat->endTime.tv_sec - stat->startTime.tv_sec) / 1000);
diff = (long long)((stat->endTime.tv_sec - stat->startTime.tv_sec) / baseTime);
if (stat->endTime.tv_nsec > stat->startTime.tv_nsec) {
diff += (stat->endTime.tv_nsec - stat->startTime.tv_nsec) * 1000;
diff += (stat->endTime.tv_nsec - stat->startTime.tv_nsec) * baseTime;
} else {
diff -= (stat->endTime.tv_nsec - stat->startTime.tv_nsec) * 1000;
diff -= (stat->endTime.tv_nsec - stat->startTime.tv_nsec) * baseTime;
}
INIT_LOGV("Executing hook [%d:%d:%p] cost [%lld]ms, return %d.",
hookInfo->stage, hookInfo->prio, hookInfo->hook, diff, hookInfo->retVal);
hookInfo->stage, hookInfo->prio, hookInfo->hook, diff, hookInfo->retVal);
}
void SystemConfig(void)
......
......@@ -47,11 +47,9 @@ static void ProcessDumpServiceControlFd(uint16_t type, const char *serviceCmd)
Service *service = GetServiceByName(serviceCmd);
if (service == NULL) {
#ifdef OHOS_SERVICE_DUMP
DumpAllServices();
} else {
DumpOneService(service);
#endif
}
return;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册