user版本去掉debugfs挂载

Signed-off-by: shanghuanni <shanghuanni1@huawei.com>
This commit is contained in:
shanghuanni 2023-09-19 15:27:24 +08:00
commit 47e128ca30
7 changed files with 583 additions and 31 deletions

View File

@ -73,7 +73,11 @@ ohos_executable("bytrace") {
}
ohos_prebuilt_etc("hitrace.cfg") {
source = "./config/hitrace.cfg"
if ("${build_variant}" == "eng") {
source = "./config/hitrace_userdebug.cfg"
} else {
source = "./config/hitrace_user.cfg"
}
relative_install_dir = "init"
subsystem_name = "hiviewdfx"
part_name = "hitrace"

View File

@ -3,6 +3,7 @@
"name" : "pre-init",
"cmds" : [
"mount tracefs /sys/kernel/tracing /sys/kernel/tracing mode=755"
"mount tmpfs /var/tmp /var/tmp mode=755"
]
}, {
"name" : "init-hitrace",
@ -126,6 +127,8 @@
"chmod 0755 /sys/kernel/tracing/events/block/block_rq_complete/",
"chmod 0666 /sys/kernel/tracing/events/block/block_rq_issue/enable",
"chmod 0666 /sys/kernel/tracing/events/block/block_rq_complete/enable",
"chmod 0666 /sys/kernel/tracing/events/block/block_bio_remap/enable",
"chmod 0666 /sys/kernel/tracing/events/block/block_rq_insert/enable",
"chmod 0755 /sys/kernel/tracing/events/ext4/",
"chmod 0755 /sys/kernel/tracing/events/ext4/ext4_da_write_begin/",
"chmod 0755 /sys/kernel/tracing/events/ext4/ext4_da_write_end/",
@ -152,9 +155,21 @@
"chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_iget/enable",
"chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_sync_file_enter/enable",
"chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_sync_file_exit/enable",
"chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_readpage/enable",
"chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_readpages/enable",
"chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_sync_fs/enable",
"chmod 0666 /sys/kernel/tracing/events/hmdfs/hmdfs_syncfs_enter/enable",
"chmod 0666 /sys/kernel/tracing/events/hmdfs/hmdfs_syncfs_exit/enable",
"chmod 0666 /sys/kernel/tracing/events/erofs/erofs_readpage/enable",
"chmod 0666 /sys/kernel/tracing/events/erofs/erofs_readpages/enable",
"chmod 0666 /sys/kernel/tracing/events/ext4/ext4_da_write_begin/enable",
"chmod 0666 /sys/kernel/tracing/ext4/ext4_da_write_end/enable",
"chmod 0666 /sys/kernel/tracing/ext4/ext4_sync_file_enter/enable",
"chmod 0666 /sys/kernel/tracing/ext4/ext4_sync_file_exit/enable",
"chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_write_begin/enable",
"chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_write_end/enable",
"chmod 0755 /sys/kernel/tracing/events/filemap/",
"chmod 0666 /sys/kernel/tracing/events/filemap/enable",
"chmod 0755 /sys/kernel/tracing/events/filemap/mm_filemap_add_to_page_cache/enable",
"chmod 0755 /sys/kernel/tracing/events/filemap/mm_filemap_delete_from_page_cache/enable",
"chmod 0666 /sys/kernel/tracing/events/filemap/mm_filemap_add_to_page_cache/enable",
@ -196,6 +211,22 @@
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu13/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu14/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu15/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu0/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu1/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu2/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu3/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu4/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu5/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu6/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu7/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu8/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu9/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu10/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu11/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu12/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu13/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu14/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu15/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu0/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu1/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu2/snapshot",
@ -228,7 +259,7 @@
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu13/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu14/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu15/snapshot_raw",
"chmod 0666 /sys/kernel/tracing/options/record-cmd",
"chmod 0666 /sys/kerneg/tracing/options/record-cmd",
"chmod 0666 /sys/kernel/tracing/events/power/suspend_resume/enable",
"chmod 0666 /sys/kernel/tracing/events/sched/sched_process_free/enable",
"chmod 0666 /sys/kernel/tracing/events/sched/sched_wakeup_new/enable",
@ -284,6 +315,7 @@
"chmod 0666 /sys/kernel/tracing/events/power/clock_enable/enable",
"chmod 0666 /sys/kernel/tracing/events/workqueue/workqueue_execute_end/enable",
"chmod 0666 /sys/kernel/tracing/events/workqueue/workqueue_execute_start/enable",
"chmod 0666 /sys/kernel/tracing/events/thermal_power_allocator/enable",
"setparam debug.hitrace.tags.enableflags 0"
]
}

View File

@ -0,0 +1,448 @@
{
"jobs" : [{
"name" : "pre-init",
"cmds" : [
"mount debugfs /sys/kernel/debug /sys/kernel/debug mode=755",
"mount tracefs /sys/kernel/tracing /sys/kernel/tracing mode=755",
"mount nfs /home/share /mnt/debug/share mode=755"
]
}, {
"name" : "init-hitrace",
"cmds" : [
"write /proc/sys/kernel/sched_schedstats 1",
"write /sys/kernel/debug/tracing/tracing_on 0",
"chmod 0666 /sys/kernel/debug/tracing/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/current_tracer",
"chmod 0666 /sys/kernel/debug/tracing/saved_cmdlines_size",
"chmod 0666 /sys/kernel/debug/tracing/trace",
"chmod 0666 /sys/kernel/debug/tracing/snapshot",
"chmod 0666 /sys/kernel/debug/tracing/trace_clock",
"chmod 0222 /sys/kernel/debug/tracing/trace_marker",
"chmod 0666 /sys/kernel/debug/tracing/tracing_on",
"chmod 0755 /sys/kernel/debug/tracing/events",
"chmod 0755 /sys/kernel/debug/tracing/events/binder/",
"chmod 0755 /sys/kernel/debug/tracing/events/binder/binder_lock/",
"chmod 0755 /sys/kernel/debug/tracing/events/binder/binder_locked/",
"chmod 0755 /sys/kernel/debug/tracing/events/binder/binder_unlock/",
"chmod 0755 /sys/kernel/debug/tracing/events/binder/binder_transaction/",
"chmod 0755 /sys/kernel/debug/tracing/events/binder/binder_transaction_received/",
"chmod 0755 /sys/kernel/debug/tracing/events/binder/binder_transaction_alloc_buf/",
"chmod 0666 /sys/kernel/debug/tracing/events/binder/binder_lock/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/binder/binder_locked/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/binder/binder_unlock/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/binder/binder_transaction/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/binder/binder_transaction_received/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/binder/binder_transaction_alloc_buf/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/cgroup/",
"chmod 0666 /sys/kernel/debug/tracing/events/cgroup/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/cpufreq_interactive/",
"chmod 0666 /sys/kernel/debug/tracing/events/cpufreq_interactive/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/dma_fence/",
"chmod 0666 /sys/kernel/debug/tracing/events/dma_fence/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/fence/",
"chmod 0666 /sys/kernel/debug/tracing/events/fence/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/i2c/",
"chmod 0666 /sys/kernel/debug/tracing/events/i2c/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/i2c/i2c_read/",
"chmod 0755 /sys/kernel/debug/tracing/events/i2c/i2c_write/",
"chmod 0755 /sys/kernel/debug/tracing/events/i2c/i2c_result/",
"chmod 0755 /sys/kernel/debug/tracing/events/i2c/i2c_reply/",
"chmod 0755 /sys/kernel/debug/tracing/events/i2c/smbus_read/",
"chmod 0755 /sys/kernel/debug/tracing/events/i2c/smbus_write/",
"chmod 0755 /sys/kernel/debug/tracing/events/i2c/smbus_result/",
"chmod 0755 /sys/kernel/debug/tracing/events/i2c/smbus_reply/",
"chmod 0666 /sys/kernel/debug/tracing/events/i2c/i2c_read/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/i2c/i2c_write/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/i2c/i2c_result/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/i2c/i2c_reply/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/i2c/smbus_read/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/i2c/smbus_write/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/i2c/smbus_result/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/i2c/smbus_reply/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/kmem/",
"chmod 0755 /sys/kernel/debug/tracing/events/kmem/rss_stat/",
"chmod 0755 /sys/kernel/debug/tracing/events/kmem/ion_heap_grow/",
"chmod 0755 /sys/kernel/debug/tracing/events/kmem/ion_heap_shrink/",
"chmod 0666 /sys/kernel/debug/tracing/events/kmem/rss_stat/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/kmem/ion_heap_grow/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/kmem/ion_heap_shrink/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/lowmemorykiller/",
"chmod 0755 /sys/kernel/debug/tracing/events/lowmemorykiller/lowmemory_kill/",
"chmod 0666 /sys/kernel/debug/tracing/events/lowmemorykiller/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/lowmemorykiller/lowmemory_kill/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/mm_event/",
"chmod 0755 /sys/kernel/debug/tracing/events/mm_event/mm_event_record/",
"chmod 0666 /sys/kernel/debug/tracing/events/mm_event/mm_event_record/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/oom/",
"chmod 0755 /sys/kernel/debug/tracing/events/oom/oom_score_adj_update/",
"chmod 0666 /sys/kernel/debug/tracing/events/oom/oom_score_adj_update/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/power/",
"chmod 0755 /sys/kernel/debug/tracing/events/power/cpu_frequency/",
"chmod 0755 /sys/kernel/debug/tracing/events/power/cpu_idle/",
"chmod 0755 /sys/kernel/debug/tracing/events/power/clock_set_rate/",
"chmod 0755 /sys/kernel/debug/tracing/events/power/cpu_frequency_limits/",
"chmod 0755 /sys/kernel/debug/tracing/events/power/gpu_frequency/",
"chmod 0666 /sys/kernel/debug/tracing/events/power/cpu_frequency/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/power/cpu_idle/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/power/clock_set_rate/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/power/cpu_frequency_limits/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/power/gpu_frequency/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/sched/",
"chmod 0755 /sys/kernel/debug/tracing/events/sched/sched_switch/",
"chmod 0755 /sys/kernel/debug/tracing/events/sched/sched_wakeup/",
"chmod 0755 /sys/kernel/debug/tracing/events/sched/sched_blocked_reason/",
"chmod 0755 /sys/kernel/debug/tracing/events/sched/sched_cpu_hotplug/",
"chmod 0755 /sys/kernel/debug/tracing/events/sched/sched_pi_setprio/",
"chmod 0755 /sys/kernel/debug/tracing/events/sched/sched_process_exit/",
"chmod 0755 /sys/kernel/debug/tracing/events/sched/sched_waking/",
"chmod 0666 /sys/kernel/debug/tracing/events/sched/sched_switch/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/sched/sched_blocked_reason/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/sched/sched_cpu_hotplug/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/sched/sched_pi_setprio/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/sched/sched_process_exit/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/sched/sched_waking/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/signal/",
"chmod 0755 /sys/kernel/debug/tracing/events/signal/signal_generate/",
"chmod 0755 /sys/kernel/debug/tracing/events/signal/signal_deliver/",
"chmod 0666 /sys/kernel/debug/tracing/events/signal/signal_generate/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/signal/signal_deliver/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/sync/",
"chmod 0666 /sys/kernel/debug/tracing/events/sync/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/task/",
"chmod 0755 /sys/kernel/debug/tracing/events/task/task_rename/",
"chmod 0755 /sys/kernel/debug/tracing/events/task/task_newtask/",
"chmod 0666 /sys/kernel/debug/tracing/events/task/task_rename/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/task/task_newtask/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/vmscan/",
"chmod 0755 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_direct_reclaim_begin/",
"chmod 0755 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_direct_reclaim_end/",
"chmod 0755 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_kswapd_wake/",
"chmod 0755 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_kswapd_sleep/",
"chmod 0666 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_direct_reclaim_begin/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_direct_reclaim_end/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_kswapd_wake/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_kswapd_sleep/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/block/",
"chmod 0755 /sys/kernel/debug/tracing/events/block/block_rq_issue/",
"chmod 0755 /sys/kernel/debug/tracing/events/block/block_rq_complete/",
"chmod 0666 /sys/kernel/debug/tracing/events/block/block_rq_issue/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/block/block_rq_complete/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/block/block_bio_remap/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/block/block_rq_insert/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/ext4/",
"chmod 0755 /sys/kernel/debug/tracing/events/ext4/ext4_da_write_begin/",
"chmod 0755 /sys/kernel/debug/tracing/events/ext4/ext4_da_write_end/",
"chmod 0755 /sys/kernel/debug/tracing/events/ext4/ext4_es_lookup_extent_enter/",
"chmod 0755 /sys/kernel/debug/tracing/events/ext4/ext4_es_lookup_extent_exit/",
"chmod 0755 /sys/kernel/debug/tracing/events/ext4/ext4_load_inode/",
"chmod 0755 /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_enter/",
"chmod 0755 /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_exit/",
"chmod 0666 /sys/kernel/debug/tracing/events/ext4/ext4_da_write_begin/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/ext4/ext4_da_write_end/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/ext4/ext4_es_lookup_extent_enter/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/ext4/ext4_es_lookup_extent_exit/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/ext4/ext4_load_inode/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_enter/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/ext4/ext4_sync_file_exit/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/f2fs/",
"chmod 0755 /sys/kernel/debug/tracing/events/f2fs/f2fs_get_data_block/",
"chmod 0755 /sys/kernel/debug/tracing/events/f2fs/f2fs_iget/",
"chmod 0755 /sys/kernel/debug/tracing/events/f2fs/f2fs_sync_file_enter/",
"chmod 0755 /sys/kernel/debug/tracing/events/f2fs/f2fs_sync_file_exit/",
"chmod 0755 /sys/kernel/debug/tracing/events/f2fs/f2fs_write_begin/",
"chmod 0755 /sys/kernel/debug/tracing/events/f2fs/f2fs_write_end/",
"chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_get_data_block/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_iget/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_sync_file_enter/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_sync_file_exit/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_readpage/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_readpages/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_sync_fs/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/hmdfs/hmdfs_syncfs_enter/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/hmdfs/hmdfs_syncfs_exit/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/erofs/erofs_readpage/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/erofs/erofs_readpages/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/ext4/ext4_da_write_begin/enable",
"chmod 0666 /sys/kernel/debug/tracing/ext4/ext4_da_write_end/enable",
"chmod 0666 /sys/kernel/debug/tracing/ext4/ext4_sync_file_enter/enable",
"chmod 0666 /sys/kernel/debug/tracing/ext4/ext4_sync_file_exit/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_write_begin/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/f2fs/f2fs_write_end/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/filemap/",
"chmod 0666 /sys/kernel/debug/tracing/events/filemap/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/filemap/mm_filemap_add_to_page_cache/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/filemap/mm_filemap_delete_from_page_cache/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/filemap/mm_filemap_add_to_page_cache/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/filemap/mm_filemap_delete_from_page_cache/enable",
"chmod 0755 /sys/kernel/debug/tracing/options/",
"chmod 0666 /sys/kernel/debug/tracing/options/overwrite",
"chmod 0666 /sys/kernel/debug/tracing/options/print-tgid",
"chmod 0666 /sys/kernel/debug/tracing/options/record-tgid",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/cpu0/",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/cpu1/",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/cpu2/",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/cpu3/",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/cpu4/",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/cpu5/",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/cpu6/",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/cpu7/",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/cpu8/",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/cpu9/",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/cpu10/",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/cpu11/",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/cpu12/",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/cpu13/",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/cpu14/",
"chmod 0755 /sys/kernel/debug/tracing/per_cpu/cpu15/",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu0/trace",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu1/trace",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu2/trace",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu3/trace",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu4/trace",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu5/trace",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu6/trace",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu7/trace",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu8/trace",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu9/trace",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu10/trace",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu11/trace",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu12/trace",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu13/trace",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu14/trace",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu15/trace",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu0/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu1/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu2/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu3/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu4/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu5/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu6/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu7/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu8/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu9/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu10/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu11/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu12/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu13/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu14/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu15/buffer_size_kb",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu0/snapshot",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu1/snapshot",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu2/snapshot",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu3/snapshot",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu4/snapshot",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu5/snapshot",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu6/snapshot",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu7/snapshot",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu8/snapshot",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu9/snapshot",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu10/snapshot",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu11/snapshot",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu12/snapshot",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu13/snapshot",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu14/snapshot",
"chmod 0666 /sys/kernel/debug/tracing/per_cpu/cpu15/snapshot",
"chmod 0444 /sys/kernel/debug/tracing/per_cpu/cpu0/snapshot_raw",
"chmod 0444 /sys/kernel/debug/tracing/per_cpu/cpu1/snapshot_raw",
"chmod 0444 /sys/kernel/debug/tracing/per_cpu/cpu2/snapshot_raw",
"chmod 0444 /sys/kernel/debug/tracing/per_cpu/cpu3/snapshot_raw",
"chmod 0444 /sys/kernel/debug/tracing/per_cpu/cpu4/snapshot_raw",
"chmod 0444 /sys/kernel/debug/tracing/per_cpu/cpu5/snapshot_raw",
"chmod 0444 /sys/kernel/debug/tracing/per_cpu/cpu6/snapshot_raw",
"chmod 0444 /sys/kernel/debug/tracing/per_cpu/cpu7/snapshot_raw",
"chmod 0444 /sys/kernel/debug/tracing/per_cpu/cpu8/snapshot_raw",
"chmod 0444 /sys/kernel/debug/tracing/per_cpu/cpu9/snapshot_raw",
"chmod 0444 /sys/kernel/debug/tracing/per_cpu/cpu10/snapshot_raw",
"chmod 0444 /sys/kernel/debug/tracing/per_cpu/cpu11/snapshot_raw",
"chmod 0444 /sys/kernel/debug/tracing/per_cpu/cpu12/snapshot_raw",
"chmod 0444 /sys/kernel/debug/tracing/per_cpu/cpu13/snapshot_raw",
"chmod 0444 /sys/kernel/debug/tracing/per_cpu/cpu14/snapshot_raw",
"chmod 0444 /sys/kernel/debug/tracing/per_cpu/cpu15/snapshot_raw",
"write /sys/kernel/tracing/tracing_on 0",
"chmod 0666 /sys/kernel/tracing/buffer_size_kb",
"chmod 0666 /sys/kernel/tracing/current_tracer",
"chmod 0666 /sys/kernel/tracing/saved_cmdlines_size",
"chmod 0666 /sys/kernel/tracing/trace",
"chmod 0666 /sys/kernel/tracing/snapshot",
"chmod 0666 /sys/kernel/tracing/trace_clock",
"chmod 0222 /sys/kernel/tracing/trace_marker",
"chmod 0666 /sys/kernel/tracing/tracing_on",
"chmod 0666 /sys/kernel/tracing/events/binder/binder_lock/enable",
"chmod 0666 /sys/kernel/tracing/events/binder/binder_locked/enable",
"chmod 0666 /sys/kernel/tracing/events/binder/binder_unlock/enable",
"chmod 0666 /sys/kernel/tracing/events/binder/binder_transaction/enable",
"chmod 0666 /sys/kernel/tracing/events/binder/binder_transaction_received/enable",
"chmod 0666 /sys/kernel/tracing/events/binder/binder_transaction_alloc_buf/enable",
"chmod 0666 /sys/kernel/tracing/events/cgroup/enable",
"chmod 0666 /sys/kernel/tracing/events/cpufreq_interactive/enable",
"chmod 0666 /sys/kernel/tracing/events/dma_fence/enable",
"chmod 0666 /sys/kernel/tracing/events/fence/enable",
"chmod 0666 /sys/kernel/tracing/events/i2c/enable",
"chmod 0666 /sys/kernel/tracing/events/i2c/i2c_read/enable",
"chmod 0666 /sys/kernel/tracing/events/i2c/i2c_write/enable",
"chmod 0666 /sys/kernel/tracing/events/i2c/i2c_result/enable",
"chmod 0666 /sys/kernel/tracing/events/i2c/i2c_reply/enable",
"chmod 0666 /sys/kernel/tracing/events/i2c/smbus_read/enable",
"chmod 0666 /sys/kernel/tracing/events/i2c/smbus_write/enable",
"chmod 0666 /sys/kernel/tracing/events/i2c/smbus_result/enable",
"chmod 0666 /sys/kernel/tracing/events/i2c/smbus_reply/enable",
"chmod 0666 /sys/kernel/tracing/events/kmem/rss_stat/enable",
"chmod 0666 /sys/kernel/tracing/events/kmem/ion_heap_grow/enable",
"chmod 0666 /sys/kernel/tracing/events/kmem/ion_heap_shrink/enable",
"chmod 0666 /sys/kernel/tracing/events/lowmemorykiller/enable",
"chmod 0666 /sys/kernel/tracing/events/lowmemorykiller/lowmemory_kill/enable",
"chmod 0666 /sys/kernel/tracing/events/mm_event/mm_event_record/enable",
"chmod 0666 /sys/kernel/tracing/events/oom/oom_score_adj_update/enable",
"chmod 0666 /sys/kernel/tracing/events/power/cpu_frequency/enable",
"chmod 0666 /sys/kernel/tracing/events/power/cpu_idle/enable",
"chmod 0666 /sys/kernel/tracing/events/power/clock_set_rate/enable",
"chmod 0666 /sys/kernel/tracing/events/power/cpu_frequency_limits/enable",
"chmod 0666 /sys/kernel/tracing/events/power/gpu_frequency/enable",
"chmod 0666 /sys/kernel/tracing/events/sched/sched_switch/enable",
"chmod 0666 /sys/kernel/tracing/events/sched/sched_wakeup/enable",
"chmod 0666 /sys/kernel/tracing/events/sched/sched_blocked_reason/enable",
"chmod 0666 /sys/kernel/tracing/events/sched/sched_cpu_hotplug/enable",
"chmod 0666 /sys/kernel/tracing/events/sched/sched_pi_setprio/enable",
"chmod 0666 /sys/kernel/tracing/events/sched/sched_process_exit/enable",
"chmod 0666 /sys/kernel/tracing/events/sched/sched_waking/enable",
"chmod 0666 /sys/kernel/tracing/events/signal/signal_generate/enable",
"chmod 0666 /sys/kernel/tracing/events/signal/signal_deliver/enable",
"chmod 0666 /sys/kernel/tracing/events/sync/enable",
"chmod 0666 /sys/kernel/tracing/events/task/task_rename/enable",
"chmod 0666 /sys/kernel/tracing/events/task/task_newtask/enable",
"chmod 0666 /sys/kernel/tracing/events/vmscan/mm_vmscan_direct_reclaim_begin/enable",
"chmod 0666 /sys/kernel/tracing/events/vmscan/mm_vmscan_direct_reclaim_end/enable",
"chmod 0666 /sys/kernel/tracing/events/vmscan/mm_vmscan_kswapd_wake/enable",
"chmod 0666 /sys/kernel/tracing/events/vmscan/mm_vmscan_kswapd_sleep/enable",
"chmod 0666 /sys/kernel/tracing/events/block/block_rq_issue/enable",
"chmod 0666 /sys/kernel/tracing/events/block/block_rq_complete/enable",
"chmod 0666 /sys/kernel/tracing/events/ext4/ext4_da_write_begin/enable",
"chmod 0666 /sys/kernel/tracing/events/ext4/ext4_da_write_end/enable",
"chmod 0666 /sys/kernel/tracing/events/ext4/ext4_es_lookup_extent_enter/enable",
"chmod 0666 /sys/kernel/tracing/events/ext4/ext4_es_lookup_extent_exit/enable",
"chmod 0666 /sys/kernel/tracing/events/ext4/ext4_load_inode/enable",
"chmod 0666 /sys/kernel/tracing/events/ext4/ext4_sync_file_enter/enable",
"chmod 0666 /sys/kernel/tracing/events/ext4/ext4_sync_file_exit/enable",
"chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_get_data_block/enable",
"chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_iget/enable",
"chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_sync_file_enter/enable",
"chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_sync_file_exit/enable",
"chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_write_begin/enable",
"chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_write_end/enable",
"chmod 0666 /sys/kernel/tracing/events/filemap/mm_filemap_add_to_page_cache/enable",
"chmod 0666 /sys/kernel/tracing/events/filemap/mm_filemap_delete_from_page_cache/enable",
"chmod 0666 /sys/kernel/tracing/options/overwrite",
"chmod 0666 /sys/kernel/tracing/options/print-tgid",
"chmod 0666 /sys/kernel/tracing/options/record-tgid",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu0/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu1/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu2/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu3/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu4/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu5/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu6/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu7/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu8/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu9/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu10/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu11/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu12/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu13/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu14/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu15/trace",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu0/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu1/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu2/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu3/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu4/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu5/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu6/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu7/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu8/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu9/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu10/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu11/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu12/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu13/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu14/snapshot",
"chmod 0666 /sys/kernel/tracing/per_cpu/cpu15/snapshot",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu0/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu1/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu2/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu3/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu4/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu5/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu6/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu7/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu8/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu9/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu10/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu11/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu12/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu13/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu14/snapshot_raw",
"chmod 0444 /sys/kernel/tracing/per_cpu/cpu15/snapshot_raw",
"chmod 0666 /sys/kernel/debug/tracing/options/record-cmd",
"chmod 0666 /sys/kernel/debug/tracing/events/power/suspend_resume/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/sched/sched_process_free/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/sched/sched_wakeup_new/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/writeback/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/workqueue/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/vmscan/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/v4l2/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/timer/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/sunrpc/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/signal/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/sched/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/regulator/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/rcu/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/raw_syscalls/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/printk/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/power/enable",
"chmod 0666 /sys/kernel/debug/tracing/set_event",
"chmod 0666 /sys/kernel/debug/tracing/events/pagemap/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/oom/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/net/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/binder/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/block/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/clk/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/clk/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/compaction/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/cpuhp/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/ext4/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/f2fs/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/filelock/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/filemap/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/ftrace/enable",
"chmod 0755 /sys/kernel/debug/tracing/events/ftrace",
"chmod 0755 /sys/kernel/debug/tracing/events/ftrace/print",
"chmod 0666 /sys/kernel/debug/tracing/events/gpio/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/ipi/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/kmem/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/mmc/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/irq/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/task/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/clk/clk_disable/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/clk/clk_disable_complete/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/clk/clk_enable/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/clk/clk_enable_complete/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/clk/clk_set_rate/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/clk/clk_set_rate_complete/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/ftrace/print/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/irq/irq_handler_entry/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/irq/irq_handler_exit/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/irq/softirq_entry/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/irq/softirq_exit/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/irq/softirq_raise/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/power/clock_disable/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/power/clock_enable/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/workqueue/workqueue_execute_end/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/workqueue/workqueue_execute_start/enable",
"chmod 0666 /sys/kernel/debug/tracing/events/thermal_power_allocator/enable",
"setparam debug.hitrace.tags.enableflags 0"
]
}
]
}

View File

@ -151,6 +151,7 @@ void MiddleTraceDebug(bool isDebug, uint64_t label, const std::string& beforeVal
void CountTrace(uint64_t label, const std::string& name, int64_t count);
void CountTraceDebug(bool isDebug, uint64_t label, const std::string& name, int64_t count);
void CountTraceWrapper(uint64_t label, const char *name, int64_t count);
bool IsTagEnabled(uint64_t tag);
class HitraceScoped {
public:

View File

@ -168,13 +168,13 @@ cJSON* ParseJsonFromFile(const std::string& filePath)
{
std::ifstream inFile(filePath, std::ios::in);
if (!inFile.is_open()) {
HiLog::Error(LABEL, "ParseJsonFromFile: %{pubilc}s is not existed.", filePath.c_str());
HiLog::Error(LABEL, "ParseJsonFromFile: %{public}s is not existed.", filePath.c_str());
return nullptr;
}
std::string fileContent((std::istreambuf_iterator<char>(inFile)), std::istreambuf_iterator<char>());
cJSON* root = cJSON_Parse(fileContent.c_str());
if (root == nullptr) {
HiLog::Error(LABEL, "ParseJsonFromFile: %{pubilc}s is not in JSON format.", filePath.c_str());
HiLog::Error(LABEL, "ParseJsonFromFile: %{public}s is not in JSON format.", filePath.c_str());
}
inFile.close();
return root;
@ -249,7 +249,7 @@ bool ParseTagInfo(std::map<std::string, TagCategory> &allTags,
}
cJSON* tagCategory = cJSON_GetObjectItem(root, "tag_category");
if (tagCategory == nullptr) {
HiLog::Error(LABEL, "ParseTagInfo: %{pubilc}s is not contain tag_category node.", traceUtilsPath.c_str());
HiLog::Error(LABEL, "ParseTagInfo: %{public}s is not contain tag_category node.", traceUtilsPath.c_str());
cJSON_Delete(root);
return false;
}
@ -259,7 +259,7 @@ bool ParseTagInfo(std::map<std::string, TagCategory> &allTags,
}
cJSON* tagGroups = cJSON_GetObjectItem(root, "tag_groups");
if (tagGroups == nullptr) {
HiLog::Error(LABEL, "ParseTagInfo: %{pubilc}s is not contain tag_groups node.", traceUtilsPath.c_str());
HiLog::Error(LABEL, "ParseTagInfo: %{public}s is not contain tag_groups node.", traceUtilsPath.c_str());
cJSON_Delete(root);
return false;
}
@ -276,7 +276,7 @@ bool CheckTags(const std::vector<std::string> &tags, const std::map<std::string,
{
for (auto tag : tags) {
if (allTags.find(tag) == allTags.end()) {
HiLog::Error(LABEL, "CheckTags: %{pubilc}s is not provided.", tag.c_str());
HiLog::Error(LABEL, "CheckTags: %{public}s is not provided.", tag.c_str());
return false;
}
}
@ -288,7 +288,7 @@ bool CheckTagGroup(const std::vector<std::string> &tagGroups,
{
for (auto groupName : tagGroups) {
if (tagGroupTable.find(groupName) == tagGroupTable.end()) {
HiLog::Error(LABEL, "CheckTagGroup: %{pubilc}s is not provided.", groupName.c_str());
HiLog::Error(LABEL, "CheckTagGroup: %{public}s is not provided.", groupName.c_str());
return false;
}
}
@ -300,12 +300,12 @@ bool WriteStrToFile(const std::string& filename, const std::string& str)
std::ofstream out;
out.open(g_traceRootPath + filename, std::ios::out);
if (out.fail()) {
HiLog::Error(LABEL, "WriteStrToFile: %{pubilc}s open failed.", filename.c_str());
HiLog::Error(LABEL, "WriteStrToFile: %{public}s open failed.", filename.c_str());
return false;
}
out << str;
if (out.bad()) {
HiLog::Error(LABEL, "WriteStrToFile: %{pubilc}s write failed.", filename.c_str());
HiLog::Error(LABEL, "WriteStrToFile: %{public}s write failed.", filename.c_str());
out.close();
return false;
}
@ -334,9 +334,9 @@ bool SetProperty(const std::string& property, const std::string& value)
{
bool result = OHOS::system::SetParameter(property, value);
if (!result) {
HiLog::Error(LABEL, "SetProperty: set %{pubilc}s failed.", value.c_str());
HiLog::Error(LABEL, "SetProperty: set %{public}s failed.", value.c_str());
} else {
HiLog::Info(LABEL, "SetProperty: set %{pubilc}s success.", value.c_str());
HiLog::Info(LABEL, "SetProperty: set %{public}s success.", value.c_str());
}
return result;
}
@ -406,7 +406,6 @@ void SetAllTags(const TraceParams &traceParams, const std::map<std::string, TagC
if (iter->second.type == 1) {
for (const auto& path : iter->second.sysFiles) {
SetFtraceEnabled(path, true);
HiLog::Info(LABEL, "Ftrace Enabled: set %{pubilc}s success.", path.c_str());
}
}
}
@ -418,7 +417,7 @@ std::string ReadFile(const std::string& filename)
std::string resolvedPath = CanonicalizeSpecPath((g_traceRootPath + filename).c_str());
std::ifstream fileIn(resolvedPath.c_str());
if (!fileIn.is_open()) {
HiLog::Error(LABEL, "ReadFile: %{pubilc}s open failed.", filename.c_str());
HiLog::Error(LABEL, "ReadFile: %{public}s open failed.", filename.c_str());
return "";
}
@ -436,7 +435,7 @@ void SetClock(const std::string& clockType)
}
std::string allClocks = ReadFile(traceClockPath);
if (allClocks.find(clockType) == std::string::npos) {
HiLog::Error(LABEL, "SetClock: %{pubilc}s is non-existent, set to boot", clockType.c_str());
HiLog::Error(LABEL, "SetClock: %{public}s is non-existent, set to boot", clockType.c_str());
WriteStrToFile(traceClockPath, "boot"); // set default: boot
return;
}
@ -611,7 +610,6 @@ bool WriteEventsFormat(int outFd)
return false;
}
const std::vector<std::string> priorityTracingCategory = {
"events/sched/sched_waking/format",
"events/sched/sched_wakeup/format",
"events/sched/sched_switch/format",
"events/sched/sched_blocked_reason/format",
@ -620,14 +618,42 @@ bool WriteEventsFormat(int outFd)
"events/power/cpu_frequency_limits/format",
"events/f2fs/f2fs_sync_file_enter/format",
"events/f2fs/f2fs_sync_file_exit/format",
"events/f2fs/f2fs_readpage/format",
"events/f2fs/f2fs_readpages/format",
"events/f2fs/f2fs_sync_fs/format",
"events/hmdfs/hmdfs_syncfs_enter/format",
"events/hmdfs/hmdfs_syncfs_exit/format",
"events/erofs/erofs_readpage/format",
"events/erofs/erofs_readpages/format",
"events/ext4/ext4_da_write_begin/format",
"events/ext4/ext4_da_write_end/format",
"events/ext4/ext4_sync_file_enter/format",
"events/ext4/ext4_sync_file_exit/format",
"events/block/block_bio_remap/format",
"events/block/block_rq_issue/format",
"events/block/block_rq_complete/format",
"events/block/block_rq_insert/format",
"event/dma_fence/dma_fence_emit/format",
"event/dma_fence/dma_fence_destroy/format",
"event/dma_fence/dma_fence_enable_signa;/format",
"event/dma_fence/dma_fence_signaled/format",
"event/dma_fence/dma_fence_wait_end/format",
"event/dma_fence/dma_fence_wait_start/format",
"event/dma_fence/dma_fence_init/format",
"events/binder/binder_transaction/format",
"events/binder/binder_transaction_received/format",
"events/mmc/mmc_request_start/format",
"events/mmc/mmc_request_done/format",
"events/memory_bus/format",
"events/cpufreq_interactive/format",
"events/filemap/file_check_and_advance_wb_err/format",
"events/filemap/filemap_set_wb_err/format",
"events/filemap/mm_filemap_add_to_page_cache/format",
"events/filemap/mm_filemap_delete_from_page_cache/format",
"events/workqueue/workqueue_execute_end/format",
"events/workqueue/workqueue_execute_start/format",
"events/thermal_power_allocator/thermal_power_allocator/format",
"events/thermal_power_allocator/thermal_power_allocator_pid/format",
"events/ftrace/print/format",
};
for (size_t i = 0; i < priorityTracingCategory.size(); i++) {

View File

@ -41,7 +41,7 @@ namespace {
int g_markerFd = -1;
std::once_flag g_onceFlag;
std::once_flag g_onceWriteMarkerFailedFlag;
CachedHandle cachedHandle;
CachedHandle g_cachedHandle;
std::atomic<bool> g_isHitraceMeterDisabled(false);
std::atomic<bool> g_isHitraceMeterInit(false);
@ -96,10 +96,23 @@ bool IsAppValid()
uint64_t GetSysParamTags()
{
// Get the system parameters of KEY_TRACE_TAG.
uint64_t tags = OHOS::system::GetUintParameter<uint64_t>(KEY_TRACE_TAG, 0);
if (tags == 0) {
// HiLog::Error(LABEL, "GetUintParameter %s error.\n", KEY_TRACE_TAG.c_str());
return 0;
uint64_t tags = 0;
if (g_cachedHandle == nullptr) {
tags = OHOS::system::GetUintParameter<uint64_t>(KEY_TRACE_TAG, 0);
if (tags == 0) {
// HiLog::Error(LABEL, "GetUintParameter %s error .\n", KEY_TRACE_TAG.c_str());
return 0;
}
g_cachedHandle = CachedParameterCreate(KEY_TRACE_TAG.c_str(), nullptr);
} else {
int changed = 0;
const char *paramValue = CachedParameterGetChanged(g_cachedHandle, &changed);
if (changed == 1) {
HiLog::Info(LABEL, "g_tagsProperty changed, previous is %{public}s.", to_string(g_tagsProperty.load()).c_str());
tags = strtoull(paramValue, nullptr, 0);
} else {
return g_tagsProperty;
}
}
IsAppValid();
@ -123,8 +136,6 @@ void OpenTraceMarkerFile()
}
// get tags and pid
g_tagsProperty = GetSysParamTags();
const char* devValue = "true";
cachedHandle = CachedParameterCreate(KEY_TRACE_TAG.c_str(), devValue);
std::string pidStr = std::to_string(getpid());
errno_t ret = strcpy_s(g_pid, PID_BUF_SIZE, pidStr.c_str());
if (ret != 0) {
@ -190,14 +201,7 @@ void AddHitraceMeterMarker(MarkerType type, uint64_t tag, const std::string& nam
}
std::call_once(g_onceFlag, OpenTraceMarkerFile);
}
int changed = 0;
const char *paramValue = CachedParameterGetChanged(cachedHandle, &changed);
if (changed == 1) {
HiLog::Info(LABEL, "g_tagsProperty changed, previous is %{public}s.", to_string(g_tagsProperty.load()).c_str());
uint64_t tags = strtoull(paramValue, nullptr, 0);
g_tagsProperty = (tags | HITRACE_TAG_ALWAYS) & HITRACE_TAG_VALID_MASK;
HiLog::Info(LABEL, "g_tagsProperty changed, now is %{public}s.", to_string(g_tagsProperty.load()).c_str());
}
g_tagsProperty = GetSysParamTags();
if (UNEXPECTANTLY(g_tagsProperty & tag) && g_markerFd != -1) {
// record fomart: "type|pid|name value".
char buf[BUFFER_LEN] = {0};
@ -460,3 +464,8 @@ HitraceMeterFmtScoped::HitraceMeterFmtScoped(uint64_t label, const char *fmt, ..
}
AddHitraceMeterMarker(MARKER_BEGIN, label, name, 0);
}
bool IsTagEnabled(uint64_t tag) {
uint64_t enabledUserTags = GetSysParamTags();
return ((tag & enabledUserTags) == tag);
}

View File

@ -916,6 +916,38 @@ HWTEST_F(HitraceNDKTest, StartTrace_025, TestSize.Level1)
ASSERT_TRUE(RunCmd("bytrace -b 2048 -t 10 -o /data/local/tmp/test21 load"));
}
/**
* @tc.name: Hitrace
* @tc.desc: Testing IsTagEnabled
* @tc.type: FUNC
*/
HWTEST_F(HitraceNDKTest, StartTrace_026, TestSize.Level1)
{
const std::string KEY_TRACE_TAG = "debug.hitrace.tags.enableflags";
ASSERT_TRUE(SetProperty(KEY_TRACE_TAG, std::to_string(HITRACE_TAG_USB | HITRACE_TAG_HDF)));
ASSERT_TRUE(IsTagEnabled(HITRACE_TAG_USB));
ASSERT_TRUE(IsTagEnabled(HITRACE_TAG_HDF));
ASSERT_FALSE(IsTagEnabled(HITRACE_TAG_ZAUDIO));
ASSERT_FALSE(IsTagEnabled(HITRACE_TAG_GLOBAL_RESMGR));
ASSERT_FALSE(IsTagEnabled(HITRACE_TAG_POWER));
}
/**
* @tc.name: Hitrace
* @tc.desc: Testing IsTagEnabled with multiple tags
* @tc.type: FUNC
*/
HWTEST_F(HitraceNDKTest, StartTrace_027, TestSize.Level1)
{
const std::string KEY_TRACE_TAG = "debug.hitrace.tags.enableflags";
ASSERT_TRUE(SetProperty(KEY_TRACE_TAG, std::to_string(HITRACE_TAG_ZIMAGE | HITRACE_TAG_HDF | HITRACE_TAG_ZAUDIO)));
ASSERT_FALSE(IsTagEnabled(HITRACE_TAG_USB));
ASSERT_TRUE(IsTagEnabled(HITRACE_TAG_HDF));
ASSERT_TRUE(IsTagEnabled(HITRACE_TAG_ZAUDIO | HITRACE_TAG_HDF));
ASSERT_TRUE(IsTagEnabled(HITRACE_TAG_ZAUDIO | HITRACE_TAG_HDF | HITRACE_TAG_ZIMAGE));
ASSERT_FALSE(IsTagEnabled(HITRACE_TAG_POWER));
}
} // namespace HitraceTest
} // namespace HiviewDFX
} // namespace OHOS