timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
components.hpp
Go to the documentation of this file.
1// MIT License
2//
3// Copyright (c) 2020, The Regents of the University of California,
4// through Lawrence Berkeley National Laboratory (subject to receipt of any
5// required approvals from the U.S. Dept. of Energy). All rights reserved.
6//
7// Permission is hereby granted, free of charge, to any person obtaining a copy
8// of this software and associated documentation files (the "Software"), to deal
9// in the Software without restriction, including without limitation the rights
10// to use, copy, modify, merge, publish, distribute, sublicense, and
11// copies of the Software, and to permit persons to whom the Software is
12// furnished to do so, subject to the following conditions:
13//
14// The above copyright notice and this permission notice shall be included in all
15// copies or substantial portions of the Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23// SOFTWARE.
24
25/**
26 * \file timemory/components/tau_marker/components.hpp
27 * \brief Implementation of the tau_marker component(s)
28 */
29
30#pragma once
31
33#include "timemory/components/tau_marker/backends.hpp"
37#include "timemory/units.hpp"
38
39//======================================================================================//
40//
41namespace tim
42{
43namespace component
44{
45/// \struct tim::component::tau_marker
46/// \brief Forwards timemory labels to the TAU (Tuning and Analysis Utilities)
47//
48struct tau_marker : public base<tau_marker, void>
49{
50 // timemory component api
51 using value_type = void;
54
55 static std::string label() { return "tau"; }
57 {
58 return "Forwards markers to TAU instrumentation (via Tau_start and Tau_stop)";
59 }
60
61#if defined(TIMEMORY_USE_TAU)
62 static void global_init() { Tau_set_node(dmp::rank()); }
63 static void thread_init() { TAU_REGISTER_THREAD(); }
64 static void start(const char* _prefix) { Tau_start(_prefix); }
65
66 static void stop(const char* _prefix)
67 {
68 Tau_stop(_prefix);
70 }
71
72 TIMEMORY_DEFAULT_OBJECT(tau_marker)
73
74 tau_marker(const char* _prefix)
75 : m_prefix(_prefix)
76 {}
77
78 void start() { Tau_start(m_prefix); }
79 void stop() { Tau_stop(m_prefix); }
80 void set_prefix(const char* _prefix) { m_prefix = _prefix; }
81
82private:
83 const char m_prefix = nullptr;
84#endif
85};
86//
87} // namespace component
88} // namespace tim
89//
90//======================================================================================//
void set_prefix(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:774
void stop(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:386
void start(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:316
Definition: kokkosp.cpp:39
char const std::string & _prefix
Definition: config.cpp:55
tim::mpl::apply< std::string > string
Definition: macros.hpp:53
void consume_parameters(ArgsT &&...)
Definition: types.hpp:285
Forwards timemory labels to the TAU (Tuning and Analysis Utilities)
Definition: components.hpp:49
static std::string description()
Definition: components.hpp:56
static std::string label()
Definition: components.hpp:55