Skip to content
Mario Bielert edited this page Mar 19, 2018 · 15 revisions

The Score-P Plugin C++ wrapper provides an interface to create metric plugins for the Score-P measurement environment. Such plugins allow adding arbitrary measurement and system data to traces of executions of instrumented applications.

Prerequisites

To compile this wrapper and thus your plugin, you need:

  • a C++14 compiler
  • Score-P

Build settings

The whole wrapper makes heavily use of C++14 features, so you'll need a compliant compiler.

If you are using CMake, just add this folder with the add_subdirectory() command and link your target against the Scorep::scorep-plugin-cxx library:

add_subdirectory(scorep)

target_link_library(MyMetricPlugin PRIVATE Scorep::scorep-plugin-cxx)

Getting started

In order to write a simple plugin with the wrapper, you have to:

#include <scorep/plugin/plugin.hpp>

Then you create a class, e.g., my_first_plugin, which inherits from the base class scorep::plugin::base. The base class needs several template arguments. The first argument is your plugin class itself. The following template arguments are the used policies.

class my_first_plugin
  : public scorep::plugin::base<my_first_plugin, Policies...>

Then you have to define the - for your set of policies required - member functions in your plugin class.

Finally, you insert the following macro at the bottom of your file. The first argument is again your plugin class and the second argument is the plugin name (See Environment). The name should match the name of the .so library for your plugin, e.g., libmy_first_plugin.so matches to my_first.

SCOREP_METRIC_PLUGIN_CLASS(my_first_plugin, "my_first")

The plugin name determines the output added when a message is logged, and the prefix for environment variables.

Clone this wiki locally