成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

跟著小白一起學(xué)鴻蒙—DFX工具HiDumper

系統(tǒng) OpenHarmony
本章我們講了Hidumper,作為開發(fā)者的查詢工具,通過此工具可以查詢系統(tǒng)信息,服務(wù)信息,進(jìn)程棧等信息。

??想了解更多關(guān)于開源的內(nèi)容,請(qǐng)?jiān)L問:??

??51CTO 開源基礎(chǔ)軟件社區(qū)??

??https://ost.51cto.com??

HiDumper

簡(jiǎn)介

HiDumper是OpenHarmony中為開發(fā)、測(cè)試人員,IDE工具提供統(tǒng)一的系統(tǒng)信息獲取工具,幫助使用者分析,定位問題。

HiDumper主要包括以下幾個(gè)主要模塊:

  • hidumper:可執(zhí)行程序,工具入口,在板上可通過hidumper執(zhí)行對(duì)應(yīng)命令。
  • hidumperclient:動(dòng)態(tài)庫,提供framework層接口。
  • lib_dump_usage:動(dòng)態(tài)庫,提供framework層功能實(shí)現(xiàn)。
  • hidumperservice:動(dòng)態(tài)庫,sa服務(wù),提供service層功能實(shí)現(xiàn)。

結(jié)構(gòu)分析

.
├── BUILD.gn
├── bundle.json
├── client
│ └── native
│ ├── dump_client_main.cpp
│ └── main.cpp //可執(zhí)行文件入口
├── figures
├── frameworks //框架實(shí)現(xiàn)
│ └── native
│ ├── BUILD.gn
│ ├── common.h
│ ├── dump_controller.h
│ ├── dump_utils.cpp
│ ├── dump_utils.h
│ ├── include
│ └── src
├── hidumper.gni
├── interfaces
│ ├── innerkits
│ │ ├── BUILD.gn
│ │ ├── dump_usage.cpp
│ │ └── include
│ └── native
│ └── innerkits
├── LICENSE
├── OAT.xml
├── README.md
├── README_zh.md
├── sa_profile
├── services //服務(wù)實(shí)現(xiàn)
│ ├── BUILD.gn
│ ├── hidumper.map
│ ├── native
│ │ ├── etc
│ │ ├── include
│ │ └── src
│ └── zidl
│ ├── include
│ └── src
├── test
└── utils
  • usage
"usage:\n"
" -h |help text for the tool\n"
" -lc |a list of system information clusters\n"
" -ls |a list of system abilities\n"
" -c |all system information clusters\n"
" -c [base system] |system information clusters labeled \"base\" and \"system\"\n"
" -s |all system abilities\n"
" -s [SA0 SA1] |system abilities labeled \"SA0\" and \"SA1\"\n"
" -s [SA] -a ['-h'] |system ability labeled \"SA\" with arguments \"-h\" specified\n"
" -e |faultlogs of crash history\n"
" --net |dump network information\n"
" --storage |dump storage information\n"
" -p |processes information, include list and infromation of processes"
" and threads\n"
" -p [pid] |dump threads under pid, includes smap, block channel,"
" execute time, mountinfo\n"
" --cpuusage [pid] |dump cpu usage by processes and category; if PID is specified,"
" dump category usage of specified pid\n"
" --cpufreq |dump real CPU frequency of each core\n"
" --mem [pid] |dump memory usage of total; dump memory usage of specified"
" pid if pid was specified\n"
" --zip |compress output to /data/log/hidumper\n";

如上,我們可以看出hidumper能查看幾乎OpenHarmony里內(nèi)的所有信息,比如:

  • 查看系統(tǒng)ability信息,其中也包括HiDumperService
# hidumper -ls
System ability list:
RenderService AbilityManagerService DataObserverMgr
UriPermissionMgr AccountMgr BundleMgr
FormMgr ApplicationManagerService Installd
AccessibilityManagerService UserIdmService UserAuthService
AuthExecutorMgrService PinAuthService FaceAuthService
WifiDevice WifiHotspot WifiP2p
WifiScan BluetoothHost NetConnManager
NetPolicyManager NetStatsManager NetTetheringManager
EthernetManager NetsysNative HiviewService
HiviewFaultLogger HiviewSysEventService HiDumperService
DistributedKvData DistributedSched EnterpriseDeviceManagerService
ResourceSched BackgroundTaskManager WorkSchedule
SocPerfService DeviceUsageStatistics MemoryManagerService
LocationGeoConvert LocationLocator LocationGnss
LocationNetworkLocating LocationNopowerLocating DeviceStatusService
AudioDistributed PlayerDistributedService CameraService
AudioPolicyService AVSessionService MultimodalInput
DistributedNotificationService CommonEventService PowerManagerService
BatteryService ThermalService BatteryStatisticsService
DisplayPowerManagerService AccessTokenManagerService PrivacyManagerService
KeystoreService CertManagerService SensorService
MiscDeviceService PasteboardService TimeService
InputMethodService ScreenlockService WallpaperManagerService
ParamWatcher SysParamDevice TelephonyCellularCall
TelephonyCellularData TelephonySmsMms TelephonyStateRegistry
TelephonyCoreService UsbService WindowManagerService
DisplayManagerService DSoftbus DeviceAuthService
DeviceManagerService StorageDaemon StorageManager
HdfDeviceServiceManager DistributedFileDaemon devattest_service
DistributedDeviceProfile UiService
  • 查看系統(tǒng)ability信息,其中也包括HiDumperService
-------------------------------[ability]-------------------------------
----------------------------------RenderService---------------------------------
------Graphic2D--RenderSerice ------
Usage:
h |help text for the tool
screen |dump all screen infomation in the system
surface |dump all surface information
composer fps |dump the fps info of composer
[surface name] fps |dump the fps info of surface
composer fpsClear |clear the fps info of composer
[surface name] fpsClear |clear the fps info of surface
nodeNotOnTree |dump nodeNotOnTree info
allSurfacesMem |dump surface mem info
RSTree |dump RSTree info
EventParamList |dump EventParamList info
allInfo |dump all info
...后面有好多
  • 查看系統(tǒng)網(wǎng)絡(luò)信息
#hidumper --net
-------------------------------[net]-------------------------------
cmd is: netstat -nW
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
udp 0 0 127.0.0.1:44451 127.0.0.1:9877 ESTABLISHED
udp 0 0 127.0.0.1:37649 127.0.0.1:9877 ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ] DGRAM 1675 /dev/unix/socket/fd_holder
unix 74 [ ] DGRAM 344 /dev/unix/socket/hilogInput
unix 2 [ ] DGRAM 1719 /dev/unix/socket/hisysevent
unix 2 [ ] SEQPACKET 24844 /dev/unix/socket/hdcd
...后面還有好多
  • 查看系統(tǒng)進(jìn)程信息
#hidumper -p
-------------------------------[processes]-------------------------------
cmd is: ps -efT
UID PID TID PPID TCNT STIME TTY TIME CMD
root 1 1 0 1 15:55:05 ? 00:00:03 init --second-stage
root 2 2 0 1 15:55:05 ? 00:00:00 [kthreadd]
root 3 3 2 1 15:55:05 ? 00:00:00 [rcu_gp]
root 4 4 2 1 15:55:05 ? 00:00:00 [rcu_par_gp]
root 8 8 2 1 15:55:05 ? 00:00:00 [mm_percpu_wq]
root 9 9 2 1 15:55:05 ? 00:00:00 [rcu_tasks_rude_]
...后面還有好多
  • 查看系統(tǒng)內(nèi)存信息
#hidumper --mem
-------------------------------[memory]-------------------------------
Total Memory Usage by PID:
PID Name Total Pss(xxx in SwapPss) Total Vss Total Rss Total Uss GL Graph
1 init 1217(0 in SwapPss) kB 4612 kB 3600 kB 828 kB 0 kB 0 kB
241 watchdog_servic 260(0 in SwapPss) kB 3160 kB 2320 kB 232 kB 0 kB 0 kB
253 hilogd 2414(0 in SwapPss) kB 5968 kB 4576 kB 2252 kB 0 kB 0 kB
254 hdf_devmgr 600(0 in SwapPss) kB 6440 kB 3320 kB 496 kB 0 kB 0 kB
255 hiview 4780(0 in SwapPss) kB 79168 kB 14752 kB 3148 kB 0 kB 0 kB
256 storage_daemon 1539(0 in SwapPss) kB 11404 kB 7024 kB 932 kB 0 kB 0 kB
...后面有好多
  • 查看系統(tǒng)錯(cuò)誤
#hidumper -e
-------------------------------[faultlog]-------------------------------
/data/log/faultlog/faultlogger/jscrash-ohos.samples.videoplayer-20010040-20230328160126
Generated by HiviewDFX@OpenHarmony
================================================================
Device info:OpenHarmony 3.2
Build info:OpenHarmony 3.2.11.2
Module name:ohos.samples.videoplayer
Version:1.0.0
Pid:1763
Uid:20010040
Lifetime: 0.000000s
Js-Engine: ark
page: pages/Player.js
Error message: assertion (false) failed: type mismatch
Stacktrace:
at clearVideoPlayer (/ets/pages/Player.ets:213:7)
at onPageHide (/ets/pages/Player.ets:200:5)
...后面還有好多

從上面列舉的一些命令可以看出hidumper是個(gè)集成入口,有些用了Linux下的常規(guī)命令,如ps,netstat,有些用OH內(nèi)特制的內(nèi)容,如systemability,faultlog。

基本原理

  • hidumper同OHOS里的其他服務(wù)一樣都提供framework和service架構(gòu),通過IPC方式通過hidumperservice服務(wù)執(zhí)行具體命令。
  • 功能定義:
    在下面的問題提供三部分內(nèi)容:
base/hiviewdfx/hidumper/frameworks/native/src/util/config_data.cpp
1. 功能定義
const std::string ConfigData::CONFIG_NAME_SPLIT = "_";
const std::string ConfigData::CONFIG_GROUP = "group";
...
const std::string ConfigData::CONFIG_DUMPER_LIST_SYSTEM_ABILITY = ConfigData::CONFIG_DUMPER_LIST_ + "system_ability";
...
const std::string ConfigData::STR_ABILITY = "ability";
const std::string ConfigData::STR_BASE = "base";
const std::string ConfigData::STR_SERVICE = "service";
const std::string ConfigData::STR_SYSTEM = "system";

2. dumper方法
const ConfigData::ItemCfg ConfigData::baseInfoDumper_[] = {
{
.name_ = "dumper_base_info",
.desc_ = "Base Information",
.target_ = "",
.section_ = "",
.class_ = DumperConstant::API_DUMPER,
.level_ = DumperConstant::NONE,
.loop_ = DumperConstant::NONE,
.filterCfg_ = "",
},
{
.name_ = "",
.desc_ = "",
.target_ = "",
.section_ = "",
.class_ = DumperConstant::FD_OUTPUT,
.level_ = DumperConstant::NONE,
.loop_ = DumperConstant::NONE,
.filterCfg_ = "",
},
};

3. 功能組定義
...
const std::string ConfigData::testGroup_[] = {
"dumper_test",
};

const ConfigData::GroupCfg ConfigData::groups_[] = {
{
.name_ = ConfigData::CONFIG_GROUP_CPU_FREQ,
.desc_ = "group of cpu freq dumper",
.list_ = cpuFreqGroup_,
.size_ = ARRAY_SIZE(cpuFreqGroup_),
.type_ = DumperConstant::GROUPTYPE_CPUID,
.expand_ = true,
},
...
  • 簡(jiǎn)單調(diào)用流程:
graph LR
main --> DumpManagerClient --> DumpManagerService --> DumpImplement
  • 功能實(shí)現(xiàn)流程:
graph LR
CmdParse --> GetDumperConfigs --> GetExecutorConfigList --> setExecutorList --> SetProgressEnabled --> DumpDatas
  • CmdParse: 解析命令。
  • GetDumperConfigs: 獲取配置。
  • GetExecutorConfigList: 根據(jù)配置獲取執(zhí)行命令。
  • setExecutorList: 生成執(zhí)行命令列表,通過ptrExecutorFactoryMap_獲得對(duì)應(yīng)executor。
  • SetProgressEnabled: 設(shè)置執(zhí)行開關(guān)。
  • DumpDatas: 執(zhí)行命令,獲取輸出信息。
  • executor實(shí)現(xiàn):
//命令調(diào)用
popen 對(duì)應(yīng) dumper里.class_ = DumperConstant::CMD_DUMPER,

//文件讀取
fdopen 對(duì)應(yīng) dumper里 .class_ = DumperConstant::FILE_DUMPER,

//api接口讀取
提供對(duì)應(yīng)的API調(diào)用,如GetDisplayVersion, 對(duì)應(yīng) dumper里 .class_ = DumperConstant::API_DUMPER,

小結(jié)

本章我們講了hidumper,作為開發(fā)者的查詢工具,通過此工具可以查詢系統(tǒng)信息,服務(wù)信息,進(jìn)程棧等信息。通過此工具可以協(xié)助開發(fā)者發(fā)現(xiàn)一些系統(tǒng)運(yùn)行信息,比如進(jìn)程,線程,內(nèi)存,CPU等信息;當(dāng)然也可自己根據(jù)具體內(nèi)容實(shí)現(xiàn)實(shí)現(xiàn)自己的對(duì)應(yīng)查看工具。

??想了解更多關(guān)于開源的內(nèi)容,請(qǐng)?jiān)L問:??

??51CTO 開源基礎(chǔ)軟件社區(qū)??

??https://ost.51cto.com??

責(zé)任編輯:jianghua 來源: 51CTO 開源基礎(chǔ)軟件社區(qū)
相關(guān)推薦

2022-12-02 14:20:09

Tetris鴻蒙

2022-11-29 16:35:02

Tetris鴻蒙

2023-01-03 15:09:10

鴻蒙常用工具

2023-03-30 09:32:27

2022-11-14 17:01:34

游戲開發(fā)畫布功能

2023-03-30 09:19:54

SELinux安全子系統(tǒng)

2023-02-27 16:30:32

鴻蒙開源協(xié)議分析

2022-08-19 19:02:20

開源鴻蒙操作系統(tǒng)

2022-10-10 14:47:04

藍(lán)牙應(yīng)用鴻蒙

2022-10-09 15:05:50

NAPI框架鴻蒙

2022-10-20 16:40:16

JS應(yīng)用控制LED鴻蒙

2022-11-24 14:34:41

Hap程序鴻蒙

2022-12-06 15:39:16

鴻蒙主干代碼

2023-03-15 16:19:03

BinderIPC工具

2022-11-03 15:47:04

HTTP通信協(xié)議

2022-11-08 15:43:45

開源鴻蒙藍(lán)牙協(xié)議棧

2022-10-31 15:35:02

Wi-Fi藍(lán)牙子系統(tǒng)

2022-12-05 15:02:14

鴻蒙用戶鑒權(quán)

2023-04-06 09:18:52

鴻蒙AVPlayerAVRecorder

2022-10-17 14:29:24

鴻蒙應(yīng)用開發(fā)
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)

主站蜘蛛池模板: 精品国产一区二区三区久久久久久 | 久久免费国产 | 国产精品永久免费视频 | 精品美女视频在线观看免费软件 | 亚洲精品一级 | 性生生活大片免费看视频 | 欧美不卡视频一区发布 | 日韩成人在线一区 | 自拍偷拍精品 | 天天色综| 亚洲综合无码一区二区 | 涩涩鲁亚洲精品一区二区 | 国产乱码精品一区二区三区五月婷 | 欧美精品一区二区免费 | 久久综合伊人 | 欧美成年网站 | 免费av手机在线观看 | 欧美日韩精品一区二区三区视频 | 国产精品美女 | 古装三级在线播放 | 成人免费在线观看 | 91视频网| 国产日韩欧美一区二区在线播放 | 羞羞在线视频 | 久久久久久网站 | 日韩精品人成在线播放 | 正在播放国产精品 | 偷拍第一页 | 91成人免费电影 | 99久久免费精品国产免费高清 | 成人免费黄视频 | 日韩欧美天堂 | 久热久热 | 国产一区二区三区四区在线观看 | 国产精品区一区二区三区 | 免费黄色成人 | 亚洲精品久久 | 中文字幕在线观看视频一区 | 成人激情视频免费观看 | 日韩精品1区2区3区 国产精品国产成人国产三级 | 在线观看av网站永久 |