• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 #ifndef PLUGIN_INTERFACE_H
17 #define PLUGIN_INTERFACE_H
18 
19 #include <map>
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 class ProfilerPluginConfig;
25 class PluginResult;
26 class CommandPoller;
27 
28 class ManagerInterface {
29 public:
~ManagerInterface()30     virtual ~ManagerInterface() {}
31 
32     virtual bool LoadPlugin(const std::string& pluginPath) = 0;
33     virtual bool UnloadPlugin(const std::string& pluginPath) = 0;
34     virtual bool UnloadPlugin(const uint32_t pluginId) = 0;
35 
36     // CommandPoller will call the following four interfaces after receiving the command
37     virtual bool CreatePluginSession(const std::vector<ProfilerPluginConfig>& config) = 0;
38     virtual bool DestroyPluginSession(const std::vector<uint32_t>& pluginIds) = 0;
39     virtual bool StartPluginSession(const std::vector<uint32_t>& pluginIds,
40                                         const std::vector<ProfilerPluginConfig>& config, PluginResult& result) = 0;
41     virtual bool StopPluginSession(const std::vector<uint32_t>& pluginIds) = 0;
42     virtual bool ReportPluginBasicData(const std::vector<uint32_t>& pluginIds) = 0;
43 
44     virtual bool CreateWriter(std::string pluginName, uint32_t bufferSize, int smbFd, int eventFd) = 0;
45     virtual bool ResetWriter(uint32_t pluginId) = 0;
46     virtual void SetCommandPoller(const std::shared_ptr<CommandPoller>& p) = 0;
47 };
48 
49 #endif // PLUGIN_INTERFACE_H