Dobby  3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Public Member Functions | Private Attributes | List of all members
PerfettoPlugin Class Reference

Dobby plugin for granting access to system perfetto tracing in the container. More...

#include <PerfettoPlugin.h>

Inheritance diagram for PerfettoPlugin:
Inheritance graph
[legend]
Collaboration diagram for PerfettoPlugin:
Collaboration graph
[legend]

Public Member Functions

 PerfettoPlugin (const std::shared_ptr< IDobbyEnv > &env, const std::shared_ptr< IDobbyUtils > &utils)
 
std::string name () const final
 Boilerplate that just returns the name of the plugin. More...
 
unsigned hookHints () const final
 Indicates which hook points we want and whether to run the asynchronously or synchronously with the other hooks. More...
 
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. More...
 
- Public Member Functions inherited from PluginBase
virtual bool preStart (const ContainerId &id, pid_t pid, const std::string &rootfsPath, const Json::Value &jsonData) override
 Hook function called after the container is setup, but before the init process is executed. More...
 
virtual bool postStart (const ContainerId &id, pid_t pid, const std::string &rootfsPath, const Json::Value &jsonData) override
 Hook function called after the container is started and the init process is now running. More...
 
virtual bool postStop (const ContainerId &id, const std::string &rootfsPath, const Json::Value &jsonData) override
 Hook function called after the container has stopped. More...
 
virtual bool preDestruction (const ContainerId &id, const std::string &rootfsPath, const Json::Value &jsonData) override
 Hook function called just before the rootfs is deleted, this is called even if there was an error starting the container. More...
 

Private Attributes

const std::string mName
 
const std::shared_ptr< IDobbyUtilsmUtilities
 
const std::string mDefaultPerfettoSockPath
 

Additional Inherited Members

- Public Types inherited from IDobbyPlugin
enum  HintFlags : unsigned {
  PostConstructionSync = (1 << 0) , PreStartSync = (1 << 1) , PostStartSync = (1 << 2) , PostStopSync = (1 << 3) ,
  PreDestructionSync = (1 << 4) , PostConstructionAsync = (1 << 16) , PreStartAsync = (1 << 17) , PostStartAsync = (1 << 18) ,
  PostStopAsync = (1 << 19) , PreDestructionAsync = (1 << 20)
}
 Bit flags that should be returned by hookHints. More...
 

Detailed Description

Dobby plugin for granting access to system perfetto tracing in the container.

For now this just bind mounts in the standard perfetto socket used for IPC.

Member Function Documentation

◆ hookHints()

unsigned PerfettoPlugin::hookHints ( ) const
finalvirtual

Indicates which hook points we want and whether to run the asynchronously or synchronously with the other hooks.

For PerfettoPlugin everything is done in the postConstruction phase.

Implements IDobbyPlugin.

◆ name()

std::string PerfettoPlugin::name ( ) const
finalvirtual

Boilerplate that just returns the name of the plugin.

This string needs to match the name specified in the container spec json.

Implements IDobbyPlugin.

◆ postConstruction()

bool PerfettoPlugin::postConstruction ( const ContainerId id,
const std::shared_ptr< IDobbyStartState > &  startupState,
const std::string &  rootfsPath,
const Json::Value &  jsonData 
)
finalvirtual

Adds bind mounts for the perfetto producer socket if it exists.

Parameters
[in]idThe id of the container.
[in]startupStateThe start-up state of the container (ignored)
[in]rootfsPathThe absolute path to the rootfs of the container.
[in]jsonDataThe parsed json data from the container spec file.
Returns
true on success, false on failure.

Reimplemented from PluginBase.


The documentation for this class was generated from the following files: