Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ReyunSecureSdk
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhanglei
ReyunSecureSdk
Commits
d30f8220
Commit
d30f8220
authored
Apr 12, 2021
by
leiguo1029
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
\
parent
54f9f189
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
collect.c
wandun/src/main/cpp/collect.c
+17
-14
No files found.
wandun/src/main/cpp/collect.c
View file @
d30f8220
...
...
@@ -430,32 +430,33 @@ void collect_mem_info(JNIEnv *env, cJSON *json) {
//get ram
struct
sysinfo
si
;
if
(
WDSYSCALL
(
SYS_sysinfo
,
&
si
)
==
0
)
{
double
ram_total
=
((
double
)(
si
.
totalram
*
si
.
mem_unit
))
/
1024
/
1024
/
1024
;
double
ram_free
=
((
double
)(
si
.
freeram
*
si
.
mem_unit
))
/
1024
/
1024
/
1024
;
u_long
ram_total
=
si
.
totalram
*
si
.
mem_unit
;
u_long
ram_free
=
si
.
freeram
*
si
.
mem_unit
;
char
ram_buf
[
32
]
=
{
0
};
snprintf
(
ram_buf
,
31
,
"
%.3lf, %.3lf
"
,
ram_total
,
ram_free
);
snprintf
(
ram_buf
,
31
,
"
lu, %lu
"
,
ram_total
,
ram_free
);
cJSON_AddStringToObject
(
item
,
"ram"
,
ram_buf
);
}
//get rom
struct
statfs
sf
;
if
(
WDSYSCALL
(
SYS_statfs
,
"/data"
,
&
sf
)
==
0
)
{
double
rom_total
=
((
double
)(
sf
.
f_blocks
*
sf
.
f_bsize
))
/
1024
/
1024
/
1024
;
double
rom_free
=
((
double
)(
sf
.
f_bfree
*
sf
.
f_bsize
))
/
1024
/
1024
/
1024
;
char
rom
_buf
[
32
]
=
{
0
};
snprintf
(
rom_buf
,
31
,
"%.3lf, %.3lf"
,
rom_total
,
rom
_free
);
cJSON_AddStringToObject
(
item
,
"rom"
,
rom
_buf
);
u_long
data_total
=
sf
.
f_blocks
*
sf
.
f_bsize
;
u_long
data_free
=
sf
.
f_bfree
*
sf
.
f_bsize
;
char
sdcard
_buf
[
32
]
=
{
0
};
snprintf
(
sdcard_buf
,
31
,
"%lu, %lu"
,
data_total
,
data
_free
);
cJSON_AddStringToObject
(
item
,
"rom"
,
sdcard
_buf
);
}
//get sdcard
/*
struct statfs sf2;
if(WDSYSCALL(SYS_statfs, "/sdcard", &sf2) == 0) {
double
sdcard_total
=
((
double
)(
sf2
.
f_blocks
*
sf2
.
f_bsize
))
/
1024
/
1024
/
1024
;
double
sdcard_free
=
((
double
)(
sf2
.
f_bfree
*
sf2
.
f_bsize
))
/
1024
/
1024
/
1024
;
u_long sdcard_total = sf2.f_blocks * sf2.f_bsize
;
u_long sdcard_free = sf2.f_bfree * sf2.f_bsize
;
char sdcard_buf[32] = {0};
snprintf
(
sdcard_buf
,
31
,
"%
.3lf, %.3lf
"
,
sdcard_total
,
sdcard_free
);
snprintf(sdcard_buf, 31, "%
lu, %lu
", sdcard_total, sdcard_free);
cJSON_AddStringToObject(item, "sdcard", sdcard_buf);
}
}
*/
cJSON_AddItemToObject
(
json
,
"mem"
,
item
);
logd
(
WD_COLLECT
,
"%s"
,
"collect mem_info finished..."
);
...
...
@@ -635,12 +636,14 @@ void collect_system_id(JNIEnv *env, cJSON *json) {
void
collect_time_info
(
JNIEnv
*
env
,
cJSON
*
json
)
{
// current_time
struct
timespec
ts
=
{
0
};
time_t
cur
;
if
(
WDSYSCALL
(
SYS_clock_gettime
,
CLOCK_REALTIME
,
&
ts
)
==
0
)
{
cJSON_AddNumberToObject
(
json
,
"cur_time"
,
ts
.
tv_sec
);
cur
=
ts
.
tv_sec
;
cJSON_AddNumberToObject
(
json
,
"cur_time"
,
cur
);
}
if
(
WDSYSCALL
(
SYS_clock_gettime
,
CLOCK_BOOTTIME
,
&
ts
)
==
0
)
{
cJSON_AddNumberToObject
(
json
,
"
start_boot_time"
,
ts
.
tv_sec
);
cJSON_AddNumberToObject
(
json
,
"
boot_time"
,
ts
.
tv_sec
-
cur
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment