SST  15.1.0
StructuralSimulationToolkit
profiletool.h
1 // Copyright 2009-2025 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2025, NTESS
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef SST_CORE_PROFILE_PROFILETOOL_H
13 #define SST_CORE_PROFILE_PROFILETOOL_H
14 
15 #include "sst/core/eli/elementinfo.h"
16 #include "sst/core/sst_types.h"
17 #include "sst/core/warnmacros.h"
18 
19 #include <string>
20 
21 namespace SST {
22 class Params;
23 }
24 
25 namespace SST::Profile {
26 
27 /**
28  ProfileTool is a class loadable through the factory which allows
29  dynamic addition of profiling capabililites to profile points.
30 */
32 {
33 
34 public:
35  SST_ELI_DECLARE_BASE(ProfileTool)
36  // maybe declare extern to limit compile times??
37  SST_ELI_DECLARE_CTOR_EXTERN(const std::string&, Params&)
38  SST_ELI_DECLARE_INFO_EXTERN(
41 
42  explicit ProfileTool(const std::string& name);
43 
44  virtual ~ProfileTool() {}
45 
46  std::string getName() { return name; }
47 
48  virtual void outputData(FILE* fp) = 0;
49 
50 protected:
51  const std::string name;
52 };
53 
54 } // namespace SST::Profile
55 
56 // Register profile tools. Must register an interface
57 // (API) first, then you can register a subcomponent that implements
58 // it
59 #define SST_ELI_REGISTER_PROFILETOOL_API(cls, ...) \
60  SST_ELI_DECLARE_NEW_BASE(SST::Profile::ProfileTool,::cls) \
61  SST_ELI_NEW_BASE_CTOR(const std::string&,##__VA_ARGS__)
62 
63 #define SST_ELI_REGISTER_PROFILETOOL_DERIVED_API(cls, base, ...) \
64  SST_ELI_DECLARE_NEW_BASE(::base,::cls) \
65  SST_ELI_NEW_BASE_CTOR(const std::string&,##__VA_ARGS__)
66 
67 #define SST_ELI_REGISTER_PROFILETOOL(cls, interface, lib, name, version, desc) \
68  SST_ELI_REGISTER_DERIVED(::interface,cls,lib,name,ELI_FORWARD_AS_ONE(version),desc) \
69  SST_ELI_INTERFACE_INFO(#interface)
70 
71 #endif // SST_CORE_SUBCOMPONENT_H
Definition: link.h:37
Definition: action.cc:18
ProfileTool is a class loadable through the factory which allows dynamic addition of profiling capabi...
Definition: profiletool.h:31
Definition: paramsInfo.h:39
Parameter store.
Definition: params.h:63
Definition: interfaceInfo.h:20