1# Copyright (c) 2024 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//base/hiviewdfx/hitrace/hitrace.gni") 15import("//build/ohos.gni") 16 17ohos_source_set("hitrace_common_utils") { 18 include_dirs = [ 19 ".", 20 "$hitrace_common_path", 21 ] 22 sources = [ "common_utils.cpp" ] 23 if (defined(ohos_lite)) { 24 external_deps = [ "hilog_lite:hilog_lite" ] 25 } else { 26 external_deps = [ "hilog:libhilog" ] 27 } 28 external_deps += [ 29 "bounds_checking_function:libsec_shared", 30 "init:libbegetutil", 31 ] 32 part_name = "hitrace" 33 subsystem_name = "hiviewdfx" 34} 35 36ohos_source_set("hitrace_file_utils") { 37 include_dirs = [ 38 ".", 39 "$hitrace_common_path", 40 ] 41 sources = [ "trace_file_utils.cpp" ] 42 if (defined(ohos_lite)) { 43 external_deps = [ "hilog_lite:hilog_lite" ] 44 } else { 45 external_deps = [ "hilog:libhilog" ] 46 } 47 external_deps += [ 48 "bounds_checking_function:libsec_shared", 49 "c_utils:utils", 50 ] 51 part_name = "hitrace" 52 subsystem_name = "hiviewdfx" 53} 54 55ohos_source_set("hitrace_json_parser") { 56 include_dirs = [ 57 ".", 58 "$hitrace_common_path", 59 ] 60 sources = [ "trace_json_parser.cpp" ] 61 if (defined(ohos_lite)) { 62 external_deps = [ "hilog_lite:hilog_lite" ] 63 } else { 64 external_deps = [ "hilog:libhilog" ] 65 } 66 67 defines = [] 68 if (hitrace_snapshot_tracebuffer_size != 0) { 69 defines += 70 [ "SNAPSHOT_TRACEBUFFER_SIZE=${hitrace_snapshot_tracebuffer_size}" ] 71 } 72 if (hitrace_snapshot_file_limit != 0) { 73 defines += [ "SNAPSHOT_FILE_LIMIT=${hitrace_snapshot_file_limit}" ] 74 } 75 if (hitrace_record_file_limit != 0) { 76 defines += [ "RECORD_FILE_LIMIT=${hitrace_record_file_limit}" ] 77 } 78 79 external_deps += [ 80 "cJSON:cjson", 81 "c_utils:utils", 82 ] 83 part_name = "hitrace" 84 subsystem_name = "hiviewdfx" 85} 86