Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
64569938
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
大约 1 年 前同步成功
通知
3
Star
37
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Startup Init Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
64569938
编写于
7月 20, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 20, 2023
浏览文件
操作
浏览文件
下载
差异文件
!2130 Fix: 修改时间单位与换算不统一
Merge pull request !2130 from cheng_jinsong/init_0719
上级
81396cf8
159769a6
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
15 addition
and
15 deletion
+15
-15
services/modules/bootevent/bootevent.c
services/modules/bootevent/bootevent.c
+4
-4
services/modules/bootevent/bootevent.h
services/modules/bootevent/bootevent.h
+2
-2
services/modules/sysevent/startup_time_event.c
services/modules/sysevent/startup_time_event.c
+5
-5
test/unittest/modules/sysevent_unittest.cpp
test/unittest/modules/sysevent_unittest.cpp
+4
-4
未找到文件。
services/modules/bootevent/bootevent.c
浏览文件 @
64569938
...
...
@@ -146,10 +146,10 @@ static int BootEventTraversal(ListNode *node, void *root)
{
static
int
start
=
0
;
BOOT_EVENT_PARAM_ITEM
*
item
=
(
BOOT_EVENT_PARAM_ITEM
*
)
node
;
double
forkTime
=
item
->
timestamp
[
BOOTEVENT_FORK
].
tv_sec
*
SECTOM
SEC
+
(
double
)
item
->
timestamp
[
BOOTEVENT_FORK
].
tv_nsec
/
MSEC
TONSEC
;
double
readyTime
=
item
->
timestamp
[
BOOTEVENT_READY
].
tv_sec
*
SECTOM
SEC
+
(
double
)
item
->
timestamp
[
BOOTEVENT_READY
].
tv_nsec
/
MSEC
TONSEC
;
double
forkTime
=
item
->
timestamp
[
BOOTEVENT_FORK
].
tv_sec
*
MSECTON
SEC
+
(
double
)
item
->
timestamp
[
BOOTEVENT_FORK
].
tv_nsec
/
US
TONSEC
;
double
readyTime
=
item
->
timestamp
[
BOOTEVENT_READY
].
tv_sec
*
MSECTON
SEC
+
(
double
)
item
->
timestamp
[
BOOTEVENT_READY
].
tv_nsec
/
US
TONSEC
;
double
durTime
=
readyTime
-
forkTime
;
if
(
item
->
pid
==
0
)
{
if
(
durTime
<
SAVEINITBOOTEVENTMSEC
)
{
...
...
services/modules/bootevent/bootevent.h
浏览文件 @
64569938
...
...
@@ -33,9 +33,9 @@ extern "C" {
#define BOOT_EVENT_TIMESTAMP_MAX_LEN 50
#define BOOT_EVENT_FILEPATH_MAX_LEN 60
#define BOOT_EVENT_FINISH 2
#define
SECTOMSEC
1000000
#define
MSECTONSEC
1000000
#define SECTONSEC 1000000000
#define
MSEC
TONSEC 1000
#define
US
TONSEC 1000
#define SAVEINITBOOTEVENTMSEC 100000
#define BOOTEVENT_OUTPUT_PATH "/data/service/el0/startup/init/"
...
...
services/modules/sysevent/startup_time_event.c
浏览文件 @
64569938
...
...
@@ -61,9 +61,9 @@ static int TraversalEvent(ListNode *node, void *root)
len
=
sprintf_s
(
args
->
buffer
+
args
->
currLen
,
args
->
bufferLen
-
args
->
currLen
,
",%u:%u,%u:%u;"
,
(
uint32_t
)
item
->
timestamp
[
BOOTEVENT_FORK
].
tv_sec
,
(
uint32_t
)(
item
->
timestamp
[
BOOTEVENT_FORK
].
tv_nsec
/
MSEC
TONSEC
),
(
uint32_t
)(
item
->
timestamp
[
BOOTEVENT_FORK
].
tv_nsec
/
US
TONSEC
),
(
uint32_t
)
item
->
timestamp
[
BOOTEVENT_READY
].
tv_sec
,
(
uint32_t
)(
item
->
timestamp
[
BOOTEVENT_READY
].
tv_nsec
/
MSEC
TONSEC
));
(
uint32_t
)(
item
->
timestamp
[
BOOTEVENT_READY
].
tv_nsec
/
US
TONSEC
));
PLUGIN_CHECK
(
len
>
0
&&
(((
uint32_t
)
len
+
args
->
currLen
)
<
args
->
bufferLen
),
return
-
1
,
"Failed to format service time %s"
,
item
->
paramName
);
args
->
currLen
+=
(
uint32_t
)
len
;
...
...
@@ -88,8 +88,8 @@ PLUGIN_STATIC void ReportBootEventComplete(ListNode *events)
StartupTimeEvent
startupTime
=
{};
startupTime
.
event
.
type
=
STARTUP_TIME
;
startupTime
.
totalTime
=
curr
.
tv_sec
;
startupTime
.
totalTime
=
startupTime
.
totalTime
*
SECTOM
SEC
;
startupTime
.
totalTime
+=
curr
.
tv_nsec
/
MSEC
TONSEC
;
startupTime
.
totalTime
=
startupTime
.
totalTime
*
MSECTON
SEC
;
startupTime
.
totalTime
+=
curr
.
tv_nsec
/
US
TONSEC
;
startupTime
.
detailTime
=
buffer
;
char
*
reason
=
buffer
+
MAX_BUFFER_FOR_EVENT
;
uint32_t
size
=
PARAM_VALUE_LEN_MAX
;
...
...
@@ -102,7 +102,7 @@ PLUGIN_STATIC void ReportBootEventComplete(ListNode *events)
startupTime
.
firstStart
=
0
;
}
PLUGIN_LOGI
(
"SysEventInit %u.%u detailTime len %u '%s'"
,
(
uint32_t
)
curr
.
tv_sec
,
(
uint32_t
)(
curr
.
tv_nsec
/
MSEC
TONSEC
),
args
.
currLen
,
startupTime
.
detailTime
);
(
uint32_t
)
curr
.
tv_sec
,
(
uint32_t
)(
curr
.
tv_nsec
/
US
TONSEC
),
args
.
currLen
,
startupTime
.
detailTime
);
ReportSysEvent
(
&
startupTime
.
event
);
free
(
buffer
);
}
...
...
test/unittest/modules/sysevent_unittest.cpp
浏览文件 @
64569938
...
...
@@ -102,8 +102,8 @@ HWTEST_F(SysEventUnitTest, SysEventTest_004, TestSize.Level1)
StartupTimeEvent
startupTime
=
{};
startupTime
.
event
.
type
=
STARTUP_TIME
;
startupTime
.
totalTime
=
curr
.
tv_sec
;
startupTime
.
totalTime
=
startupTime
.
totalTime
*
SECTOM
SEC
;
startupTime
.
totalTime
+=
curr
.
tv_nsec
/
MSEC
TONSEC
;
startupTime
.
totalTime
=
startupTime
.
totalTime
*
MSECTON
SEC
;
startupTime
.
totalTime
+=
curr
.
tv_nsec
/
US
TONSEC
;
startupTime
.
detailTime
=
const_cast
<
char
*>
(
"buffer"
);
startupTime
.
reason
=
const_cast
<
char
*>
(
""
);
startupTime
.
firstStart
=
1
;
...
...
@@ -119,8 +119,8 @@ HWTEST_F(SysEventUnitTest, SysEventTest_005, TestSize.Level1)
StartupTimeEvent
startupTime
=
{};
startupTime
.
event
.
type
=
STARTUP_EVENT_MAX
;
startupTime
.
totalTime
=
curr
.
tv_sec
;
startupTime
.
totalTime
=
startupTime
.
totalTime
*
SECTOM
SEC
;
startupTime
.
totalTime
+=
curr
.
tv_nsec
/
MSEC
TONSEC
;
startupTime
.
totalTime
=
startupTime
.
totalTime
*
MSECTON
SEC
;
startupTime
.
totalTime
+=
curr
.
tv_nsec
/
US
TONSEC
;
startupTime
.
detailTime
=
const_cast
<
char
*>
(
"buffer"
);
startupTime
.
reason
=
const_cast
<
char
*>
(
""
);
startupTime
.
firstStart
=
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录