timemory  3.2.1
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 
39 namespace tim
40 {
41 //
42 struct settings;
43 //
44 namespace argparse
45 {
46 struct argument_parser;
47 }
48 //
49 //--------------------------------------------------------------------------------------//
50 //
51 // config
52 //
53 //--------------------------------------------------------------------------------------//
54 //
55 /// initialization (creates manager and configures output path)
56 //
57 void
58 timemory_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)
64 void
65 timemory_init(const std::string& exe_name, const std::string& _prefix = "timemory-",
66  const std::string& _suffix = "-output");
67 //
68 //--------------------------------------------------------------------------------------//
69 //
70 /// initialization (creates manager, configures output path, mpi_init)
71 void
72 timemory_init(int* argc, char*** argv, const std::string& _prefix = "timemory-",
73  const std::string& _suffix = "-output");
74 //
75 //--------------------------------------------------------------------------------------//
76 //
77 void
79  const std::string& _prefix = "timemory-",
80  const std::string& _suffix = "-output");
81 //
82 //--------------------------------------------------------------------------------------//
83 //
84 void
85 timemory_init(std::vector<std::string>&, argparse::argument_parser& parser,
86  const std::string& _prefix = "timemory-",
87  const std::string& _suffix = "-output");
88 //
89 //--------------------------------------------------------------------------------------//
90 //
91 /// finalization of the specified types
92 void
94 //
95 //--------------------------------------------------------------------------------------//
96 //
97 void
98 timemory_argparse(int* argc, char*** argv, argparse::argument_parser* parser = nullptr,
99  settings* _settings = nullptr);
100 //
101 //--------------------------------------------------------------------------------------//
102 //
103 void
104 timemory_argparse(std::vector<std::string>&, argparse::argument_parser* parser = nullptr,
105  settings* _settings = nullptr);
106 //
107 //--------------------------------------------------------------------------------------//
108 //
109 template <typename... Args>
110 void
111 init(Args&&... args)
112 {
113  timemory_init(std::forward<Args>(args)...);
114 }
115 //
116 //--------------------------------------------------------------------------------------//
117 //
118 inline void
120 {
122 }
123 //
124 //--------------------------------------------------------------------------------------//
125 //
126 template <typename... Types, typename... Args,
127  enable_if_t<(sizeof...(Types) > 0 && sizeof...(Args) >= 2), int> = 0>
128 inline void
129 timemory_init(Args&&... _args);
130 //
131 //--------------------------------------------------------------------------------------//
132 //
133 namespace 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 ///
138 template <typename Func>
139 void
140 read_command_line(Func&& _func);
141 //
142 } // namespace config
143 //
144 //--------------------------------------------------------------------------------------//
145 //
146 } // namespace tim
Include the macros for config.
Definition: kokkosp.cpp:38
char const std::string & _prefix
Definition: definition.hpp:59
void timemory_finalize()
finalization of the specified types
timemory_argparse(argc, argv)
std::string exe_name
Definition: definition.hpp:107
void timemory_init(Args &&... _args)
Definition: declaration.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:285
void init(Args &&... args)
Definition: types.hpp:111
char ** argv
Definition: definition.hpp:59
char argparse::argument_parser & parser
Definition: definition.hpp:209
char argparse::argument_parser tim::settings * _settings
Definition: definition.hpp:277
tim::mpl::apply< std::string > string
Definition: macros.hpp:52
void finalize()
Definition: types.hpp:119
char const std::string const std::string & _suffix
Definition: definition.hpp:61