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.
types.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/or sell
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/config/types.hpp
27 * \brief Declare the config types
28 */
29
30#pragma once
31
34
35#include <string>
36#include <utility>
37#include <vector>
38
39namespace tim
40{
41//
42struct settings;
43//
44namespace argparse
45{
46struct argument_parser;
47}
48//
49//--------------------------------------------------------------------------------------//
50//
51// config
52//
53//--------------------------------------------------------------------------------------//
54//
55/// initialization (creates manager and configures output path)
56//
57void
58timemory_init(int argc, char** argv, const std::string& _prefix = "timemory-",
59 const std::string& _suffix = "-output");
60//
61//--------------------------------------------------------------------------------------//
62//
63/// initialization (creates manager and configures output path)
64void
66 const std::string& _suffix = "-output");
67//
68//--------------------------------------------------------------------------------------//
69//
70/// initialization (creates manager, configures output path, mpi_init)
71void
72timemory_init(int* argc, char*** argv, const std::string& _prefix = "timemory-",
73 const std::string& _suffix = "-output");
74//
75//--------------------------------------------------------------------------------------//
76//
77void
79 const std::string& _prefix = "timemory-",
80 const std::string& _suffix = "-output");
81//
82//--------------------------------------------------------------------------------------//
83//
84void
86 const std::string& _prefix = "timemory-",
87 const std::string& _suffix = "-output");
88//
89//--------------------------------------------------------------------------------------//
90//
91/// finalization of the specified types
92void
94//
95//--------------------------------------------------------------------------------------//
96//
97void
99 settings* _settings = nullptr);
100//
101//--------------------------------------------------------------------------------------//
102//
103void
104timemory_argparse(std::vector<std::string>&, argparse::argument_parser* parser = nullptr,
105 settings* _settings = nullptr);
106//
107//--------------------------------------------------------------------------------------//
108//
109template <typename... Args>
110void
111init(Args&&... args)
112{
113 timemory_init(std::forward<Args>(args)...);
114}
115//
116//--------------------------------------------------------------------------------------//
117//
118inline void
120{
122}
123//
124//--------------------------------------------------------------------------------------//
125//
126template <typename... Types, typename... Args,
127 enable_if_t<(sizeof...(Types) > 0 && sizeof...(Args) >= 2), int> = 0>
128inline void
129timemory_init(Args&&... _args);
130//
131//--------------------------------------------------------------------------------------//
132//
133namespace config
134{
135/// \fn void tim::config::read_command_line(Func&&)
136/// \brief this only works on Linux where there is a /proc/<PID>/cmdline file
137///
138template <typename Func>
139void
140read_command_line(Func&& _func);
141//
142} // namespace config
143//
144//--------------------------------------------------------------------------------------//
145//
146} // namespace tim
Include the macros for config.
Definition: kokkosp.cpp:39
std::array< char *, 4 > _args
char const std::string & _prefix
Definition: config.cpp:55
void timemory_finalize()
finalization of the specified types
timemory_argparse(argc, argv)
std::string exe_name
Definition: config.cpp:77
void timemory_init(Args &&... _args)
Definition: config.hpp:49
typename std::enable_if< B, T >::type enable_if_t
Alias template for enable_if.
Definition: types.hpp:190
std::vector< std::string > read_command_line(pid_t _pid)
Definition: utility.cpp:114
void init(Args &&... args)
Definition: types.hpp:111
char ** argv
Definition: config.cpp:55
char argparse::argument_parser & parser
Definition: config.cpp:187
char argparse::argument_parser tim::settings * _settings
Definition: config.cpp:255
tim::mpl::apply< std::string > string
Definition: macros.hpp:53
void finalize()
Definition: types.hpp:119
char const std::string const std::string & _suffix
Definition: config.cpp:57