1 /* 2 * Copyright (C) 2024 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 #ifndef HIVIEWDFX_HIDUMPER_INFO_WRAPPER_H 16 #define HIVIEWDFX_HIDUMPER_INFO_WRAPPER_H 17 18 #include "executor/memory/memory_info.h" 19 #include "executor/memory/smaps_memory_info.h" 20 #include <dlfcn.h> 21 #include <vector> 22 #include <string> 23 24 #define EXPORT_API __attribute__((visibility("default"))) 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 using StringMatrix = std::shared_ptr<std::vector<std::vector<std::string>>>; 31 32 EXPORT_API int GetMemoryInfoByPid(int pid, StringMatrix data, bool showAshmem, bool showDmaBuf); 33 EXPORT_API int GetMemoryInfoNoPid(int fd, StringMatrix data); 34 EXPORT_API int GetMemoryInfoPrune(int fd, StringMatrix data); 35 EXPORT_API int ShowMemorySmapsByPid(int pid, StringMatrix data, bool isShowSmapsInfo); 36 EXPORT_API void GetMemoryInfoByTimeInterval(int fd, int pid, int timeInterval); 37 EXPORT_API void SetReceivedSigInt(bool isReceivedSigInt); 38 39 #ifdef __cplusplus 40 } 41 #endif 42 43 #endif // HIVIEWDFX_HIDUMPER_INFO_WRAPPER_H