提交 1e9dfa95 编写于 作者: S shawn_he

update doc

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 e3043fdb
......@@ -175,23 +175,30 @@ Obtains system service information.
```js
import fs from '@ohos.file.fs'
import hidebug from '@ohos.hidebug'
import featureAbility from '@ohos.ability.featureAbility'
let context = featureAbility.getContext();
context.getFilesDir().then((data) => {
var path = data + "/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");
try {
hidebug.getServiceDump(serviceId, file.fd, args);
} catch (error) {
console.info(error.code);
console.info(error.message);
}
fs.closeSync(file);
})
import common from '@ohos.app.ability.common'
let applicationContext: common.Context;
try {
applicationContext = this.context.getApplicationContext();
} catch (error) {
console.info(error.code);
console.info(error.message);
}
var filesDir = applicationContext.filesDir;
var path = 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");
try {
hidebug.getServiceDump(serviceId, file.fd, args);
} catch (error) {
console.info(error.code);
console.info(error.message);
}
fs.closeSync(file);
```
## hidebug.startJsCpuProfiling<sup>9+</sup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册