• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved.
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 #ifndef NATIVE_MEMORY_PROFILER_SA_CLIENT_MANAGER_H
17 #define NATIVE_MEMORY_PROFILER_SA_CLIENT_MANAGER_H
18 
19 #include "i_native_memory_profiler_sa.h"
20 #include <iservice_registry.h>
21 
22 #include <memory>
23 
24 namespace OHOS::Developtools::NativeDaemon {
25 class NativeMemoryProfilerSaClientManager {
26 public:
27     enum class NativeMemProfilerType : int32_t {
28         MEM_PROFILER_LIBRARY,
29         MEM_PROFILER_CALL_STACK,
30     };
31     static int32_t Start(std::shared_ptr<NativeMemoryProfilerSaConfig>& config);
32     static int32_t Start(NativeMemProfilerType type, uint32_t pid, uint32_t duration, uint32_t sampleIntervel);
33     static int32_t Stop(uint32_t pid);
34     static int32_t Stop(const std::string& name);
35     static int32_t DumpData(uint32_t fd, std::shared_ptr<NativeMemoryProfilerSaConfig>& config);
36     static int32_t GetMallocStats(int fd, int pid, int type);
37     static sptr<IRemoteObject> GetRemoteService();
38 
39 private:
40     static bool CheckConfig(const std::shared_ptr<NativeMemoryProfilerSaConfig>& config);
41 };
42 }
43 
44 #endif // NATIVE_MEMORY_PROFILER_SA_CLIENT_MANAGER_H