Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
393be0f5
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
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看板
未验证
提交
393be0f5
编写于
9月 06, 2023
作者:
O
openharmony_ci
提交者:
Gitee
9月 06, 2023
浏览文件
操作
浏览文件
下载
差异文件
!23912 arkts规范整改hidebug
Merge pull request !23912 from wenlong_12/docs0905
上级
d169ee7c
bdf325a3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
44 addition
and
38 deletion
+44
-38
zh-cn/application-dev/reference/apis/js-apis-hidebug.md
zh-cn/application-dev/reference/apis/js-apis-hidebug.md
+44
-38
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-hidebug.md
浏览文件 @
393be0f5
...
...
@@ -8,7 +8,7 @@
## 导入模块
```
j
s
```
t
s
import
hidebug
from
'
@ohos.hidebug
'
;
```
...
...
@@ -28,8 +28,8 @@ getNativeHeapSize(): bigint
| bigint | 返回本应用堆内存总大小,单位为kB。 |
**示例:**
```
j
s
let
nativeHeapSize
=
hidebug
.
getNativeHeapSize
();
```
t
s
let
nativeHeapSize
:
bigint
=
hidebug
.
getNativeHeapSize
();
```
## hidebug.getNativeHeapAllocatedSize
...
...
@@ -48,8 +48,8 @@ getNativeHeapAllocatedSize(): bigint
**示例:**
```
j
s
let
nativeHeapAllocatedSize
=
hidebug
.
getNativeHeapAllocatedSize
();
```
t
s
let
nativeHeapAllocatedSize
:
bigint
=
hidebug
.
getNativeHeapAllocatedSize
();
```
## hidebug.getNativeHeapFreeSize
...
...
@@ -67,8 +67,8 @@ getNativeHeapFreeSize(): bigint
| bigint | 返回本应用堆内存的空闲内存,单位为kB。 |
**示例:**
```
j
s
let
nativeHeapFreeSize
=
hidebug
.
getNativeHeapFreeSize
();
```
t
s
let
nativeHeapFreeSize
:
bigint
=
hidebug
.
getNativeHeapFreeSize
();
```
## hidebug.getPss
...
...
@@ -86,8 +86,8 @@ getPss(): bigint
| bigint | 返回应用进程实际使用的物理内存大小,单位为kB。 |
**示例:**
```
j
s
let
pss
=
hidebug
.
getPss
();
```
t
s
let
pss
:
bigint
=
hidebug
.
getPss
();
```
## hidebug.getSharedDirty
...
...
@@ -106,8 +106,8 @@ getSharedDirty(): bigint
**示例:**
```
j
s
let
sharedDirty
=
hidebug
.
getSharedDirty
();
```
t
s
let
sharedDirty
:
bigint
=
hidebug
.
getSharedDirty
();
```
## hidebug.getPrivateDirty<sup>9+<sup>
...
...
@@ -125,8 +125,8 @@ getPrivateDirty(): bigint
| bigint | 返回进程的私有脏内存大小,单位为kB。 |
**示例:**
```
j
s
let
privateDirty
=
hidebug
.
getPrivateDirty
();
```
t
s
let
privateDirty
:
bigint
=
hidebug
.
getPrivateDirty
();
```
## hidebug.getCpuUsage<sup>9+<sup>
...
...
@@ -147,8 +147,8 @@ getCpuUsage(): number
**示例:**
```
j
s
let
cpuUsage
=
hidebug
.
getCpuUsage
();
```
t
s
let
cpuUsage
:
number
=
hidebug
.
getCpuUsage
();
```
## hidebug.getServiceDump<sup>9+<sup>
...
...
@@ -172,31 +172,34 @@ getServiceDump(serviceid : number, fd : number, args : Array\<string>) : void
**示例:**
```
j
s
```
t
s
import
fs
from
'
@ohos.file.fs
'
import
hidebug
from
'
@ohos.hidebug
'
import
common
from
'
@ohos.app.ability.common
'
import
{
BusinessError
}
from
'
@ohos.base
'
let
applicationContext
:
common
.
Context
;
let
applicationContext
:
common
.
Context
|
null
=
null
;
try
{
applicationContext
=
this
.
context
.
getApplicationContext
();
}
catch
(
error
)
{
console
.
info
(
error
.
code
);
console
.
info
(
error
.
message
);
console
.
info
(
(
error
as
BusinessError
)
.
code
);
console
.
info
(
(
error
as
BusinessError
)
.
message
);
}
var
filesDir
=
applicationContext
.
filesDir
;
var
path
=
filesDir
+
"
/serviceInfo.txt
"
;
if
(
applicationContext
)
{
let
filesDir
:
string
=
applicationContext
.
filesDir
;
}
let
path
:
string
=
filesDir
+
"
/serviceInfo.txt
"
;
console
.
info
(
"
output path:
"
+
path
);
let
file
=
fs
.
openSync
(
path
,
fs
.
OpenMode
.
READ_WRITE
|
fs
.
OpenMode
.
CREATE
);
var
serviceId
=
10
;
var
args
=
new
Array
(
"
allInfo
"
);
let
file
:
file
.
fs
=
fs
.
openSync
(
path
,
fs
.
OpenMode
.
READ_WRITE
|
fs
.
OpenMode
.
CREATE
);
let
serviceId
:
number
=
10
;
let
args
:
Array
=
new
Array
(
"
allInfo
"
);
try
{
hidebug
.
getServiceDump
(
serviceId
,
file
.
fd
,
args
);
}
catch
(
error
)
{
console
.
info
(
error
.
code
);
console
.
info
(
error
.
message
);
console
.
info
(
(
error
as
BusinessError
)
.
code
);
console
.
info
(
(
error
as
BusinessError
)
.
message
);
}
fs
.
closeSync
(
file
);
```
...
...
@@ -217,16 +220,17 @@ startJsCpuProfiling(filename : string) : void
**示例:**
```
j
s
```
t
s
import
hidebug
from
'
@ohos.hidebug
'
import
{
BusinessError
}
from
'
@ohos.base
'
try
{
hidebug
.
startJsCpuProfiling
(
"
cpu_profiling
"
);
// ...
hidebug
.
stopJsCpuProfiling
();
}
catch
(
error
)
{
console
.
info
(
error
.
code
)
console
.
info
(
error
.
message
)
console
.
info
(
(
error
as
BusinessError
)
.
code
)
console
.
info
(
(
error
as
BusinessError
)
.
message
)
}
```
...
...
@@ -246,16 +250,17 @@ stopJsCpuProfiling() : void
**示例:**
```
j
s
```
t
s
import
hidebug
from
'
@ohos.hidebug
'
import
{
BusinessError
}
from
'
@ohos.base
'
try
{
hidebug
.
startJsCpuProfiling
(
"
cpu_profiling
"
);
// ...
hidebug
.
stopJsCpuProfiling
();
}
catch
(
error
)
{
console
.
info
(
error
.
code
)
console
.
info
(
error
.
message
)
console
.
info
(
(
error
as
BusinessError
)
.
code
)
console
.
info
(
(
error
as
BusinessError
)
.
message
)
}
```
...
...
@@ -275,14 +280,15 @@ dumpJsHeapData(filename : string) : void
**示例:**
```
j
s
```
t
s
import
hidebug
from
'
@ohos.hidebug
'
import
{
BusinessError
}
from
'
@ohos.base
'
try
{
hidebug
.
dumpJsHeapData
(
"
heapData
"
);
}
catch
(
error
)
{
console
.
info
(
error
.
code
)
console
.
info
(
error
.
message
)
console
.
info
(
(
error
as
BusinessError
)
.
code
)
console
.
info
(
(
error
as
BusinessError
)
.
message
)
}
```
...
...
@@ -304,7 +310,7 @@ startProfiling(filename : string) : void
**示例:**
```
j
s
```
t
s
hidebug
.
startProfiling
(
"
cpuprofiler-20220216
"
);
// code block
// ...
...
...
@@ -324,7 +330,7 @@ stopProfiling() : void
**示例:**
```
j
s
```
t
s
hidebug
.
startProfiling
(
"
cpuprofiler-20220216
"
);
// code block
// ...
...
...
@@ -350,6 +356,6 @@ dumpHeapData(filename : string) : void
**示例:**
```
j
s
```
t
s
hidebug
.
dumpHeapData
(
"
heap-20220216
"
);
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录