1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#include "ecmascript/pgo_profiler/pgo_utils.h" 17#include <cstdint> 18 19namespace panda::ecmascript::pgo { 20 21const std::string DumpUtils::ELEMENT_SEPARATOR = "/"; 22const std::string DumpUtils::BLOCK_SEPARATOR = ","; 23const std::string DumpUtils::TYPE_SEPARATOR = "|"; 24const std::string DumpUtils::BLOCK_START = ":"; 25const std::string DumpUtils::ARRAY_START = "["; 26const std::string DumpUtils::ARRAY_END = "]"; 27const std::string DumpUtils::NEW_LINE = "\n"; 28const std::string DumpUtils::SPACE = " "; 29const std::string DumpUtils::BLOCK_AND_ARRAY_START = BLOCK_START + SPACE + ARRAY_START + SPACE; 30const std::string DumpUtils::VERSION_HEADER = "Profiler Version" + BLOCK_START + SPACE; 31const std::string DumpUtils::PANDA_FILE_INFO_HEADER = "Panda file sumcheck list" + BLOCK_AND_ARRAY_START; 32const uint32_t DumpUtils::HEX_FORMAT_WIDTH_FOR_32BITS = 10; // for example, 0xffffffff is 10 characters 33 34const std::string ApNameUtils::AP_SUFFIX = ".ap"; 35const std::string ApNameUtils::RUNTIME_AP_PREFIX = "rt_"; 36const std::string ApNameUtils::MERGED_AP_PREFIX = "merged_"; 37const std::string ApNameUtils::DEFAULT_AP_NAME = "modules" + AP_SUFFIX; 38 39std::string ApNameUtils::GetRuntimeApName(const std::string &ohosModuleName) 40{ 41 return RUNTIME_AP_PREFIX + GetBriefApName(ohosModuleName); 42} 43 44std::string ApNameUtils::GetMergedApName(const std::string &ohosModuleName) 45{ 46 return MERGED_AP_PREFIX + GetBriefApName(ohosModuleName); 47} 48 49std::string ApNameUtils::GetOhosPkgApName(const std::string &ohosModuleName) 50{ 51 return GetBriefApName(ohosModuleName); 52} 53 54std::string ApNameUtils::GetBriefApName(const std::string &ohosModuleName) 55{ 56 return ohosModuleName + AP_SUFFIX; 57} 58} // namespace panda::ecmascript::pgo