-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcaliper-plugin.cpp
More file actions
37 lines (29 loc) · 1.02 KB
/
caliper-plugin.cpp
File metadata and controls
37 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// Copyright (c) 2016-25, Lawrence Livermore National Security, LLC
// and RAJA project contributors. See the RAJA/LICENSE file for details.
//
// SPDX-License-Identifier: (BSD-3-Clause)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
#include "RAJA/util/PluginStrategy.hpp"
#include <iostream>
#include <caliper/cali.h>
class CaliperPlugin : public RAJA::util::PluginStrategy
{
public:
void preLaunch(const RAJA::util::PluginContext&p) override
{
if(!p.kernel_name.empty()) CALI_MARK_BEGIN(p.kernel_name.c_str());
}
void postLaunch(const RAJA::util::PluginContext& p) override
{
if(!p.kernel_name.empty()) CALI_MARK_END(p.kernel_name.c_str());
}
private:
};
// Dynamically loading plugin.
extern "C" RAJA::util::PluginStrategy *RAJAGetPlugin()
{
return new CaliperPlugin;
}
// Statically loading plugin.
static RAJA::util::PluginRegistry::add<CaliperPlugin> P("Caliper", "Enables Caliper Profiling");