提交 9afda3bf 编写于 作者: X xionglei6

add bootchart

Signed-off-by: Nxionglei6 <xionglei6@huawei.com>
上级 9955b2d7
......@@ -31,7 +31,7 @@ static void ServiceStateChange(const char *key, const char *value, void *context
const InitArgInfo *statusMap = GetServieStatusMap(&size);
ServiceStatus status = (ServiceStatus)GetMapValue(value, statusMap, size, SERVICE_IDLE);
if (strlen(key) > strlen(STARTUP_SERVICE_CTL)) {
callback(key + strlen(STARTUP_SERVICE_CTL), status);
callback(key + strlen(STARTUP_SERVICE_CTL) + 1, status);
} else {
BEGET_LOGE("Invalid service name %s %s", key, value);
}
......
......@@ -45,6 +45,13 @@ static int bootchartCmdStart(BShellHandle shell, int argc, char **argv)
char *helpArgs[] = {"bootchart", NULL};
BShellCmdHelp(shell, 1, helpArgs);
}
char enable[4] = {}; // 4 enable size
uint32_t size = sizeof(enable);
int ret = SystemGetParameter("init.bootchart.enabled", enable, &size);
if (ret != 0 || strcmp(enable, "1") != 0) {
BShellEnvOutput(shell, "Not bootcharting\r\n");
return 0;
}
SystemSetParameter("ohos.servicectrl.bootchart", "start");
return 0;
}
......
......@@ -33,12 +33,12 @@
static BootchartCtrl *g_bootchartCtrl = NULL;
static PluginInterface *g_pluginInterface = NULL;
static int64_t GetJiffies(void)
static long long GetJiffies(void)
{
struct timespec time1 = {0};
clock_gettime(CLOCK_MONOTONIC, &time1);
int64_t jiffies1 = (int64_t)time1.tv_nsec / NANO_PRE_JIFFY;
int64_t jiffies2 = (int64_t)time1.tv_sec * (1000000000 / NANO_PRE_JIFFY); // 1000000000 to nsec
long long jiffies1 = (long long)time1.tv_nsec / NANO_PRE_JIFFY;
long long jiffies2 = (long long)time1.tv_sec * (1000000000 / NANO_PRE_JIFFY); // 1000000000 to nsec
return jiffies1 + jiffies2;
}
......
......@@ -130,7 +130,7 @@ static int32_t BShellParamCmdDisplay(BShellHandle shell, int32_t argc, char *arg
void ServiceStatusChangeTest(const char *key, ServiceStatus status)
{
PLUGIN_LOGI("ServiceStatusChangeTest %s status: %d", key, status);
PLUGIN_LOGI("group-test-stage3: wait service %s status: %d", key, status);
if (status == SERVICE_READY || status == SERVICE_STARTED) {
PLUGIN_LOGI("Service %s start work", key);
}
......@@ -141,6 +141,7 @@ static int32_t BShellParamCmdGroupTest(BShellHandle shell, int32_t argc, char *a
PLUGIN_CHECK(argc >= 1, return -1, "Invalid parameter");
PLUGIN_LOGI("BShellParamCmdGroupTest %s stage: %s", argv[0], argv[1]);
if (argc > 2 && strcmp(argv[1], "wait") == 0) { // 2 service name index
PLUGIN_LOGI("group-test-stage3: wait service %s", argv[2]); // 2 service name index
ServiceWatchForStatus(argv[2], ServiceStatusChangeTest); // 2 service name index
LE_RunLoop(LE_GetDefaultLoop());
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册