Dobby  3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
PerfettoPlugin.h
1 /*
2 * If not stated otherwise in this file or this component's LICENSE file the
3 * following copyright and licenses apply:
4 *
5 * Copyright 2020 Sky UK
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19 
20 /*
21  * File: PerfettoPlugin.h
22  *
23  */
24 #ifndef PERFETTOPLUGIN_H
25 #define PERFETTOPLUGIN_H
26 
27 #include <IDobbyPlugin.h>
28 #include <PluginBase.h>
29 
30 #include <sys/types.h>
31 #include <netinet/in.h>
32 
33 #include <unistd.h>
34 #include <string>
35 #include <memory>
36 
37 // -----------------------------------------------------------------------------
46 class PerfettoPlugin : public PluginBase
47 {
48 public:
49  PerfettoPlugin(const std::shared_ptr<IDobbyEnv> &env,
50  const std::shared_ptr<IDobbyUtils> &utils);
51  ~PerfettoPlugin() final;
52 
53 public:
54  std::string name() const final;
55 
56  unsigned hookHints() const final;
57 
58 public:
59  bool postConstruction(const ContainerId& id,
60  const std::shared_ptr<IDobbyStartState>& startupState,
61  const std::string& rootfsPath,
62  const Json::Value& jsonData) final;
63 
64 private:
65  const std::string mName;
66  const std::shared_ptr<IDobbyUtils> mUtilities;
67 
68  const std::string mDefaultPerfettoSockPath;
69 
70 };
71 
72 #endif // !defined(PERFETTOPLUGIN_H)
A wrapper around a std::string, used to add some type definition to to an id and also to sanity check...
Definition: ContainerId.h:41
Dobby plugin for granting access to system perfetto tracing in the container.
Definition: PerfettoPlugin.h:47
unsigned hookHints() const final
Indicates which hook points we want and whether to run the asynchronously or synchronously with the o...
Definition: PerfettoPlugin.cpp:78
bool postConstruction(const ContainerId &id, const std::shared_ptr< IDobbyStartState > &startupState, const std::string &rootfsPath, const Json::Value &jsonData) final
Adds bind mounts for the perfetto producer socket if it exists.
Definition: PerfettoPlugin.cpp:95
std::string name() const final
Boilerplate that just returns the name of the plugin.
Definition: PerfettoPlugin.cpp:66
Basic object that provides the default overrides for a plugin.
Definition: PluginBase.h:38