Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
ae076e5e
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ae076e5e
编写于
7月 04, 2023
作者:
X
xujie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
Change-Id: I4b47539358b88d85d9e2f06551556ee1adb06052 Signed-off-by:
N
xujie
<
xujie223@huawei.com
>
上级
2e486b13
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
35 addition
and
35 deletion
+35
-35
zh-cn/application-dev/reference/apis/js-apis-net-statistics.md
.../application-dev/reference/apis/js-apis-net-statistics.md
+35
-35
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-net-statistics.md
浏览文件 @
ae076e5e
...
...
@@ -660,9 +660,9 @@ off(type: 'netStatsChange', callback?: Callback\<{ iface: string, uid?: number }
statistics
.
off
(
'
netStatsChange
'
);
```
## statistics.get
IfaceStats
<sup>10+</sup>
## statistics.get
TrafficStatsByIface
<sup>10+</sup>
get
IfaceStats
(ifaceInfo: IfaceInfo, callback: AsyncCallback
\<
NetStatsInfo>): void;
get
TrafficStatsByIface
(ifaceInfo: IfaceInfo, callback: AsyncCallback
\<
NetStatsInfo>): void;
获取网卡历史流量信息,使用callback方式作为异步方法。
...
...
@@ -702,18 +702,18 @@ getIfaceStats(ifaceInfo: IfaceInfo, callback: AsyncCallback\<NetStatsInfo>): voi
endTime
:
16859485670
}
statistics
.
get
IfaceStats
(
ifaceInfo
),
(
error
,
statsInfo
)
=>
{
statistics
.
get
TrafficStatsByIface
(
ifaceInfo
),
(
error
,
statsInfo
)
=>
{
console
.
log
(
JSON
.
stringify
(
error
))
console
.
log
(
"
get
IfaceStats
bytes of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxBytes
));
console
.
log
(
"
get
IfaceStats
bytes of send =
"
+
JSON
.
stringify
(
statsInfo
.
txBytes
));
console
.
log
(
"
get
IfaceStats
packets of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxPackets
));
console
.
log
(
"
get
IfaceStats
packets of send =
"
+
JSON
.
stringify
(
statsInfo
.
txPackets
));
console
.
log
(
"
get
TrafficStatsByIface
bytes of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxBytes
));
console
.
log
(
"
get
TrafficStatsByIface
bytes of send =
"
+
JSON
.
stringify
(
statsInfo
.
txBytes
));
console
.
log
(
"
get
TrafficStatsByIface
packets of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxPackets
));
console
.
log
(
"
get
TrafficStatsByIface
packets of send =
"
+
JSON
.
stringify
(
statsInfo
.
txPackets
));
});
```
## statistics.get
IfaceStats
<sup>10+</sup>
## statistics.get
TrafficStatsByIface
<sup>10+</sup>
get
IfaceStats
(ifaceInfo: IfaceInfo): Promise
\<
NetStatsInfo>;
get
TrafficStatsByIface
(ifaceInfo: IfaceInfo): Promise
\<
NetStatsInfo>;
获取网卡历史流量信息,使用Promise方式作为异步方法。
...
...
@@ -730,7 +730,7 @@ getIfaceStats(ifaceInfo: IfaceInfo): Promise\<NetStatsInfo>;
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise
\<
[
NetStatsInfo
](
#NetStatsInfo
)
> | 以Promise形式返回获取结果
。成功时NetStatsInfo返回包含
网卡历史流量信息。 |
| Promise
\<
[
NetStatsInfo
](
#NetStatsInfo
)
> | 以Promise形式返回获取结果
,返回
网卡历史流量信息。 |
**错误码:**
...
...
@@ -755,17 +755,17 @@ getIfaceStats(ifaceInfo: IfaceInfo): Promise\<NetStatsInfo>;
endTime
:
16859485670
}
statistics
.
get
IfaceStats
().
then
(
function
(
statsInfo
)
{
console
.
log
(
"
get
IfaceStats
bytes of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxBytes
));
console
.
log
(
"
get
IfaceStats
bytes of send =
"
+
JSON
.
stringify
(
statsInfo
.
txBytes
));
console
.
log
(
"
get
IfaceStats
packets of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxPackets
));
console
.
log
(
"
get
IfaceStats
packets of send =
"
+
JSON
.
stringify
(
statsInfo
.
txPackets
));
statistics
.
get
TrafficStatsByIface
().
then
(
function
(
statsInfo
)
{
console
.
log
(
"
get
TrafficStatsByIface
bytes of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxBytes
));
console
.
log
(
"
get
TrafficStatsByIface
bytes of send =
"
+
JSON
.
stringify
(
statsInfo
.
txBytes
));
console
.
log
(
"
get
TrafficStatsByIface
packets of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxPackets
));
console
.
log
(
"
get
TrafficStatsByIface
packets of send =
"
+
JSON
.
stringify
(
statsInfo
.
txPackets
));
})
```
## statistics.get
IfaceUidStats
<sup>10+</sup>
## statistics.get
TrafficStatsByUid
<sup>10+</sup>
get
IfaceUidStats(uidStatsInfo: UidStats
Info, callback: AsyncCallback
\<
NetStatsInfo>): void;
get
TrafficStatsByUid(uidInfo: Uid
Info, callback: AsyncCallback
\<
NetStatsInfo>): void;
获取应用历史流量信息,使用callback方式作为异步方法。
...
...
@@ -779,7 +779,7 @@ getIfaceUidStats(uidStatsInfo: UidStatsInfo, callback: AsyncCallback\<NetStatsIn
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
| uid
StatsInfo |
[
UidStatsInfo
](
#UidStatsInfo
)
| 是 | 指定查询的应用历史流量信息,参见
[
UidStatsInfo
](
#UidStats
Info
)
。 |
| uid
Info |
[
UidInfo
](
#UidInfo
)
| 是 | 指定查询的应用历史流量信息,参见
[
UidInfo
](
#Uid
Info
)
。 |
| callback | AsyncCallback
\<
[
NetStatsInfo
](
#NetStatsInfo
)
> | 是 | 回调函数。成功时statsInfo返回包含应用历史流量信息,error为undefined,否则为错误对象|
**错误码:**
...
...
@@ -799,7 +799,7 @@ getIfaceUidStats(uidStatsInfo: UidStatsInfo, callback: AsyncCallback\<NetStatsIn
**示例:**
```
js
let
uid
Stats
Info
=
{
let
uidInfo
=
{
ifaceInfo
:
{
iface
:
"
wlan0
"
,
startTime
:
1685948465
,
...
...
@@ -808,18 +808,18 @@ getIfaceUidStats(uidStatsInfo: UidStatsInfo, callback: AsyncCallback\<NetStatsIn
uid
:
20010037
}
statistics
.
get
IfaceStats
(
uidStats
Info
),
(
error
,
statsInfo
)
=>
{
statistics
.
get
TrafficStatsByUid
(
uid
Info
),
(
error
,
statsInfo
)
=>
{
console
.
log
(
JSON
.
stringify
(
error
))
console
.
log
(
"
get
IfaceStats
bytes of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxBytes
));
console
.
log
(
"
get
IfaceStats
bytes of send =
"
+
JSON
.
stringify
(
statsInfo
.
txBytes
));
console
.
log
(
"
get
IfaceStats
packets of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxPackets
));
console
.
log
(
"
get
IfaceStats
packets of send =
"
+
JSON
.
stringify
(
statsInfo
.
txPackets
));
console
.
log
(
"
get
TrafficStatsByUid
bytes of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxBytes
));
console
.
log
(
"
get
TrafficStatsByUid
bytes of send =
"
+
JSON
.
stringify
(
statsInfo
.
txBytes
));
console
.
log
(
"
get
TrafficStatsByUid
packets of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxPackets
));
console
.
log
(
"
get
TrafficStatsByUid
packets of send =
"
+
JSON
.
stringify
(
statsInfo
.
txPackets
));
});
```
## statistics.get
IfaceUidStats
<sup>10+</sup>
## statistics.get
TrafficStatsByUid
<sup>10+</sup>
get
IfaceUidStats(uidStatsInfo: UidStats
Info): Promise
\<
NetStatsInfo>;
get
TrafficStatsByUid(uidInfo: Uid
Info): Promise
\<
NetStatsInfo>;
获取应用历史流量信息,使用Promise方式作为异步方法。
...
...
@@ -833,13 +833,13 @@ getIfaceUidStats(uidStatsInfo: UidStatsInfo): Promise\<NetStatsInfo>;
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
| uid
StatsInfo |
[
UidStatsInfo
](
#UidStatsInfo
)
| 是 | 指定查询的应用历史流量信息,参见
[
UidStatsInfo
](
#UidStats
Info
)
。 |
| uid
Info |
[
UidInfo
](
#UidInfo
)
| 是 | 指定查询的应用历史流量信息,参见
[
UidInfo
](
#Uid
Info
)
。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise
\<
[
NetStatsInfo
](
#NetStatsInfo
)
> | 以Promise形式返回获取结果
。成功时NetStatsInfo返回包含
应用历史流量信息。 |
| Promise
\<
[
NetStatsInfo
](
#NetStatsInfo
)
> | 以Promise形式返回获取结果
,返回
应用历史流量信息。 |
**错误码:**
...
...
@@ -858,7 +858,7 @@ getIfaceUidStats(uidStatsInfo: UidStatsInfo): Promise\<NetStatsInfo>;
**示例:**
```
js
let
uid
Stats
Info
=
{
let
uidInfo
=
{
ifaceInfo
:
{
iface
:
"
wlan0
"
,
startTime
:
1685948465
,
...
...
@@ -867,11 +867,11 @@ getIfaceUidStats(uidStatsInfo: UidStatsInfo): Promise\<NetStatsInfo>;
uid
:
20010037
}
statistics
.
get
IfaceStats
(
uidStats
Info
).
then
(
function
(
statsInfo
)
{
console
.
log
(
"
get
IfaceStats
bytes of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxBytes
));
console
.
log
(
"
get
IfaceStats
bytes of send =
"
+
JSON
.
stringify
(
statsInfo
.
txBytes
));
console
.
log
(
"
get
IfaceStats
packets of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxPackets
));
console
.
log
(
"
get
IfaceStats
packets of send =
"
+
JSON
.
stringify
(
statsInfo
.
txPackets
));
statistics
.
get
TrafficStatsByUid
(
uid
Info
).
then
(
function
(
statsInfo
)
{
console
.
log
(
"
get
TrafficStatsByUid
bytes of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxBytes
));
console
.
log
(
"
get
TrafficStatsByUid
bytes of send =
"
+
JSON
.
stringify
(
statsInfo
.
txBytes
));
console
.
log
(
"
get
TrafficStatsByUid
packets of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxPackets
));
console
.
log
(
"
get
TrafficStatsByUid
packets of send =
"
+
JSON
.
stringify
(
statsInfo
.
txPackets
));
})
```
...
...
@@ -889,7 +889,7 @@ getIfaceUidStats(uidStatsInfo: UidStatsInfo): Promise\<NetStatsInfo>;
| startTime | number | 是 | 查询的开始时间(时间戳;单位:秒)。 |
| endTime | number | 是 | 查询的结束时间(时间戳;单位:秒)。 |
## Uid
Stats
Info<sup>10+</sup>
## UidInfo<sup>10+</sup>
查询应用历史流量参数信息。
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录