Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
99299937
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看板
未验证
提交
99299937
编写于
6月 05, 2023
作者:
O
openharmony_ci
提交者:
Gitee
6月 05, 2023
浏览文件
操作
浏览文件
下载
差异文件
!2018 修改timespec初始化
Merge pull request !2018 from cheng_jinsong/time_init
上级
bcbdd177
005905b7
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
22 addition
and
22 deletion
+22
-22
device_info/device_info_stub.cpp
device_info/device_info_stub.cpp
+1
-1
services/init/init_common_service.c
services/init/init_common_service.c
+1
-1
services/log/init_log.c
services/log/init_log.c
+1
-1
services/loopevent/task/le_asynctask.c
services/loopevent/task/le_asynctask.c
+2
-2
services/modules/bootchart/bootchart.c
services/modules/bootchart/bootchart.c
+2
-2
services/modules/sysevent/startup_time_event.c
services/modules/sysevent/startup_time_event.c
+1
-1
services/param/base/param_base.c
services/param/base/param_base.c
+3
-3
services/param/linux/param_request.c
services/param/linux/param_request.c
+3
-3
services/param/liteos/param_client.c
services/param/liteos/param_client.c
+2
-2
services/param/manager/param_persist.c
services/param/manager/param_persist.c
+2
-2
test/unittest/modules/sysevent_unittest.cpp
test/unittest/modules/sysevent_unittest.cpp
+2
-2
ueventd/standard/ueventd_parameter.c
ueventd/standard/ueventd_parameter.c
+2
-2
未找到文件。
device_info/device_info_stub.cpp
浏览文件 @
99299937
...
...
@@ -52,7 +52,7 @@ static void UnloadDeviceInfoSa(int signo)
{
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
g_lock
);
struct
timespec
currTimer
=
{};
struct
timespec
currTimer
=
{
0
};
(
void
)
clock_gettime
(
CLOCK_MONOTONIC
,
&
currTimer
);
if
(
IntervalTime
(
&
g_lastTime
,
&
currTimer
)
<
DEVICE_INFO_EXIT_TIMEOUT_S
)
{
alarm
(
DEVICE_INFO_EXIT_TIMEOUT_S
/
3
);
// 3 half
...
...
services/init/init_common_service.c
浏览文件 @
99299937
...
...
@@ -573,7 +573,7 @@ static bool CalculateCrashTime(Service *service, int crashTimeLimit, int crashCo
{
INIT_ERROR_CHECK
(
service
!=
NULL
&&
crashTimeLimit
>
0
&&
crashCountLimit
>
0
,
return
false
,
"input params error."
);
struct
timespec
curTime
=
{};
struct
timespec
curTime
=
{
0
};
(
void
)
clock_gettime
(
CLOCK_MONOTONIC
,
&
curTime
);
struct
timespec
crashTime
=
{
service
->
firstCrashTime
,
0
};
if
(
service
->
crashCnt
==
0
)
{
...
...
services/log/init_log.c
浏览文件 @
99299937
...
...
@@ -41,7 +41,7 @@ static InitLogLevel g_logLevel = INIT_INFO;
#ifdef INIT_FILE
static
void
LogToFile
(
const
char
*
logFile
,
const
char
*
tag
,
const
char
*
info
)
{
struct
timespec
curr
;
struct
timespec
curr
=
{
0
}
;
if
(
clock_gettime
(
CLOCK_REALTIME
,
&
curr
)
!=
0
)
{
return
;
}
...
...
services/loopevent/task/le_asynctask.c
浏览文件 @
99299937
...
...
@@ -25,8 +25,8 @@ static void DoAsyncEvent_(const LoopHandle loopHandle, AsyncEventTask *asyncTask
{
LE_CHECK
(
loopHandle
!=
NULL
&&
asyncTask
!=
NULL
,
return
,
"Invalid parameters"
);
#ifdef LOOP_DEBUG
struct
timespec
startTime
;
struct
timespec
endTime
;
struct
timespec
startTime
=
{
0
}
;
struct
timespec
endTime
=
{
0
}
;
long
long
diff
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
(
startTime
));
#endif
...
...
services/modules/bootchart/bootchart.c
浏览文件 @
99299937
...
...
@@ -174,8 +174,8 @@ BOOTCHART_STATIC void *BootchartThreadMain(void *data)
BootchartLogHeader
();
while
(
1
)
{
pthread_mutex_lock
(
&
(
g_bootchartCtrl
->
mutex
));
struct
timespec
abstime
=
{};
struct
timeval
now
=
{};
struct
timespec
abstime
=
{
0
};
struct
timeval
now
=
{
0
};
const
long
timeout
=
200
;
// wait time 200ms
gettimeofday
(
&
now
,
NULL
);
long
nsec
=
now
.
tv_usec
*
1000
+
(
timeout
%
1000
)
*
1000000
;
// 1000 unit 1000000 unit nsec
...
...
services/modules/sysevent/startup_time_event.c
浏览文件 @
99299937
...
...
@@ -73,7 +73,7 @@ static int TraversalEvent(ListNode *node, void *root)
PLUGIN_STATIC
void
ReportBootEventComplete
(
ListNode
*
events
)
{
PLUGIN_CHECK
(
events
!=
NULL
,
return
,
"Invalid events"
);
struct
timespec
curr
;
struct
timespec
curr
=
{
0
}
;
if
(
clock_gettime
(
CLOCK_MONOTONIC
,
&
curr
)
!=
0
)
{
return
;
}
...
...
services/param/base/param_base.c
浏览文件 @
99299937
...
...
@@ -816,7 +816,7 @@ void CachedParameterDestroy(CachedHandle handle)
#define MAX_TEST 10000
STATIC_INLINE
long
long
DiffLocalTime
(
struct
timespec
*
startTime
)
{
struct
timespec
endTime
;
struct
timespec
endTime
=
{
0
}
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
(
endTime
));
long
long
diff
=
(
long
long
)((
endTime
.
tv_sec
-
startTime
->
tv_sec
)
*
1000000
);
// 1000000 1000ms
if
(
endTime
.
tv_nsec
>
startTime
->
tv_nsec
)
{
...
...
@@ -829,7 +829,7 @@ STATIC_INLINE long long DiffLocalTime(struct timespec *startTime)
static
void
TestPermissionCheck
(
const
char
*
testParamName
)
{
struct
timespec
startTime
;
struct
timespec
startTime
=
{
0
}
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
(
startTime
));
ParamSecurityLabel
*
label
=
&
(
GetParamWorkSpace
()
->
securityLabel
);
ParamLabelIndex
labelIndex
=
{
0
};
...
...
@@ -879,7 +879,7 @@ static void TestPermissionCheck(const char *testParamName)
void
TestParameterReaderPerformance
(
void
)
{
struct
timespec
startTime
;
struct
timespec
startTime
=
{
0
}
;
const
char
*
testParamName
=
"persist.appspawn.randrom.read"
;
const
uint32_t
buffSize
=
PARAM_VALUE_LEN_MAX
;
char
buffer
[
PARAM_VALUE_LEN_MAX
]
=
{
0
};
...
...
services/param/linux/param_request.c
浏览文件 @
99299937
...
...
@@ -93,14 +93,14 @@ static int ReadMessage(int fd, char *buffer, uint32_t timeout)
{
int
ret
=
0
;
uint32_t
diff
=
0
;
struct
timespec
startTime
=
{};
struct
timespec
startTime
=
{
0
};
(
void
)
clock_gettime
(
CLOCK_MONOTONIC
,
&
startTime
);
do
{
ssize_t
recvLen
=
recv
(
fd
,
(
char
*
)
buffer
,
RECV_BUFFER_MAX
,
0
);
if
(
recvLen
>
0
)
{
break
;
}
struct
timespec
finishTime
=
{};
struct
timespec
finishTime
=
{
0
};
(
void
)
clock_gettime
(
CLOCK_MONOTONIC
,
&
finishTime
);
diff
=
IntervalTime
(
&
finishTime
,
&
startTime
);
if
(
diff
>=
timeout
)
{
...
...
@@ -120,7 +120,7 @@ static int ReadMessage(int fd, char *buffer, uint32_t timeout)
static
int
GetClientSocket
(
int
timeout
)
{
struct
timeval
time
;
struct
timeval
time
=
{
0
}
;
time
.
tv_sec
=
timeout
;
time
.
tv_usec
=
0
;
int
clientFd
=
socket
(
AF_UNIX
,
SOCK_STREAM
|
SOCK_CLOEXEC
,
0
);
...
...
services/param/liteos/param_client.c
浏览文件 @
99299937
...
...
@@ -71,7 +71,7 @@ int SystemWaitParameter(const char *name, const char *value, int32_t timeout)
int
ret
=
CheckParamPermission
(
GetParamSecurityLabel
(),
name
,
DAC_READ
);
PARAM_CHECK
(
ret
==
0
,
return
ret
,
"Forbid to wait parameter %s"
,
name
);
uint32_t
diff
=
0
;
struct
timespec
startTime
=
{};
struct
timespec
startTime
=
{
0
};
if
(
timeout
<=
0
)
{
timeout
=
DEFAULT_PARAM_WAIT_TIMEOUT
;
}
...
...
@@ -88,7 +88,7 @@ int SystemWaitParameter(const char *name, const char *value, int32_t timeout)
globalCommit
=
commit
;
usleep
(
MIN_SLEEP
);
struct
timespec
finishTime
=
{};
struct
timespec
finishTime
=
{
0
};
(
void
)
clock_gettime
(
CLOCK_MONOTONIC
,
&
finishTime
);
diff
=
IntervalTime
(
&
finishTime
,
&
startTime
);
if
(
diff
>=
timeout
)
{
...
...
services/param/manager/param_persist.c
浏览文件 @
99299937
...
...
@@ -23,7 +23,7 @@
#include "param_osadp.h"
#include "securec.h"
static
ParamPersistWorkSpace
g_persistWorkSpace
=
{
0
,
0
,
NULL
,
{},
{
0
}};
static
ParamPersistWorkSpace
g_persistWorkSpace
=
{
0
,
0
,
NULL
,
{
0
},
{
0
}};
static
int
IsNeedToSave
(
const
char
*
name
)
{
#if defined(__LITEOS_M__) || defined(__LITEOS_A__)
...
...
@@ -194,7 +194,7 @@ INIT_LOCAL_API int WritePersistParam(const char *name, const char *value)
}
// check timer for save all
struct
timespec
currTimer
=
{};
struct
timespec
currTimer
=
{
0
};
(
void
)
clock_gettime
(
CLOCK_MONOTONIC
,
&
currTimer
);
uint32_t
diff
=
IntervalTime
(
&
g_persistWorkSpace
.
lastSaveTimer
,
&
currTimer
);
if
(
diff
>
PARAM_MUST_SAVE_PARAM_DIFF
)
{
...
...
test/unittest/modules/sysevent_unittest.cpp
浏览文件 @
99299937
...
...
@@ -95,7 +95,7 @@ HWTEST_F(SysEventUnitTest, SysEventTest_003, TestSize.Level1)
HWTEST_F
(
SysEventUnitTest
,
SysEventTest_004
,
TestSize
.
Level1
)
{
struct
timespec
curr
;
struct
timespec
curr
=
{
0
}
;
if
(
clock_gettime
(
CLOCK_MONOTONIC
,
&
curr
)
!=
0
)
{
return
;
}
...
...
@@ -112,7 +112,7 @@ HWTEST_F(SysEventUnitTest, SysEventTest_004, TestSize.Level1)
HWTEST_F
(
SysEventUnitTest
,
SysEventTest_005
,
TestSize
.
Level1
)
{
struct
timespec
curr
;
struct
timespec
curr
=
{
0
}
;
if
(
clock_gettime
(
CLOCK_MONOTONIC
,
&
curr
)
!=
0
)
{
return
;
}
...
...
ueventd/standard/ueventd_parameter.c
浏览文件 @
99299937
...
...
@@ -68,8 +68,8 @@ static void *ThreadRun(void *data)
while
(
1
)
{
pthread_mutex_lock
(
&
(
parameterCtrl
->
lock
));
if
(
parameterCtrl
->
empty
)
{
struct
timespec
abstime
=
{};
struct
timeval
now
=
{};
struct
timespec
abstime
=
{
0
};
struct
timeval
now
=
{
0
};
const
long
timeout
=
5000
;
// wait time 5000ms
gettimeofday
(
&
now
,
NULL
);
long
nsec
=
now
.
tv_usec
*
1000
+
(
timeout
%
1000
)
*
1000000
;
// 1000 unit 1000000 unit nsec
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录